Class: Spacebunny::LiveStream::Message
- Inherits:
-
Object
- Object
- Spacebunny::LiveStream::Message
- Defined in:
- lib/spacebunny/live_stream/message.rb
Instance Attribute Summary collapse
-
#channel_name ⇒ Object
readonly
Returns the value of attribute channel_name.
-
#delivery_info ⇒ Object
readonly
Returns the value of attribute delivery_info.
-
#live_stream ⇒ Object
readonly
Returns the value of attribute live_stream.
-
#metadata ⇒ Object
readonly
Returns the value of attribute metadata.
-
#payload ⇒ Object
readonly
Returns the value of attribute payload.
-
#sender_id ⇒ Object
readonly
Returns the value of attribute sender_id.
Instance Method Summary collapse
- #ack(options = {}) ⇒ Object
- #from_api? ⇒ Boolean
-
#initialize(live_stream, options, delivery_info, metadata, payload) ⇒ Message
constructor
A new instance of Message.
- #nack(options = {}) ⇒ Object
Constructor Details
#initialize(live_stream, options, delivery_info, metadata, payload) ⇒ Message
Returns a new instance of Message.
6 7 8 9 10 11 12 13 14 |
# File 'lib/spacebunny/live_stream/message.rb', line 6 def initialize(live_stream, , delivery_info, , payload) @live_stream = live_stream @options = @delivery_info = delivery_info @metadata = @payload = payload set_sender_id_and_channel end |
Instance Attribute Details
#channel_name ⇒ Object (readonly)
Returns the value of attribute channel_name.
4 5 6 |
# File 'lib/spacebunny/live_stream/message.rb', line 4 def channel_name @channel_name end |
#delivery_info ⇒ Object (readonly)
Returns the value of attribute delivery_info.
4 5 6 |
# File 'lib/spacebunny/live_stream/message.rb', line 4 def delivery_info @delivery_info end |
#live_stream ⇒ Object (readonly)
Returns the value of attribute live_stream.
4 5 6 |
# File 'lib/spacebunny/live_stream/message.rb', line 4 def live_stream @live_stream end |
#metadata ⇒ Object (readonly)
Returns the value of attribute metadata.
4 5 6 |
# File 'lib/spacebunny/live_stream/message.rb', line 4 def @metadata end |
#payload ⇒ Object (readonly)
Returns the value of attribute payload.
4 5 6 |
# File 'lib/spacebunny/live_stream/message.rb', line 4 def payload @payload end |
#sender_id ⇒ Object (readonly)
Returns the value of attribute sender_id.
4 5 6 |
# File 'lib/spacebunny/live_stream/message.rb', line 4 def sender_id @sender_id end |
Instance Method Details
#ack(options = {}) ⇒ Object
16 17 18 19 |
# File 'lib/spacebunny/live_stream/message.rb', line 16 def ack( = {}) multiple = .fetch :multiple, false @live_stream.acknowledge @delivery_info.delivery_tag, multiple end |
#from_api? ⇒ Boolean
27 28 29 |
# File 'lib/spacebunny/live_stream/message.rb', line 27 def from_api? !@metadata[:headers].nil? && @metadata[:headers]['x-from-sb-api'] end |
#nack(options = {}) ⇒ Object
21 22 23 24 25 |
# File 'lib/spacebunny/live_stream/message.rb', line 21 def nack( = {}) multiple = .fetch :multiple, false requeue = .fetch :requeue, false @live_stream.nack @delivery_info.delivery_tag, multiple, requeue end |