Sha256: e47095909b34d38d23e0bc3aa1f2bfdbf2d16bca4bad0b63773023cada9db187

Contents?: true

Size: 883 Bytes

Versions: 8

Compression:

Stored size: 883 Bytes

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),
          url: CHANNEL_URL + 'uninstall/',
          content_type: 'application/json'
        )

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

Version data entries

8 entries across 8 versions & 1 rubygems

Version Path
urbanairship-4.0.0 lib/urbanairship/devices/channel_uninstall.rb
urbanairship-3.2.4 lib/urbanairship/devices/channel_uninstall.rb
urbanairship-3.2.3 lib/urbanairship/devices/channel_uninstall.rb
urbanairship-3.2.2 lib/urbanairship/devices/channel_uninstall.rb
urbanairship-3.2.1 lib/urbanairship/devices/channel_uninstall.rb
urbanairship-3.2.0 lib/urbanairship/devices/channel_uninstall.rb
urbanairship-3.1.1 lib/urbanairship/devices/channel_uninstall.rb
urbanairship-3.1.0 lib/urbanairship/devices/channel_uninstall.rb