Class: Twilio::Rails::Phone::Tree
- Inherits:
-
Object
- Object
- Twilio::Rails::Phone::Tree
- Defined in:
- lib/twilio/rails/phone/tree.rb
Overview
Implementation class for a phone tree. See BaseTree for detailed documentation.
Defined Under Namespace
Classes: After, Gather, Message, MessageSet, Prompt
Instance Attribute Summary collapse
-
#config ⇒ Object
readonly
Returns the value of attribute config.
-
#finished_call ⇒ Object
Returns the value of attribute finished_call.
-
#greeting ⇒ Object
Returns the value of attribute greeting.
-
#name ⇒ Object
readonly
Returns the value of attribute name.
-
#prompts ⇒ Object
readonly
Returns the value of attribute prompts.
-
#unanswered_call ⇒ Object
Returns the value of attribute unanswered_call.
Instance Method Summary collapse
-
#inbound_url ⇒ String
The fully qualified URL for the tree used by Twilio to be configured in the dashboard.
-
#initialize(tree_name) ⇒ Tree
constructor
A new instance of Tree.
-
#outbound_url ⇒ String
The fully qualified URL for the tree used by Twilio to make outbound calls.
Constructor Details
#initialize(tree_name) ⇒ Tree
Returns a new instance of Tree.
10 11 12 13 14 15 16 17 18 19 20 21 |
# File 'lib/twilio/rails/phone/tree.rb', line 10 def initialize(tree_name) @name = tree_name.to_s raise Twilio::Rails::Phone::InvalidTreeError, "tree name cannot be blank" unless name.present? @prompts = {}.with_indifferent_access @config = {}.with_indifferent_access # defaults @config[:voice] = "male" @config[:final_timeout_message] = "Goodbye." @config[:final_timeout_attempts] = 3 end |
Instance Attribute Details
#config ⇒ Object (readonly)
Returns the value of attribute config.
7 8 9 |
# File 'lib/twilio/rails/phone/tree.rb', line 7 def config @config end |
#finished_call ⇒ Object
Returns the value of attribute finished_call.
8 9 10 |
# File 'lib/twilio/rails/phone/tree.rb', line 8 def finished_call @finished_call end |
#greeting ⇒ Object
Returns the value of attribute greeting.
8 9 10 |
# File 'lib/twilio/rails/phone/tree.rb', line 8 def greeting @greeting end |
#name ⇒ Object (readonly)
Returns the value of attribute name.
7 8 9 |
# File 'lib/twilio/rails/phone/tree.rb', line 7 def name @name end |
#prompts ⇒ Object (readonly)
Returns the value of attribute prompts.
7 8 9 |
# File 'lib/twilio/rails/phone/tree.rb', line 7 def prompts @prompts end |
#unanswered_call ⇒ Object
Returns the value of attribute unanswered_call.
8 9 10 |
# File 'lib/twilio/rails/phone/tree.rb', line 8 def unanswered_call @unanswered_call end |
Instance Method Details
#inbound_url ⇒ String
The fully qualified URL for the tree used by Twilio to be configured in the dashboard.
33 34 35 |
# File 'lib/twilio/rails/phone/tree.rb', line 33 def inbound_url "#{ ::Twilio::Rails.config.host }#{ ::Twilio::Rails::Engine.routes.url_helpers.phone_inbound_path(tree_name: name, format: :xml) }" end |
#outbound_url ⇒ String
The fully qualified URL for the tree used by Twilio to make outbound calls.
26 27 28 |
# File 'lib/twilio/rails/phone/tree.rb', line 26 def outbound_url "#{ ::Twilio::Rails.config.host }#{ ::Twilio::Rails::Engine.routes.url_helpers.phone_outbound_path(tree_name: name, format: :xml) }" end |