Class: Urbanairship::Devices::ChannelInfo
- Inherits:
-
Object
- Object
- Urbanairship::Devices::ChannelInfo
- Defined in:
- lib/urbanairship/devices/devicelist.rb
Constant Summary
Constants included from Common
Instance Attribute Summary collapse
-
#attributes ⇒ Object
Returns the value of attribute attributes.
-
#audience ⇒ Object
Returns the value of attribute audience.
-
#client ⇒ Object
writeonly
Sets the attribute client.
Instance Method Summary collapse
-
#initialize(client: required('client')) ⇒ ChannelInfo
constructor
A new instance of ChannelInfo.
- #lookup(uuid: required('uuid')) ⇒ Object
- #payload ⇒ Object
- #set_attributes ⇒ Object
Methods included from Loggable
create_logger, logger, #logger
Methods included from Common
#apid_path, #channel_path, #compact_helper, #create_and_send_path, #custom_events_path, #device_token_path, #experiments_path, #lists_path, #named_users_path, #open_channel_path, #pipelines_path, #push_path, #reports_path, #required, #schedules_path, #segments_path, #tag_lists_path, #try_helper
Constructor Details
#initialize(client: required('client')) ⇒ ChannelInfo
Returns a new instance of ChannelInfo.
13 14 15 |
# File 'lib/urbanairship/devices/devicelist.rb', line 13 def initialize(client: required('client')) @client = client end |
Instance Attribute Details
#attributes ⇒ Object
Returns the value of attribute attributes.
10 11 12 |
# File 'lib/urbanairship/devices/devicelist.rb', line 10 def attributes @attributes end |
#audience ⇒ Object
Returns the value of attribute audience.
10 11 12 |
# File 'lib/urbanairship/devices/devicelist.rb', line 10 def audience @audience end |
#client=(value) ⇒ Object (writeonly)
Sets the attribute client
9 10 11 |
# File 'lib/urbanairship/devices/devicelist.rb', line 9 def client=(value) @client = value end |
Instance Method Details
#lookup(uuid: required('uuid')) ⇒ Object
17 18 19 20 21 22 23 24 |
# File 'lib/urbanairship/devices/devicelist.rb', line 17 def lookup(uuid: required('uuid')) response = @client.send_request( method: 'GET', path: channel_path(uuid) ) logger.info("Retrieved channel information for #{uuid}") response['body']['channel'] end |
#payload ⇒ Object
26 27 28 29 30 31 32 33 |
# File 'lib/urbanairship/devices/devicelist.rb', line 26 def payload { 'audience': audience, 'attributes': [ attributes ] } end |
#set_attributes ⇒ Object
35 36 37 38 39 40 41 42 43 |
# File 'lib/urbanairship/devices/devicelist.rb', line 35 def set_attributes response = @client.send_request( method: 'POST', body: JSON.dump(payload), path: channel_path('attributes'), content_type: 'application/json' ) response end |