Class: SignalWire::Relay::MessageReceiveEvent
- Inherits:
-
RelayEvent
- Object
- RelayEvent
- SignalWire::Relay::MessageReceiveEvent
- Defined in:
- lib/signalwire/relay/relay_event.rb
Overview
messaging.receive
Instance Attribute Summary collapse
-
#body ⇒ Object
readonly
Returns the value of attribute body.
-
#context ⇒ Object
readonly
Returns the value of attribute context.
-
#direction ⇒ Object
readonly
Returns the value of attribute direction.
-
#from_number ⇒ Object
readonly
Returns the value of attribute from_number.
-
#media ⇒ Object
readonly
Returns the value of attribute media.
-
#message_id ⇒ Object
readonly
Returns the value of attribute message_id.
-
#message_state ⇒ Object
readonly
Returns the value of attribute message_state.
-
#segments ⇒ Object
readonly
Returns the value of attribute segments.
-
#tags ⇒ Object
readonly
Returns the value of attribute tags.
-
#to_number ⇒ Object
readonly
Returns the value of attribute to_number.
Attributes inherited from RelayEvent
#call_id, #event_type, #params, #timestamp
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(message_id: '', context: '', direction: '', from_number: '', to_number: '', body: '', media: [], segments: 0, message_state: '', tags: [], **base) ⇒ MessageReceiveEvent
constructor
A new instance of MessageReceiveEvent.
Constructor Details
#initialize(message_id: '', context: '', direction: '', from_number: '', to_number: '', body: '', media: [], segments: 0, message_state: '', tags: [], **base) ⇒ MessageReceiveEvent
Returns a new instance of MessageReceiveEvent.
576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 |
# File 'lib/signalwire/relay/relay_event.rb', line 576 def initialize(message_id: '', context: '', direction: '', from_number: '', to_number: '', body: '', media: [], segments: 0, message_state: '', tags: [], **base) super(**base) @message_id = @context = context @direction = direction @from_number = from_number @to_number = to_number @body = body @media = media @segments = segments @message_state = @tags = end |
Instance Attribute Details
#body ⇒ Object (readonly)
Returns the value of attribute body.
554 555 556 |
# File 'lib/signalwire/relay/relay_event.rb', line 554 def body @body end |
#context ⇒ Object (readonly)
Returns the value of attribute context.
554 555 556 |
# File 'lib/signalwire/relay/relay_event.rb', line 554 def context @context end |
#direction ⇒ Object (readonly)
Returns the value of attribute direction.
554 555 556 |
# File 'lib/signalwire/relay/relay_event.rb', line 554 def direction @direction end |
#from_number ⇒ Object (readonly)
Returns the value of attribute from_number.
554 555 556 |
# File 'lib/signalwire/relay/relay_event.rb', line 554 def from_number @from_number end |
#media ⇒ Object (readonly)
Returns the value of attribute media.
554 555 556 |
# File 'lib/signalwire/relay/relay_event.rb', line 554 def media @media end |
#message_id ⇒ Object (readonly)
Returns the value of attribute message_id.
554 555 556 |
# File 'lib/signalwire/relay/relay_event.rb', line 554 def @message_id end |
#message_state ⇒ Object (readonly)
Returns the value of attribute message_state.
554 555 556 |
# File 'lib/signalwire/relay/relay_event.rb', line 554 def @message_state end |
#segments ⇒ Object (readonly)
Returns the value of attribute segments.
554 555 556 |
# File 'lib/signalwire/relay/relay_event.rb', line 554 def segments @segments end |
#tags ⇒ Object (readonly)
Returns the value of attribute tags.
554 555 556 |
# File 'lib/signalwire/relay/relay_event.rb', line 554 def @tags end |
#to_number ⇒ Object (readonly)
Returns the value of attribute to_number.
554 555 556 |
# File 'lib/signalwire/relay/relay_event.rb', line 554 def to_number @to_number end |
Class Method Details
.from_payload(payload) ⇒ Object
557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 |
# File 'lib/signalwire/relay/relay_event.rb', line 557 def self.from_payload(payload) base = RelayEvent.from_payload(payload) p = base.params new( event_type: base.event_type, params: base.params, call_id: base.call_id, timestamp: base., message_id: p['message_id'] || '', context: p['context'] || '', direction: p['direction'] || '', from_number: p['from_number'] || '', to_number: p['to_number'] || '', body: p['body'] || '', media: p['media'] || [], segments: p['segments'] || 0, message_state: p['message_state'] || '', tags: p['tags'] || [] ) end |