Class: Pubnub::Envelope
Overview
Every message from server is formatted into easy to use Envelope object
Direct Known Subclasses
Instance Attribute Summary collapse
-
#first ⇒ Object
Ruby specific.
-
#history_end ⇒ Object
Returns the value of attribute history_end.
-
#history_start ⇒ Object
Returns the value of attribute history_start.
-
#id ⇒ Object
Ruby specific.
-
#last ⇒ Object
Ruby specific.
-
#result ⇒ Object
Pubnub Required.
-
#status ⇒ Object
Pubnub Required.
-
#timetoken ⇒ Object
Pubnub Required.
Instance Method Summary collapse
- #error? ⇒ Boolean
-
#first? ⇒ Boolean
:nocov:.
-
#initialize(options) ⇒ Envelope
constructor
A new instance of Envelope.
-
#last? ⇒ Boolean
:nocov:.
- #repeat(client, changes = {}) ⇒ Object
Constructor Details
#initialize(options) ⇒ Envelope
Returns a new instance of Envelope.
12 13 14 15 16 17 18 19 20 |
# File 'lib/pubnub/envelope.rb', line 12 def initialize() @id = UUID.generate # internal usage only @event = [:event] = [:event_options] @status = [:status] @result = [:result] @timetoken = [:timetoken] end |
Instance Attribute Details
#history_end ⇒ Object
Returns the value of attribute history_end.
7 8 9 |
# File 'lib/pubnub/envelope.rb', line 7 def history_end @history_end end |
#history_start ⇒ Object
Returns the value of attribute history_start.
7 8 9 |
# File 'lib/pubnub/envelope.rb', line 7 def history_start @history_start end |
#result ⇒ Object
Pubnub Required
10 11 12 |
# File 'lib/pubnub/envelope.rb', line 10 def result @result end |
#status ⇒ Object
Pubnub Required
10 11 12 |
# File 'lib/pubnub/envelope.rb', line 10 def status @status end |
#timetoken ⇒ Object
Pubnub Required
10 11 12 |
# File 'lib/pubnub/envelope.rb', line 10 def timetoken @timetoken end |
Instance Method Details
#error? ⇒ Boolean
26 27 28 |
# File 'lib/pubnub/envelope.rb', line 26 def error? @status[:error] end |
#first? ⇒ Boolean
:nocov:
37 38 39 |
# File 'lib/pubnub/envelope.rb', line 37 def first? first end |
#last? ⇒ Boolean
:nocov:
31 32 33 |
# File 'lib/pubnub/envelope.rb', line 31 def last? last end |
#repeat(client, changes = {}) ⇒ Object
22 23 24 |
# File 'lib/pubnub/envelope.rb', line 22 def repeat(client, changes = {}) client.send @event, .merge(changes) end |