Class: SignalWire::Relay::CallStateEvent
- Inherits:
-
RelayEvent
- Object
- RelayEvent
- SignalWire::Relay::CallStateEvent
- Defined in:
- lib/signalwire/relay/relay_event.rb
Overview
calling.call.state
Instance Attribute Summary collapse
-
#call_state ⇒ Object
readonly
Returns the value of attribute call_state.
-
#device ⇒ Object
readonly
Returns the value of attribute device.
-
#direction ⇒ Object
readonly
Returns the value of attribute direction.
-
#end_reason ⇒ Object
readonly
Returns the value of attribute end_reason.
Attributes inherited from RelayEvent
#call_id, #event_type, #params, #timestamp
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(call_state: '', end_reason: '', direction: '', device: {}, **base) ⇒ CallStateEvent
constructor
A new instance of CallStateEvent.
Constructor Details
#initialize(call_state: '', end_reason: '', direction: '', device: {}, **base) ⇒ CallStateEvent
Returns a new instance of CallStateEvent.
46 47 48 49 50 51 52 |
# File 'lib/signalwire/relay/relay_event.rb', line 46 def initialize(call_state: '', end_reason: '', direction: '', device: {}, **base) super(**base) @call_state = call_state @end_reason = end_reason @direction = direction @device = device end |
Instance Attribute Details
#call_state ⇒ Object (readonly)
Returns the value of attribute call_state.
31 32 33 |
# File 'lib/signalwire/relay/relay_event.rb', line 31 def call_state @call_state end |
#device ⇒ Object (readonly)
Returns the value of attribute device.
31 32 33 |
# File 'lib/signalwire/relay/relay_event.rb', line 31 def device @device end |
#direction ⇒ Object (readonly)
Returns the value of attribute direction.
31 32 33 |
# File 'lib/signalwire/relay/relay_event.rb', line 31 def direction @direction end |
#end_reason ⇒ Object (readonly)
Returns the value of attribute end_reason.
31 32 33 |
# File 'lib/signalwire/relay/relay_event.rb', line 31 def end_reason @end_reason end |
Class Method Details
.from_payload(payload) ⇒ Object
33 34 35 36 37 38 39 40 41 42 43 44 |
# File 'lib/signalwire/relay/relay_event.rb', line 33 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., call_state: p['call_state'] || '', end_reason: p['end_reason'] || '', direction: p['direction'] || '', device: p['device'] || {} ) end |