Class: SignalWire::Relay::CollectEvent

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

Overview

calling.call.collect

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: '', result_data: {}, final: nil, **base) ⇒ CollectEvent

Returns a new instance of CollectEvent.



161
162
163
164
165
166
167
# File 'lib/signalwire/relay/relay_event.rb', line 161

def initialize(control_id: '', state: '', result_data: {}, final: nil, **base)
  super(**base)
  @control_id  = control_id
  @state       = state
  @result_data = result_data
  @final       = final
end

Instance Attribute Details

#control_idObject (readonly)

Returns the value of attribute control_id.



146
147
148
# File 'lib/signalwire/relay/relay_event.rb', line 146

def control_id
  @control_id
end

#finalObject (readonly)

Returns the value of attribute final.



146
147
148
# File 'lib/signalwire/relay/relay_event.rb', line 146

def final
  @final
end

#result_dataObject (readonly)

Returns the value of attribute result_data.



146
147
148
# File 'lib/signalwire/relay/relay_event.rb', line 146

def result_data
  @result_data
end

#stateObject (readonly)

Returns the value of attribute state.



146
147
148
# File 'lib/signalwire/relay/relay_event.rb', line 146

def state
  @state
end

Class Method Details

.from_payload(payload) ⇒ Object



148
149
150
151
152
153
154
155
156
157
158
159
# File 'lib/signalwire/relay/relay_event.rb', line 148

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'] || '',
    result_data: p['result'] || {},
    final:       p['final']
  )
end