Class: SignalWire::Relay::TapEvent

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

Overview

calling.call.tap

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: '', tap: {}, device: {}, **base) ⇒ TapEvent

Returns a new instance of TapEvent.



253
254
255
256
257
258
259
# File 'lib/signalwire/relay/relay_event.rb', line 253

def initialize(control_id: '', state: '', tap: {}, device: {}, **base)
  super(**base)
  @control_id = control_id
  @state      = state
  @tap        = tap
  @device     = device
end

Instance Attribute Details

#control_idObject (readonly)

Returns the value of attribute control_id.



238
239
240
# File 'lib/signalwire/relay/relay_event.rb', line 238

def control_id
  @control_id
end

#deviceObject (readonly)

Returns the value of attribute device.



238
239
240
# File 'lib/signalwire/relay/relay_event.rb', line 238

def device
  @device
end

#stateObject (readonly)

Returns the value of attribute state.



238
239
240
# File 'lib/signalwire/relay/relay_event.rb', line 238

def state
  @state
end

#tapObject (readonly)

Returns the value of attribute tap.



238
239
240
# File 'lib/signalwire/relay/relay_event.rb', line 238

def tap
  @tap
end

Class Method Details

.from_payload(payload) ⇒ Object



240
241
242
243
244
245
246
247
248
249
250
251
# File 'lib/signalwire/relay/relay_event.rb', line 240

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'] || '',
    tap:        p['tap'] || {},
    device:     p['device'] || {}
  )
end