Class: Ably::Rest::Models::Message
- Inherits:
-
Object
- Object
- Ably::Rest::Models::Message
- Includes:
- Modules::Conversions
- Defined in:
- lib/ably/rest/models/message.rb
Overview
A Message object encapsulates an individual message published in Ably retrieved via Rest
Instance Method Summary collapse
- #==(other) ⇒ Object
-
#[](key) ⇒ Object
Provide a normal Hash accessor to the underlying raw message object.
-
#client_id ⇒ String
Client ID of the publisher of the message.
-
#data ⇒ Object
Payload.
-
#initialize(message) ⇒ Message
constructor
A new instance of Message.
-
#json ⇒ Hash
Raw message object.
-
#message_id ⇒ String
Unique message ID.
-
#name ⇒ String
Event name.
-
#sender_timestamp ⇒ Time
Timestamp when message was sent.
Constructor Details
#initialize(message) ⇒ Message
Returns a new instance of Message.
6 7 8 |
# File 'lib/ably/rest/models/message.rb', line 6 def initialize() = IdiomaticRubyWrapper(.clone.freeze) end |
Instance Method Details
#==(other) ⇒ Object
59 60 61 62 |
# File 'lib/ably/rest/models/message.rb', line 59 def ==(other) other.kind_of?(Message) && json == other.json end |
#[](key) ⇒ Object
Provide a normal Hash accessor to the underlying raw message object
48 49 50 |
# File 'lib/ably/rest/models/message.rb', line 48 def [](key) json[key] end |
#client_id ⇒ String
Client ID of the publisher of the message
27 28 29 |
# File 'lib/ably/rest/models/message.rb', line 27 def client_id json[:client_id] end |
#data ⇒ Object
Payload
20 21 22 |
# File 'lib/ably/rest/models/message.rb', line 20 def data json[:data] end |
#json ⇒ Hash
Raw message object
55 56 57 |
# File 'lib/ably/rest/models/message.rb', line 55 def json end |
#message_id ⇒ String
Unique message ID
41 42 43 |
# File 'lib/ably/rest/models/message.rb', line 41 def json[:message_id] end |
#name ⇒ String
Event name
13 14 15 |
# File 'lib/ably/rest/models/message.rb', line 13 def name json[:name] end |
#sender_timestamp ⇒ Time
Timestamp when message was sent. This property is populated by the sender.
34 35 36 |
# File 'lib/ably/rest/models/message.rb', line 34 def as_time_from_epoch(json[:timestamp]) if json[:timestamp] end |