Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Update for Twilio's API version 2010-04-01

  • Loading branch information...
commit e47fd758c68d25e2bbaca88d048db86d34b3a18a 1 parent 04ef864
Yuri Gadow authored
4 lib/twilio/call.rb
View
@@ -6,8 +6,8 @@ class Call < TwilioObject
# Example:
# Twilio.connect('my_twilio_sid', 'my_auth_token')
# Twilio::Call.make(CALLER_ID, user_number, 'http://myapp.com/twilio_response_handler')
- def make(caller, called, url, optional = {})
- Twilio.post("/Calls", :body => {:Caller => caller, :Called => called, :Url => url}.merge(optional))
+ def make(from, to, url, optional = {})
+ Twilio.post("/Calls", :body => {:From => from, :To => to, :Url => url}.merge(optional))
end
def list(optional = {})
2  lib/twilio/connection.rb
View
@@ -1,6 +1,6 @@
module Twilio
include HTTParty
- TWILIO_URL = "https://api.twilio.com/2008-08-01/Accounts"
+ TWILIO_URL = "https://api.twilio.com/2010-04-01/Accounts"
# The connect method caches your Twilio account id and authentication token
# Example:
4 lib/twilio/local_phone_number.rb
View
@@ -7,9 +7,9 @@ module Twilio
class LocalPhoneNumber < TwilioObject
def create(url, area_code = nil, method = 'POST', friendly_name = nil, options = {})
Twilio.post("/IncomingPhoneNumbers/Local", :body => {
- :Url => url,
+ :VoiceUrl => url,
:AreaCode => area_code,
- :Method => method,
+ :VoiceMethod => method,
:FriendlyName => friendly_name
}.merge(options))
end
4 lib/twilio/toll_free_phone_number.rb
View
@@ -7,9 +7,9 @@ module Twilio
class TollFreePhoneNumber < TwilioObject
def create(url, area_code = nil, method = 'POST', friendly_name = nil)
Twilio.post("/IncomingPhoneNumbers/TollFree", :body => {
- :Url => url,
+ :VoiceUrl => url,
:AreaCode => area_code,
- :Method => method,
+ :VoiceMethod => method,
:FriendlyName => friendly_name
})
end
4 test/fixtures/xml/call.xml
View
@@ -5,8 +5,8 @@
<DateUpdated>Sat, 07 Feb 2009 13:15:19 -0800</DateUpdated>
<CallSegmentSid/>
<AccountSid>mysid</AccountSid>
- <Called>4159633717</Called>
- <Caller>4156767925</Caller>
+ <To>4159633717</To>
+ <From>4156767925</From>
<PhoneNumberSid>PN01234567890123456789012345678900</PhoneNumberSid>
<Status>2</Status>
<StartTime>Thu, 03 Apr 2008 04:36:33 -0400</StartTime>
4 test/fixtures/xml/call_new.xml
View
@@ -2,8 +2,8 @@
<Call>
<Sid>CA42ed11f93dc08b952027ffbc406d0868</Sid>
<CallSegmentSid/> <AccountSid>AC309475e5fede1b49e100272a8640f438</AccountSid>
- <Called>4155551212</Called>
- <Caller>4158675309</Caller>
+ <To>4155551212</To>
+ <From>4158675309</From>
<PhoneNumberSid>PN01234567890123456789012345678900</PhoneNumberSid>
<Status>0</Status>
<StartTime>Thu, 03 Apr 2008 04:36:33 -0400</StartTime>
4 test/fixtures/xml/call_redirected.xml
View
@@ -3,8 +3,8 @@
<Sid>CA42ed11f93dc08b952027ffbc406d0868</Sid>
<CallSegmentSid/>
<AccountSid>AC309475e5fede1b49e100272a8640f438</AccountSid>
- <Called>4155551234</Called>
- <Caller>4158675309</Caller>
+ <To>4155551234</To>
+ <From>4158675309</From>
<PhoneNumberSid>PN01234567890123456789012345678900</PhoneNumberSid>
<Status>1</Status>
<StartTime>Thu, 03 Apr 2008 04:36:33 -0400</StartTime>
8 test/fixtures/xml/calls.xml
View
@@ -6,8 +6,8 @@
<DateUpdated>Sat, 07 Feb 2009 13:15:19 -0800</DateUpdated>
<CallSegmentSid/>
<AccountSid>mysid</AccountSid>
- <Called>4159633717</Called>
- <Caller>4156767925</Caller>
+ <To>4159633717</To>
+ <From>4156767925</From>
<PhoneNumberSid>PN01234567890123456789012345678900</PhoneNumberSid>
<Status>2</Status>
<StartTime>Thu, 03 Apr 2008 04:36:33 -0400</StartTime>
@@ -22,8 +22,8 @@
<DateUpdated>Sat, 07 Feb 2009 13:15:19 -0800</DateUpdated>
<CallSegmentSid/>
<AccountSid>mysid</AccountSid>
- <Called>2064287985</Called>
- <Caller>4156767925</Caller>
+ <To>2064287985</To>
+ <From>4156767925</From>
<PhoneNumberSid>PNd59c2ba27ef48264773edb90476d1674</PhoneNumberSid>
<Status>2</Status>
<StartTime>Thu, 03 Apr 2008 01:37:05 -0400</StartTime>
2  test/fixtures/xml/notification.xml
View
@@ -12,7 +12,7 @@
<MessageDate>Thu, 03 Apr 2008 04:36:32 -0400</MessageDate>
<RequestURL>http://yourserver.com/handleCall.php</RequestURL>
<RequestMethod>POST</RequestMethod>
- <RequestVariables>Caller=4158675309&Called=4155551212...</RequestVariables>
+ <RequestVariables>From=4158675309&To=4155551212...</RequestVariables>
<ResponseHeaders>Content-Length: 500</ResponseHeaders>
<ResponseBody>&lt;h1&gt;Error parsing PHP script&lt;/h1&gt;</ResponseBody>
</Notification>
2  test/test_helper.rb
View
@@ -24,7 +24,7 @@ def stub_response(verb, fixture_name, options = {}) #:nodoc:
end
def twilio_url(url=nil) #:nodoc:
- "https://mysid:mytoken@api.twilio.com:443/2008-08-01/Accounts/mysid#{'/' + url if url}"
+ "https://mysid:mytoken@api.twilio.com:443/2010-04-01/Accounts/mysid#{'/' + url if url}"
end
def verb_response(verb) #:nodoc:
Please sign in to comment.
Something went wrong with that request. Please try again.