Class: TwilioBase::Routers::Voice::Base

Inherits:
Object
  • Object
show all
Defined in:
app/services/twilio_base/routers/voice/base.rb

Direct Known Subclasses

DirectDial, TaskRouter

Instance Method Summary collapse

Constructor Details

#initialize(protocol:) ⇒ Base

Returns a new instance of Base.



20
21
22
# File 'app/services/twilio_base/routers/voice/base.rb', line 20

def initialize(protocol:)
  self.protocol = protocol
end

Instance Method Details

#routeObject



24
25
26
27
28
29
30
31
32
33
34
35
36
37
# File 'app/services/twilio_base/routers/voice/base.rb', line 24

def route
  yield_response = yield if block_given?

  vr = yield_response || voice_response

  vr.public_send(routing_method, routing_attributes) do |router|
    router.public_send(
      name,
      endpoint,
      status_callback_event: status_callback_events,
      status_callback: status_callback_url
    )
  end.to_s
end