class Urbanairship::Devices::ChannelUninstall

Attributes

client[R]

Public Class Methods

new(client: required('client')) click to toggle source

Initialize a ChannelUninstall Object

@param [Object] client

# File lib/urbanairship/devices/channel_uninstall.rb, line 14
def initialize(client: required('client'))
  @client = client
end

Public Instance Methods

uninstall(channels: required('channels')) click to toggle source
# File lib/urbanairship/devices/channel_uninstall.rb, line 18
def uninstall(channels: required('channels'))
  chan_num = channels.length
  fail ArgumentError,
       'Maximum of 200 channel uninstalls exceeded.' if chan_num > 200

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

  logger.info { "Successfully uninstalled #{chan_num} channels." }
  response
end