Class: SignalWire::Relay::TranscribeEvent

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

Overview

calling.call.transcribe

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: '', recording_id: '', duration: 0.0, size: 0, **base) ⇒ TranscribeEvent

Returns a new instance of TranscribeEvent.



474
475
476
477
478
479
480
481
482
483
# File 'lib/signalwire/relay/relay_event.rb', line 474

def initialize(control_id: '', state: '', url: '', recording_id: '',
               duration: 0.0, size: 0, **base)
  super(**base)
  @control_id   = control_id
  @state        = state
  @url          = url
  @recording_id = recording_id
  @duration     = duration
  @size         = size
end

Instance Attribute Details

#control_idObject (readonly)

Returns the value of attribute control_id.



457
458
459
# File 'lib/signalwire/relay/relay_event.rb', line 457

def control_id
  @control_id
end

#durationObject (readonly)

Returns the value of attribute duration.



457
458
459
# File 'lib/signalwire/relay/relay_event.rb', line 457

def duration
  @duration
end

#recording_idObject (readonly)

Returns the value of attribute recording_id.



457
458
459
# File 'lib/signalwire/relay/relay_event.rb', line 457

def recording_id
  @recording_id
end

#sizeObject (readonly)

Returns the value of attribute size.



457
458
459
# File 'lib/signalwire/relay/relay_event.rb', line 457

def size
  @size
end

#stateObject (readonly)

Returns the value of attribute state.



457
458
459
# File 'lib/signalwire/relay/relay_event.rb', line 457

def state
  @state
end

#urlObject (readonly)

Returns the value of attribute url.



457
458
459
# File 'lib/signalwire/relay/relay_event.rb', line 457

def url
  @url
end

Class Method Details

.from_payload(payload) ⇒ Object



459
460
461
462
463
464
465
466
467
468
469
470
471
472
# File 'lib/signalwire/relay/relay_event.rb', line 459

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'] || '',
    recording_id: p['recording_id'] || '',
    duration:     p['duration'] || 0.0,
    size:         p['size'] || 0
  )
end