Class: TwilioWithThinq::TwilioWrapper
- Inherits:
-
Object
- Object
- TwilioWithThinq::TwilioWrapper
- Defined in:
- lib/twilio_with_thinq.rb
Overview
The main twilio wrapper class that inegrates thinQ.
Constant Summary collapse
- TWIML_RESOURCE_URL =
"http://cris.viralearnings.com/twiml/get_response"
Instance Attribute Summary collapse
-
#callback_details ⇒ Object
Returns the value of attribute callback_details.
-
#callback_type ⇒ Object
Returns the value of attribute callback_type.
-
#client ⇒ Object
Returns the value of attribute client.
-
#customer_number ⇒ Object
Returns the value of attribute customer_number.
-
#twilio_account_sid ⇒ Object
Returns the value of attribute twilio_account_sid.
-
#twilio_account_token ⇒ Object
Returns the value of attribute twilio_account_token.
-
#twilio_phone_number ⇒ Object
Returns the value of attribute twilio_phone_number.
Instance Method Summary collapse
- #call ⇒ Object
-
#initialize(customer_number, twilio_account_sid, twilio_account_token, twilio_phone_number) ⇒ TwilioWrapper
constructor
A new instance of TwilioWrapper.
- #isClientValid? ⇒ Boolean
Constructor Details
#initialize(customer_number, twilio_account_sid, twilio_account_token, twilio_phone_number) ⇒ TwilioWrapper
Returns a new instance of TwilioWrapper.
12 13 14 15 16 17 18 19 |
# File 'lib/twilio_with_thinq.rb', line 12 def initialize(customer_number, twilio_account_sid, twilio_account_token, twilio_phone_number) @customer_number = customer_number @twilio_account_sid = twilio_account_sid @twilio_account_token = twilio_account_token @twilio_phone_number = twilio_phone_number @client = Twilio::REST::Client.new twilio_account_sid, twilio_account_token end |
Instance Attribute Details
#callback_details ⇒ Object
Returns the value of attribute callback_details.
10 11 12 |
# File 'lib/twilio_with_thinq.rb', line 10 def callback_details @callback_details end |
#callback_type ⇒ Object
Returns the value of attribute callback_type.
10 11 12 |
# File 'lib/twilio_with_thinq.rb', line 10 def callback_type @callback_type end |
#client ⇒ Object
Returns the value of attribute client.
10 11 12 |
# File 'lib/twilio_with_thinq.rb', line 10 def client @client end |
#customer_number ⇒ Object
Returns the value of attribute customer_number.
10 11 12 |
# File 'lib/twilio_with_thinq.rb', line 10 def customer_number @customer_number end |
#twilio_account_sid ⇒ Object
Returns the value of attribute twilio_account_sid.
10 11 12 |
# File 'lib/twilio_with_thinq.rb', line 10 def twilio_account_sid @twilio_account_sid end |
#twilio_account_token ⇒ Object
Returns the value of attribute twilio_account_token.
10 11 12 |
# File 'lib/twilio_with_thinq.rb', line 10 def twilio_account_token @twilio_account_token end |
#twilio_phone_number ⇒ Object
Returns the value of attribute twilio_phone_number.
10 11 12 |
# File 'lib/twilio_with_thinq.rb', line 10 def twilio_phone_number @twilio_phone_number end |
Instance Method Details
#call ⇒ Object
25 26 27 28 29 30 31 32 33 34 35 36 37 38 |
# File 'lib/twilio_with_thinq.rb', line 25 def call if !self.isClientValid? return "Invalid Twilio Account details." end begin @call = @client.account.calls.create({:to => @customer_number, :from => @twilio_phone_number, :url => TWIML_RESOURCE_URL}) return @call.sid rescue Exception => e return e. end end |
#isClientValid? ⇒ Boolean
21 22 23 |
# File 'lib/twilio_with_thinq.rb', line 21 def isClientValid? !@client.nil? and !@client.account.nil? end |