Class: Ably::Rest::Presence
- Inherits:
-
Object
- Object
- Ably::Rest::Presence
- Includes:
- Modules::Conversions
- Defined in:
- lib/submodules/ably-ruby/lib/ably/rest/presence.rb
Instance Attribute Summary collapse
-
#channel ⇒ Ably::Rest::Channel
readonly
Channel this Presence object is associated with.
-
#client ⇒ Ably::Rest::Client
readonly
Client for this Presence object.
Instance Method Summary collapse
-
#get(options = {}) ⇒ Ably::Models::PaginatedResult<Ably::Models::PresenceMessage>
Obtain the set of members currently present for a channel.
-
#history(options = {}) ⇒ Ably::Models::PaginatedResult<Ably::Models::PresenceMessage>
Return the presence messages history for the channel.
-
#initialize(client, channel) ⇒ Presence
constructor
Initialize a new Presence object.
Constructor Details
#initialize(client, channel) ⇒ Presence
Initialize a new Presence object
19 20 21 22 |
# File 'lib/submodules/ably-ruby/lib/ably/rest/presence.rb', line 19 def initialize(client, channel) @client = client @channel = channel end |
Instance Attribute Details
#channel ⇒ Ably::Rest::Channel (readonly)
Channel this Presence object is associated with
13 14 15 |
# File 'lib/submodules/ably-ruby/lib/ably/rest/presence.rb', line 13 def channel @channel end |
#client ⇒ Ably::Rest::Client (readonly)
Client for this Presence object
9 10 11 |
# File 'lib/submodules/ably-ruby/lib/ably/rest/presence.rb', line 9 def client @client end |
Instance Method Details
#get(options = {}) ⇒ Ably::Models::PaginatedResult<Ably::Models::PresenceMessage>
Obtain the set of members currently present for a channel
33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 |
# File 'lib/submodules/ably-ruby/lib/ably/rest/presence.rb', line 33 def get( = {}) = = { :limit => 100 }.merge() = { coerce_into: 'Ably::Models::PresenceMessage', async_blocking_operations: .delete(:async_blocking_operations), } response = client.get(base_path, ) Ably::Models::PaginatedResult.new(response, base_path, client, ) do || .tap do || end end end |
#history(options = {}) ⇒ Ably::Models::PaginatedResult<Ably::Models::PresenceMessage>
Return the presence messages history for the channel
62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 |
# File 'lib/submodules/ably-ruby/lib/ably/rest/presence.rb', line 62 def history( = {}) url = "#{base_path}/history" = = { :direction => :backwards, :limit => 100 }.merge() [:start, :end].each { |option| [option] = as_since_epoch([option]) if .has_key?(option) } raise ArgumentError, ":end must be equal to or after :start" if [:start] && [:end] && ([:start] > [:end]) = { coerce_into: 'Ably::Models::PresenceMessage', async_blocking_operations: .delete(:async_blocking_operations), } response = client.get(url, ) Ably::Models::PaginatedResult.new(response, url, client, ) do || .tap do || end end end |