Class: Ably::Rest::Channel::PushChannel

Inherits:
Object
  • Object
show all
Defined in:
lib/submodules/ably-ruby/lib/ably/rest/channel/push_channel.rb

Overview

A push channel used for push notifications Each PushChannel maps to exactly one Rest Channel

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(channel) ⇒ PushChannel

Returns a new instance of PushChannel.

Raises:

  • (ArgumentError)


12
13
14
15
# File 'lib/submodules/ably-ruby/lib/ably/rest/channel/push_channel.rb', line 12

def initialize(channel)
  raise ArgumentError, "Unsupported channel type '#{channel.class}'" unless channel.kind_of?(Ably::Rest::Channel)
  @channel = channel
end

Instance Attribute Details

#channelAbly::Rest::Channel (readonly)

Returns Underlying channel object.

Returns:



9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
# File 'lib/submodules/ably-ruby/lib/ably/rest/channel/push_channel.rb', line 9

class PushChannel
  attr_reader :channel

  def initialize(channel)
    raise ArgumentError, "Unsupported channel type '#{channel.class}'" unless channel.kind_of?(Ably::Rest::Channel)
    @channel = channel
  end

  def to_s
    "<PushChannel: name=#{channel.name}>"
  end

  # Subscribe local device for push notifications on this channel
  #
  # @note This is unsupported in the Ruby library
  def subscribe_device(*args)
    raise_unsupported
  end

  # Subscribe all devices registered to this client's authenticated client_id for push notifications on this channel
  #
  # @note This is unsupported in the Ruby library
  def subscribe_client_id(*args)
    raise_unsupported
  end

  # Unsubscribe local device for push notifications on this channel
  #
  # @note This is unsupported in the Ruby library
  def unsubscribe_device(*args)
    raise_unsupported
  end

  # Unsubscribe all devices registered to this client's authenticated client_id for push notifications on this channel
  #
  # @note This is unsupported in the Ruby library
  def unsubscribe_client_id(*args)
    raise_unsupported
  end

  # Get list of subscriptions on this channel for this device or authenticate client_id
  #
  # @note This is unsupported in the Ruby library
  def get_subscriptions(*args)
    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

Instance Method Details

#get_subscriptions(*args) ⇒ Object

Note:

This is unsupported in the Ruby library

Get list of subscriptions on this channel for this device or authenticate client_id



52
53
54
# File 'lib/submodules/ably-ruby/lib/ably/rest/channel/push_channel.rb', line 52

def get_subscriptions(*args)
  raise_unsupported
end

#subscribe_client_id(*args) ⇒ Object

Note:

This is unsupported in the Ruby library

Subscribe all devices registered to this client's authenticated client_id for push notifications on this channel



31
32
33
# File 'lib/submodules/ably-ruby/lib/ably/rest/channel/push_channel.rb', line 31

def subscribe_client_id(*args)
  raise_unsupported
end

#subscribe_device(*args) ⇒ Object

Note:

This is unsupported in the Ruby library

Subscribe local device for push notifications on this channel



24
25
26
# File 'lib/submodules/ably-ruby/lib/ably/rest/channel/push_channel.rb', line 24

def subscribe_device(*args)
  raise_unsupported
end

#to_sObject



17
18
19
# File 'lib/submodules/ably-ruby/lib/ably/rest/channel/push_channel.rb', line 17

def to_s
  "<PushChannel: name=#{channel.name}>"
end

#unsubscribe_client_id(*args) ⇒ Object

Note:

This is unsupported in the Ruby library

Unsubscribe all devices registered to this client's authenticated client_id for push notifications on this channel



45
46
47
# File 'lib/submodules/ably-ruby/lib/ably/rest/channel/push_channel.rb', line 45

def unsubscribe_client_id(*args)
  raise_unsupported
end

#unsubscribe_device(*args) ⇒ Object

Note:

This is unsupported in the Ruby library

Unsubscribe local device for push notifications on this channel



38
39
40
# File 'lib/submodules/ably-ruby/lib/ably/rest/channel/push_channel.rb', line 38

def unsubscribe_device(*args)
  raise_unsupported
end