Class: Pubnub::Envelope
Overview
Every message from server is formatted into easy to use Envelope object
Direct Known Subclasses
Instance Attribute Summary (collapse)
-
- (Object) action
Returns the value of attribute action.
-
- (Object) channel
Returns the value of attribute channel.
-
- (Object) error
Returns the value of attribute error.
-
- (Object) first
Returns the value of attribute first.
-
- (Object) group
Returns the value of attribute group.
-
- (Object) history_end
history specific.
-
- (Object) history_start
history specific.
-
- (Object) last
Returns the value of attribute last.
-
- (Object) message
(also: #msg)
Returns the value of attribute message.
-
- (Object) object
Returns the value of attribute object.
-
- (Object) parsed_response
Returns the value of attribute parsed_response.
-
- (Object) payload
Returns the value of attribute payload.
-
- (Object) response
Returns the value of attribute response.
-
- (Object) response_message
Returns the value of attribute response_message.
-
- (Object) service
Returns the value of attribute service.
-
- (Object) status
(also: #status_code)
Returns the value of attribute status.
-
- (Object) timetoken
Returns the value of attribute timetoken.
-
- (Object) timetoken_update
subscribe, presence specific.
-
- (Object) uuid
Returns the value of attribute uuid.
-
- (Object) uuids
Returns the value of attribute uuids.
-
- (Object) wildcard_channel
Returns the value of attribute wildcard_channel.
Instance Method Summary (collapse)
- - (Boolean) error?
- - (Boolean) first?
-
- (Envelope) initialize(parameters)
constructor
A new instance of Envelope.
- - (Boolean) last?
- - (Object) mark_as_timetoken
Constructor Details
- (Envelope) initialize(parameters)
Returns a new instance of Envelope
20 21 22 23 24 |
# File 'lib/pubnub/envelope.rb', line 20 def initialize(parameters) parameters.each do |parameter, value| instance_variable_set("@#{parameter}", value) end end |
Instance Attribute Details
- (Object) action
Returns the value of attribute action
7 8 9 |
# File 'lib/pubnub/envelope.rb', line 7 def action @action end |
- (Object) channel
Returns the value of attribute channel
6 7 8 |
# File 'lib/pubnub/envelope.rb', line 6 def channel @channel end |
- (Object) error
Returns the value of attribute error
7 8 9 |
# File 'lib/pubnub/envelope.rb', line 7 def error @error end |
- (Object) first
Returns the value of attribute first
5 6 7 |
# File 'lib/pubnub/envelope.rb', line 5 def first @first end |
- (Object) group
Returns the value of attribute group
8 9 10 |
# File 'lib/pubnub/envelope.rb', line 8 def group @group end |
- (Object) history_end
history specific
14 15 16 |
# File 'lib/pubnub/envelope.rb', line 14 def history_end @history_end end |
- (Object) history_start
history specific
14 15 16 |
# File 'lib/pubnub/envelope.rb', line 14 def history_start @history_start end |
- (Object) last
Returns the value of attribute last
5 6 7 |
# File 'lib/pubnub/envelope.rb', line 5 def last @last end |
- (Object) message Also known as: msg
Returns the value of attribute message
6 7 8 |
# File 'lib/pubnub/envelope.rb', line 6 def @message end |
- (Object) object
Returns the value of attribute object
5 6 7 |
# File 'lib/pubnub/envelope.rb', line 5 def object @object end |
- (Object) parsed_response
Returns the value of attribute parsed_response
5 6 7 |
# File 'lib/pubnub/envelope.rb', line 5 def parsed_response @parsed_response end |
- (Object) payload
Returns the value of attribute payload
6 7 8 |
# File 'lib/pubnub/envelope.rb', line 6 def payload @payload end |
- (Object) response
Returns the value of attribute response
5 6 7 |
# File 'lib/pubnub/envelope.rb', line 5 def response @response end |
- (Object) response_message
Returns the value of attribute response_message
7 8 9 |
# File 'lib/pubnub/envelope.rb', line 7 def @response_message end |
- (Object) service
Returns the value of attribute service
6 7 8 |
# File 'lib/pubnub/envelope.rb', line 6 def service @service end |
- (Object) status Also known as: status_code
Returns the value of attribute status
5 6 7 |
# File 'lib/pubnub/envelope.rb', line 5 def status @status end |
- (Object) timetoken
Returns the value of attribute timetoken
6 7 8 |
# File 'lib/pubnub/envelope.rb', line 6 def timetoken @timetoken end |
- (Object) timetoken_update
subscribe, presence specific
11 12 13 |
# File 'lib/pubnub/envelope.rb', line 11 def timetoken_update @timetoken_update end |
- (Object) uuid
Returns the value of attribute uuid
7 8 9 |
# File 'lib/pubnub/envelope.rb', line 7 def uuid @uuid end |
- (Object) uuids
Returns the value of attribute uuids
7 8 9 |
# File 'lib/pubnub/envelope.rb', line 7 def uuids @uuids end |
- (Object) wildcard_channel
Returns the value of attribute wildcard_channel
8 9 10 |
# File 'lib/pubnub/envelope.rb', line 8 def wildcard_channel @wildcard_channel end |
Instance Method Details
- (Boolean) error?
37 38 39 |
# File 'lib/pubnub/envelope.rb', line 37 def error? error ? true : false end |
- (Boolean) first?
45 46 47 |
# File 'lib/pubnub/envelope.rb', line 45 def first? first end |
- (Boolean) last?
41 42 43 |
# File 'lib/pubnub/envelope.rb', line 41 def last? last end |
- (Object) mark_as_timetoken
26 27 28 29 30 31 32 33 34 35 |
# File 'lib/pubnub/envelope.rb', line 26 def mark_as_timetoken if (@parsed_response[0].empty?) && (@parsed_response[1].size == 17) @timetoken_update = true else @timetoken_update = false end rescue @timetoken_update = false end |