Class: SignalWire::Relay::StreamEvent

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

Overview

calling.call.stream

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: '', url: '', name: '', **base) ⇒ StreamEvent

Returns a new instance of StreamEvent.



279
280
281
282
283
284
285
# File 'lib/signalwire/relay/relay_event.rb', line 279

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

Instance Attribute Details

#control_idObject (readonly)

Returns the value of attribute control_id.



264
265
266
# File 'lib/signalwire/relay/relay_event.rb', line 264

def control_id
  @control_id
end

#nameObject (readonly)

Returns the value of attribute name.



264
265
266
# File 'lib/signalwire/relay/relay_event.rb', line 264

def name
  @name
end

#stateObject (readonly)

Returns the value of attribute state.



264
265
266
# File 'lib/signalwire/relay/relay_event.rb', line 264

def state
  @state
end

#urlObject (readonly)

Returns the value of attribute url.



264
265
266
# File 'lib/signalwire/relay/relay_event.rb', line 264

def url
  @url
end

Class Method Details

.from_payload(payload) ⇒ Object



266
267
268
269
270
271
272
273
274
275
276
277
# File 'lib/signalwire/relay/relay_event.rb', line 266

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'] || '',
    url:        p['url'] || '',
    name:       p['name'] || ''
  )
end