Class: TwilioBase::Protocols::Voice::Base
- Inherits:
-
Object
- Object
- TwilioBase::Protocols::Voice::Base
- Includes:
- Helpers::Protocols
- Defined in:
- app/services/twilio_base/protocols/voice/base.rb
Constant Summary collapse
- ANONYMOUS_NUMBER =
'+266696687'- STATUS_CALLBACK_EVENTS =
%w[initiated ringing answered completed].freeze
Instance Method Summary collapse
- #action_url ⇒ Object
- #action_url_attributes ⇒ Object
- #caller_uuid ⇒ Object
- #endpoint ⇒ Object
-
#initialize(params: {}, to:) ⇒ Base
constructor
A new instance of Base.
- #name ⇒ Object
- #routing_attributes ⇒ Object
- #routing_method ⇒ Object
- #status_callback_events ⇒ Object
- #status_callback_url ⇒ Object
- #timeout ⇒ Object
- #wait_url ⇒ Object
Methods included from Helpers::Protocols
Constructor Details
#initialize(params: {}, to:) ⇒ Base
12 13 14 15 16 17 |
# File 'app/services/twilio_base/protocols/voice/base.rb', line 12 def initialize(params: {}, to:) self.params = params self.to = to raise 'To cannot be blank' if to.blank? end |
Instance Method Details
#action_url ⇒ Object
19 20 21 |
# File 'app/services/twilio_base/protocols/voice/base.rb', line 19 def action_url params[:action_url] end |
#action_url_attributes ⇒ Object
23 24 25 |
# File 'app/services/twilio_base/protocols/voice/base.rb', line 23 def action_url_attributes { endpoint: to } end |
#caller_uuid ⇒ Object
27 28 29 |
# File 'app/services/twilio_base/protocols/voice/base.rb', line 27 def caller_uuid mpoa.presence || ANONYMOUS_NUMBER end |
#endpoint ⇒ Object
31 32 33 |
# File 'app/services/twilio_base/protocols/voice/base.rb', line 31 def endpoint to end |
#name ⇒ Object
35 36 37 |
# File 'app/services/twilio_base/protocols/voice/base.rb', line 35 def name :number end |
#routing_attributes ⇒ Object
59 60 61 |
# File 'app/services/twilio_base/protocols/voice/base.rb', line 59 def routing_attributes dial_attribues end |
#routing_method ⇒ Object
55 56 57 |
# File 'app/services/twilio_base/protocols/voice/base.rb', line 55 def routing_method :dial end |
#status_callback_events ⇒ Object
39 40 41 |
# File 'app/services/twilio_base/protocols/voice/base.rb', line 39 def status_callback_events STATUS_CALLBACK_EVENTS.join(' ') end |
#status_callback_url ⇒ Object
43 44 45 |
# File 'app/services/twilio_base/protocols/voice/base.rb', line 43 def status_callback_url params[:status_callback_url] end |
#timeout ⇒ Object
47 48 49 |
# File 'app/services/twilio_base/protocols/voice/base.rb', line 47 def timeout params[:timeout] end |
#wait_url ⇒ Object
51 52 53 |
# File 'app/services/twilio_base/protocols/voice/base.rb', line 51 def wait_url params[:wait_url] end |