Class: SignalWire::Relay::RelayEvent
- Inherits:
-
Object
- Object
- SignalWire::Relay::RelayEvent
- Defined in:
- lib/signalwire/relay/relay_event.rb
Overview
Base event wrapper for raw signalwire.event payloads. Subclasses provide typed accessors for specific event types.
Direct Known Subclasses
CallReceiveEvent, CallStateEvent, CallingErrorEvent, CollectEvent, ConferenceEvent, ConnectEvent, DenoiseEvent, DetectEvent, DialEvent, EchoEvent, FaxEvent, HoldEvent, MessageReceiveEvent, MessageStateEvent, PayEvent, PlayEvent, QueueEvent, RecordEvent, ReferEvent, SendDigitsEvent, StreamEvent, TapEvent, TranscribeEvent
Instance Attribute Summary collapse
-
#call_id ⇒ Object
readonly
Returns the value of attribute call_id.
-
#event_type ⇒ Object
readonly
Returns the value of attribute event_type.
-
#params ⇒ Object
readonly
Returns the value of attribute params.
-
#timestamp ⇒ Object
readonly
Returns the value of attribute timestamp.
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(event_type:, params: {}, call_id: '', timestamp: 0.0) ⇒ RelayEvent
constructor
A new instance of RelayEvent.
Constructor Details
#initialize(event_type:, params: {}, call_id: '', timestamp: 0.0) ⇒ RelayEvent
Returns a new instance of RelayEvent.
10 11 12 13 14 15 |
# File 'lib/signalwire/relay/relay_event.rb', line 10 def initialize(event_type:, params: {}, call_id: '', timestamp: 0.0) @event_type = event_type @params = params @call_id = call_id @timestamp = end |
Instance Attribute Details
#call_id ⇒ Object (readonly)
Returns the value of attribute call_id.
8 9 10 |
# File 'lib/signalwire/relay/relay_event.rb', line 8 def call_id @call_id end |
#event_type ⇒ Object (readonly)
Returns the value of attribute event_type.
8 9 10 |
# File 'lib/signalwire/relay/relay_event.rb', line 8 def event_type @event_type end |
#params ⇒ Object (readonly)
Returns the value of attribute params.
8 9 10 |
# File 'lib/signalwire/relay/relay_event.rb', line 8 def params @params end |
#timestamp ⇒ Object (readonly)
Returns the value of attribute timestamp.
8 9 10 |
# File 'lib/signalwire/relay/relay_event.rb', line 8 def @timestamp end |
Class Method Details
.from_payload(payload) ⇒ Object
17 18 19 20 21 22 23 24 25 26 |
# File 'lib/signalwire/relay/relay_event.rb', line 17 def self.from_payload(payload) et = payload['event_type'] || '' p = payload['params'] || {} new( event_type: et, params: p, call_id: p['call_id'] || '', timestamp: p['timestamp'] || 0.0 ) end |