class Signalwire::Relay::Calling::Tap

Attributes

device[RW]

Public Class Methods

new(call:, tap:, device:) click to toggle source
Calls superclass method
# File lib/signalwire/relay/calling/component/tap.rb, line 7
def initialize(call:, tap:, device:)
  super(call: call)
  @tap = tap
  @device = device
end

Public Instance Methods

broadcast_event(event) click to toggle source
# File lib/signalwire/relay/calling/component/tap.rb, line 56
def broadcast_event(event)
  @call.broadcast "tap_#{@state}".to_sym, event
  @call.broadcast :tap_state_change, event
end
event_type() click to toggle source
# File lib/signalwire/relay/calling/component/tap.rb, line 17
def event_type
  Relay::CallNotification::TAP
end
inner_params() click to toggle source
# File lib/signalwire/relay/calling/component/tap.rb, line 27
def inner_params
  {
    node_id: @call.node_id,
    call_id: @call.id,
    control_id: control_id,
    tap: @tap,
    device: @device
  }
end
method() click to toggle source
# File lib/signalwire/relay/calling/component/tap.rb, line 13
def method
  Relay::ComponentMethod::TAP
end
notification_handler(event) click to toggle source
# File lib/signalwire/relay/calling/component/tap.rb, line 41
def notification_handler(event)
  @state = event.call_params[:state]
  @device = event.call_params[:device]
  @tap = event.call_params[:tap]

  @completed = @state == Relay::CallTapState::FINISHED
  if @completed
    @successful = true
    @event = event
  end

  broadcast_event(event)
  check_for_waiting_events
end
source_device() click to toggle source
# File lib/signalwire/relay/calling/component/tap.rb, line 21
def source_device
  return unless @execute_result

  @execute_result.dig(:result, :result, :source_device)
end
tap_media() click to toggle source
# File lib/signalwire/relay/calling/component/tap.rb, line 37
def tap_media
  @tap
end