Class: Twilioauth::Connection
- Inherits:
-
Object
- Object
- Twilioauth::Connection
- Defined in:
- lib/twilioauth.rb
Instance Attribute Summary collapse
-
#account ⇒ Object
Returns the value of attribute account.
-
#client ⇒ Object
Returns the value of attribute client.
Instance Method Summary collapse
- #default_number ⇒ Object
-
#initialize(account_sid, auth_token) ⇒ Connection
constructor
A new instance of Connection.
- #sms(message, to, from = default_number) ⇒ Object
Constructor Details
#initialize(account_sid, auth_token) ⇒ Connection
Returns a new instance of Connection.
9 10 11 12 |
# File 'lib/twilioauth.rb', line 9 def initialize(account_sid, auth_token) @client = Twilio::REST::Client.new account_sid, auth_token @account = @client.account end |
Instance Attribute Details
#account ⇒ Object
Returns the value of attribute account.
7 8 9 |
# File 'lib/twilioauth.rb', line 7 def account @account end |
#client ⇒ Object
Returns the value of attribute client.
7 8 9 |
# File 'lib/twilioauth.rb', line 7 def client @client end |
Instance Method Details
#default_number ⇒ Object
22 23 24 25 |
# File 'lib/twilioauth.rb', line 22 def default_number #retrieve the default number @default_number ||= @account.incoming_phone_numbers.list.first.phone_number end |
#sms(message, to, from = default_number) ⇒ Object
14 15 16 17 18 19 20 |
# File 'lib/twilioauth.rb', line 14 def sms(, to, from = default_number) @client.account.sms..create( :from => from, :to => to, :body => ) end |