class TwilioWithThinq::TwilioWrapper

The main twilio wrapper class that inegrates thinQ.

Constants

TWIML_RESOURCE_URL

Attributes

callback_details[RW]
callback_type[RW]
client[RW]
customer_number[RW]
twilio_account_sid[RW]
twilio_account_token[RW]
twilio_phone_number[RW]

Public Class Methods

new(customer_number, twilio_account_sid, twilio_account_token, twilio_phone_number) click to toggle source
# 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

Public Instance Methods

call() click to toggle source
# 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.message
    end
end
isClientValid?() click to toggle source
# File lib/twilio_with_thinq.rb, line 21
def isClientValid?
    !@client.nil? and !@client.account.nil?
end