Sha256: 7918df37577d27d57a3591c78ba58aa2c8b0162b4c710fa6c91f3d7df154e52e

Contents?: true

Size: 1.29 KB

Versions: 4

Compression:

Stored size: 1.29 KB

Contents

require 'ably/realtime/push/admin'

module Ably
  module Realtime
    # Class providing push notification functionality
    class Push
      # @private
      attr_reader :client

      def initialize(client)
        @client = client
      end

      # A {Ably::Realtime::Push::Admin} object.
      #
      # @spec RSH1
      #
      # @return [Ably::Realtime::Push::Admin]
      #
      def admin
        @admin ||= Admin.new(self)
      end

      # Activates the device for push notifications with FCM or APNS, obtaining a unique identifier from them.
      # Subsequently registers the device with Ably and stores the deviceIdentityToken in local storage.
      #
      # @spec RSH2a
      #
      # @note This is unsupported in the Ruby library
      #
      def activate(*arg)
        raise_unsupported
      end

      # Deactivates the device from receiving push notifications with Ably and FCM or APNS.
      #
      # @spec RSH2b
      #
      # @note This is unsupported in the Ruby library
      #
      def deactivate(*arg)
        raise_unsupported
      end

      private

      def raise_unsupported
        raise Ably::Exceptions::PushNotificationsNotSupported, 'This device does not support receiving or subscribing to push notifications. All PushChannel methods are unavailable'
      end
    end
  end
end

Version data entries

4 entries across 4 versions & 2 rubygems

Version Path
ably-rest-1.2.4 lib/submodules/ably-ruby/lib/ably/realtime/push.rb
ably-1.2.4 lib/ably/realtime/push.rb
ably-rest-1.2.3 lib/submodules/ably-ruby/lib/ably/realtime/push.rb
ably-1.2.3 lib/ably/realtime/push.rb