Skip to content

Commit

Permalink
Add named user audience selector
Browse files Browse the repository at this point in the history
  • Loading branch information
philtr committed Mar 13, 2016
1 parent 2d7e5b2 commit d3d4042
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 0 deletions.
6 changes: 6 additions & 0 deletions docs/push.rst
Original file line number Diff line number Diff line change
Expand Up @@ -113,6 +113,12 @@ Select a single segment:
push.audience = UA.segment(segment)
Select a single named user:

.. code-block:: ruby
push.audience = UA.named_user(named_user)
Select devices that match at least one of the given selectors:

.. code-block:: ruby
Expand Down
5 changes: 5 additions & 0 deletions lib/urbanairship/push/audience.rb
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,11 @@ def segment(segment)
{ segment: segment }
end

# Select a single named user
def named_user(named_user)
{ named_user: named_user }
end

# Select devices that match at least one of the given selectors.
#
# @example
Expand Down
5 changes: 5 additions & 0 deletions spec/lib/urbanairship/push/audience_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,11 @@
:segment,
'test',
{ segment: 'test' }
],
[
:named_user,
'test',
{ named_user: 'test' }
]
].each do |selector, value, expected_result|
it "can filter for '#{selector}'" do
Expand Down

0 comments on commit d3d4042

Please sign in to comment.