Class: Twilioauth::Connection

Inherits:
Object
  • Object
show all
Defined in:
lib/twilioauth.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

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(, auth_token)
  @client = Twilio::REST::Client.new , auth_token
  @account = @client.
end

Instance Attribute Details

#accountObject

Returns the value of attribute account.



7
8
9
# File 'lib/twilioauth.rb', line 7

def 
  @account
end

#clientObject

Returns the value of attribute client.



7
8
9
# File 'lib/twilioauth.rb', line 7

def client
  @client
end

Instance Method Details

#default_numberObject



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(message, to, from = default_number)
  @client..sms.messages.create(
    :from => from,
    :to => to,
    :body => message
  )
end