Class: Urbanairship::Devices::OpenChannelUninstall

Inherits:
Object
  • Object
show all
Includes:
Common, Loggable
Defined in:
lib/urbanairship/devices/channel_uninstall.rb

Constant Summary

Constants included from Common

Common::CONTENT_TYPE

Instance Attribute Summary collapse

Instance Method Summary collapse

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')) ⇒ OpenChannelUninstall

Returns a new instance of OpenChannelUninstall.



41
42
43
# File 'lib/urbanairship/devices/channel_uninstall.rb', line 41

def initialize(client: required('client'))
  @client = client
end

Instance Attribute Details

#clientObject (readonly)

Returns the value of attribute client.



39
40
41
# File 'lib/urbanairship/devices/channel_uninstall.rb', line 39

def client
  @client
end

Instance Method Details

#uninstall(address: required('address'), open_platform: required('open_platform')) ⇒ Object



45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
# File 'lib/urbanairship/devices/channel_uninstall.rb', line 45

def uninstall(address: required('address'),
              open_platform: required('open_platform'))

  body = {
    address: address,
    open_platform_name: open_platform
  }

  response = @client.send_request(
    method: 'POST',
    body: JSON.dump(body),
    path: open_channel_path('uninstall/'),
    content_type: 'application/json'
  )

  logger.info { "Successfully uninstalled open channel with address: #{address}"}
  response
end