Sha256: 283ae883b785aeb5c545af21f6e5db34e5cf3029fb95ecf825afe8eaea8467d4
Contents?: true
Size: 1.6 KB
Versions: 8
Compression:
Stored size: 1.6 KB
Contents
require 'json' require 'urbanairship' module Urbanairship module Devices class ChannelUninstall include Urbanairship::Common include Urbanairship::Loggable attr_reader :client # Initialize a ChannelUninstall Object # # @param [Object] client def initialize(client: required('client')) @client = client end 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 end class OpenChannelUninstall include Urbanairship::Common include Urbanairship::Loggable attr_reader :client def initialize(client: required('client')) @client = client end 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 end end end
Version data entries
8 entries across 8 versions & 1 rubygems