Class: SignalWire::Relay::PayEvent

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

Overview

calling.call.pay

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) ⇒ PayEvent

Returns a new instance of PayEvent.



397
398
399
400
401
# File 'lib/signalwire/relay/relay_event.rb', line 397

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.



384
385
386
# File 'lib/signalwire/relay/relay_event.rb', line 384

def control_id
  @control_id
end

#stateObject (readonly)

Returns the value of attribute state.



384
385
386
# File 'lib/signalwire/relay/relay_event.rb', line 384

def state
  @state
end

Class Method Details

.from_payload(payload) ⇒ Object



386
387
388
389
390
391
392
393
394
395
# File 'lib/signalwire/relay/relay_event.rb', line 386

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