Class: SignalWire::Relay::PlayEvent

Inherits:
RelayEvent show all
Defined in:
lib/signalwire/relay/relay_event.rb

Overview

calling.call.play

Instance Attribute Summary collapse

Attributes inherited from RelayEvent

#call_id, #event_type, #params, #timestamp

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(control_id: '', state: '', **base) ⇒ PlayEvent

Returns a new instance of PlayEvent.



106
107
108
109
110
# File 'lib/signalwire/relay/relay_event.rb', line 106

def initialize(control_id: '', state: '', **base)
  super(**base)
  @control_id = control_id
  @state      = state
end

Instance Attribute Details

#control_idObject (readonly)

Returns the value of attribute control_id.



93
94
95
# File 'lib/signalwire/relay/relay_event.rb', line 93

def control_id
  @control_id
end

#stateObject (readonly)

Returns the value of attribute state.



93
94
95
# File 'lib/signalwire/relay/relay_event.rb', line 93

def state
  @state
end

Class Method Details

.from_payload(payload) ⇒ Object



95
96
97
98
99
100
101
102
103
104
# File 'lib/signalwire/relay/relay_event.rb', line 95

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.timestamp,
    control_id: p['control_id'] || '',
    state:      p['state'] || ''
  )
end