Skip to content

Commit

Permalink
Merge pull request #90 from AbleTech/hotfix/tag_group_support
Browse files Browse the repository at this point in the history
Add optional group parameter when setting a push audience with tags
  • Loading branch information
jkvoorhis committed Jan 4, 2016
2 parents 69e7532 + f5019cd commit 26a17a5
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 3 deletions.
6 changes: 4 additions & 2 deletions lib/urbanairship/push/audience.rb
Original file line number Diff line number Diff line change
Expand Up @@ -37,8 +37,10 @@ def device_pin(pin)
end

# Select a single tag
def tag(tag)
{ tag: tag }
def tag(tag, group: nil)
tag_params = { tag: tag }
tag_params[:group] = group unless group.nil?
tag_params
end

# Select a single alias
Expand Down
7 changes: 6 additions & 1 deletion spec/lib/urbanairship/push/audience_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,11 @@
'test',
{ tag: 'test' }
],
[
:tag,
['test', group: 'test-group'],
{ tag: 'test', group: 'test-group' }
],
[
:alias,
'test',
Expand All @@ -69,7 +74,7 @@
]
].each do |selector, value, expected_result|
it "can filter for '#{selector}'" do
actual_payload = UA.send(selector, value)
actual_payload = UA.send(selector, *value)
expect(actual_payload).to eq expected_result
end
end
Expand Down

0 comments on commit 26a17a5

Please sign in to comment.