class Urbanairship::Devices::ChannelInfo

Attributes

attributes[RW]
audience[RW]
client[W]

Public Class Methods

new(client: required('client')) click to toggle source
# File lib/urbanairship/devices/devicelist.rb, line 13
def initialize(client: required('client'))
  @client = client
end

Public Instance Methods

lookup(uuid: required('uuid')) click to toggle source
# 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() click to toggle source
# File lib/urbanairship/devices/devicelist.rb, line 26
def payload
  {
    'audience': audience,
    'attributes': [
      attributes
    ]
  }
end
set_attributes() click to toggle source
# 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