twilio 3.1.0 → 3.1.1

Sign up to get free protection for your applications and to get access to all the features.
data/.gitignore CHANGED
@@ -1,5 +1,6 @@
1
1
  *.sw?
2
2
  .DS_Store
3
+ bin
3
4
  coverage
4
5
  rdoc
5
6
  *.gem
@@ -1,5 +1,9 @@
1
1
  = Twilio Gem Changelog
2
2
 
3
+ == 3.1.1
4
+
5
+ * Loosens dependency on httparty gem to address a potential vulnerability
6
+
3
7
  == 3.1.0
4
8
 
5
9
  * Better handling of Builder version for greater compat
data/Gemfile CHANGED
@@ -1,4 +1,6 @@
1
1
  source "http://rubygems.org"
2
+ gemspec
2
3
 
3
- # Specify your gem's dependencies in twilio.gemspec
4
- gemspec
4
+ platforms :jruby do
5
+ gem 'jruby-openssl'
6
+ end
data/LICENSE CHANGED
@@ -1,4 +1,4 @@
1
- Copyright (c) 2009-2010 Phil Misiowiec, Webficient LLC
1
+ Copyright Phil Misiowiec, Webficient LLC
2
2
 
3
3
  Permission is hereby granted, free of charge, to any person obtaining
4
4
  a copy of this software and associated documentation files (the
@@ -9,21 +9,21 @@ See http://www.twilio.com/docs/index for Twilio's API documentation.
9
9
  First set your credentials by calling the connect method:
10
10
 
11
11
  Twilio.connect('my_twilio_sid', 'my_auth_token')
12
-
12
+
13
13
  Now call any of the Twilio classes:
14
-
14
+
15
15
  Twilio::Call.make('1234567890', '9876543210', 'http://mysite.com/connected_call')
16
16
  Twilio::Recording.list
17
-
17
+
18
18
  == Responding to Twilio
19
19
 
20
- When Twilio calls your application URL, your response must use the Twilio Markup XML (http://www.twilio.com/docs/api_reference/TwiML/). The Twilio gem makes this very easy
21
- by providing a Twilio Verb class.
20
+ When Twilio calls your application URL, your response must use the Twilio Markup XML (http://www.twilio.com/docs/api_reference/TwiML/). The Twilio gem makes this very easy
21
+ by providing a Twilio Verb class.
22
22
 
23
23
  For example, in a Ruby on Rails application, you could do the following inside a controller class:
24
24
 
25
25
  Twilio::Verb.dial '415-123-4567'
26
-
26
+
27
27
  and you can nest multiple verbs inside a block:
28
28
 
29
29
  verb = Twilio::Verb.new { |v|
@@ -35,7 +35,7 @@ and you can nest multiple verbs inside a block:
35
35
  == Installation
36
36
 
37
37
  gem install twilio
38
-
38
+
39
39
  == Contributing
40
40
 
41
41
  1. Run 'bundle' from the command line to install dependencies
@@ -47,11 +47,11 @@ Note: don't require 'rubygems' in any file (http://www.rubyinside.com/why-using-
47
47
  == Testing
48
48
 
49
49
  * Currently using RSpec
50
- * Tested with REE 1.8.7, MRI 1.9.2, and MRI 1.9.3
50
+ * Tested with REE 1.8.7, MRI 1.9.2, MRI 1.9.3, and JRuby 1.6.5
51
51
 
52
52
  == Copyright
53
53
 
54
- Copyright (c) 2009-2011 Phil Misiowiec, Webficient LLC. See LICENSE for details.
54
+ Copyright Phil Misiowiec, Webficient LLC. See LICENSE for details.
55
55
 
56
56
  == Contributors
57
57
 
@@ -22,7 +22,6 @@
22
22
  #++
23
23
 
24
24
  require 'httparty'
25
- require 'builder'
26
25
 
27
26
  require 'twilio/twilio_object'
28
27
 
@@ -37,11 +36,11 @@ require 'twilio/recording'
37
36
  require 'twilio/sms'
38
37
  require 'twilio/verb'
39
38
 
40
- module Twilio
39
+ module Twilio
41
40
  include HTTParty
42
41
  TWILIO_URL = "https://api.twilio.com/2010-04-01/Accounts"
43
42
  SSL_CA_PATH = "/etc/ssl/certs"
44
-
43
+
45
44
  # The connect method caches your Twilio account id and authentication token
46
45
  # Example:
47
46
  # Twilio.connect('AC309475e5fede1b49e100272a8640f438', '3a2630a909aadbf60266234756fb15a0')
@@ -49,5 +48,5 @@ module Twilio
49
48
  self.base_uri "#{TWILIO_URL}/#{account_sid}"
50
49
  self.basic_auth account_sid, auth_token
51
50
  self.default_options[:ssl_ca_path] ||= SSL_CA_PATH unless self.default_options[:ssl_ca_file]
52
- end
51
+ end
53
52
  end
@@ -22,7 +22,9 @@ module Twilio
22
22
  :NearNumber => opts[:near_number],
23
23
  :InLata => opts[:in_lata],
24
24
  :InRateCenter => opts[:in_rate_center],
25
- :Distance => opts[:distance]
25
+ :Distance => opts[:distance],
26
+ :Page => opts[:page],
27
+ :PageSize => opts[:page_size]
26
28
  }.reject {|k,v| v == nil} unless opts.empty?
27
29
 
28
30
  Twilio.get("/AvailablePhoneNumbers/#{iso_country_code}/#{resource}", :query => params)
@@ -39,6 +41,8 @@ module Twilio
39
41
  # :in_lata
40
42
  # :in_rate_center
41
43
  # :distance
44
+ # :page
45
+ # :page_size
42
46
  def search_local(opts ={})
43
47
  opts = {:resource => 'Local'}.merge(opts)
44
48
  search(opts)
@@ -46,7 +50,10 @@ module Twilio
46
50
 
47
51
  # The search_toll_free method searches for available toll-free numbers
48
52
  # Search Options
53
+ # :area_code
49
54
  # :contains
55
+ # :page
56
+ # :page_size
50
57
  def search_toll_free(opts ={})
51
58
  opts = {:resource => 'TollFree'}.merge(opts)
52
59
  search(opts)
@@ -23,6 +23,10 @@ module Twilio
23
23
  Twilio.post("/IncomingPhoneNumbers", :body => opts)
24
24
  end
25
25
 
26
+ def update(incoming_sid, opts)
27
+ Twilio.post("/IncomingPhoneNumbers/#{incoming_sid}", :body => opts)
28
+ end
29
+
26
30
  def delete(incoming_sid)
27
31
  Twilio.delete("/IncomingPhoneNumbers/#{incoming_sid}")
28
32
  end
@@ -1,3 +1,5 @@
1
+ require 'builder'
2
+
1
3
  module Twilio
2
4
  # Twilio Verbs enable your application to respond to Twilio requests (to your app) with XML responses.
3
5
  # There are 5 primary verbs (say, play, gather, record, dial) and 3 secondary (hangup, pause, redirect).
@@ -363,7 +365,7 @@ module Twilio
363
365
  # Twilio::Verb.reject
364
366
  #
365
367
  # If reject is called with an argument:
366
- #
368
+ #
367
369
  # Twilio::Verb.reject :reason => "busy"
368
370
  #
369
371
  def reject options = {}
@@ -1,3 +1,3 @@
1
1
  module Twilio
2
- VERSION = "3.1.0"
2
+ VERSION = "3.1.1"
3
3
  end
@@ -1,42 +1,42 @@
1
1
  play_mp3:
2
2
  response: <?xml version="1.0" encoding="UTF-8"?><Response><Play loop="1">http://foo.com/cowbell.mp3</Play></Response>
3
-
3
+
4
4
  play_mp3_two_times:
5
5
  response: <?xml version="1.0" encoding="UTF-8"?><Response><Play loop="2">http://foo.com/cowbell.mp3</Play></Response>
6
6
 
7
7
  play_mp3_two_times_with_pause:
8
8
  response: <?xml version="1.0" encoding="UTF-8"?><Response><Play>http://foo.com/cowbell.mp3</Play><Pause/><Play>http://foo.com/cowbell.mp3</Play></Response>
9
-
9
+
10
10
  gather:
11
11
  response: <?xml version="1.0" encoding="UTF-8"?><Response><Gather/></Response>
12
12
 
13
13
  gather_with_action:
14
14
  response: <?xml version="1.0" encoding="UTF-8"?><Response><Gather action="http://foobar.com"/></Response>
15
-
15
+
16
16
  gather_with_get_method:
17
17
  response: <?xml version="1.0" encoding="UTF-8"?><Response><Gather method="GET"/></Response>
18
-
18
+
19
19
  gather_with_timeout:
20
20
  response: <?xml version="1.0" encoding="UTF-8"?><Response><Gather timeout="10"/></Response>
21
-
21
+
22
22
  gather_with_finish_key:
23
23
  response: <?xml version="1.0" encoding="UTF-8"?><Response><Gather finishOnKey="*"/></Response>
24
-
24
+
25
25
  gather_with_num_digits:
26
26
  response: <?xml version="1.0" encoding="UTF-8"?><Response><Gather numDigits="5"/></Response>
27
-
27
+
28
28
  record:
29
- response: <?xml version="1.0" encoding="UTF-8"?><Response><Record></Record></Response>
30
-
29
+ response: <?xml version="1.0" encoding="UTF-8"?><Response><Record/></Response>
30
+
31
31
  record_with_action:
32
32
  response: <?xml version="1.0" encoding="UTF-8"?><Response><Record action="http://foobar.com"/></Response>
33
-
33
+
34
34
  record_with_get_method:
35
35
  response: <?xml version="1.0" encoding="UTF-8"?><Response><Record method="GET"/></Response>
36
-
36
+
37
37
  record_with_timeout:
38
38
  response: <?xml version="1.0" encoding="UTF-8"?><Response><Record timeout="10"/></Response>
39
-
39
+
40
40
  record_with_finish_key:
41
41
  response: <?xml version="1.0" encoding="UTF-8"?><Response><Record finishOnKey="*"/></Response>
42
42
 
@@ -45,30 +45,30 @@ record_with_max_length:
45
45
 
46
46
  dial:
47
47
  response: <?xml version="1.0" encoding="UTF-8"?><Response><Dial>415-123-4567</Dial></Response>
48
-
48
+
49
49
  dial_with_action:
50
50
  response: <?xml version="1.0" encoding="UTF-8"?><Response><Dial action="http://foobar.com">415-123-4567</Dial></Response>
51
-
51
+
52
52
  dial_with_get_method:
53
53
  response: <?xml version="1.0" encoding="UTF-8"?><Response><Dial method="GET">415-123-4567</Dial></Response>
54
-
54
+
55
55
  dial_with_timeout:
56
56
  response: <?xml version="1.0" encoding="UTF-8"?><Response><Dial timeout="10">415-123-4567</Dial></Response>
57
-
57
+
58
58
  dial_with_hangup_on_star:
59
59
  response: <?xml version="1.0" encoding="UTF-8"?><Response><Dial hangupOnStar="true">415-123-4567</Dial></Response>
60
-
60
+
61
61
  dial_with_time_limit:
62
62
  response: <?xml version="1.0" encoding="UTF-8"?><Response><Dial timeLimit="3600">415-123-4567</Dial></Response>
63
-
63
+
64
64
  dial_with_caller_id:
65
65
  response: <?xml version="1.0" encoding="UTF-8"?><Response><Dial callerId="858-987-6543">415-123-4567</Dial></Response>
66
-
66
+
67
67
  dial_with_redirect:
68
68
  response: <?xml version="1.0" encoding="UTF-8"?><Response><Dial>415-123-4567</Dial><Redirect>http://www.foo.com/nextInstructions</Redirect></Response>
69
69
 
70
70
  dial_with_number_and_send_digits:
71
- response: <?xml version="1.0" encoding="UTF-8"?><Response><Dial><Number sendDigits="wwww1928">415-123-4567</Number></Dial></Response>
71
+ response: <?xml version="1.0" encoding="UTF-8"?><Response><Dial><Number sendDigits="wwww1928">415-123-4567</Number></Dial></Response>
72
72
 
73
73
  dial_multiple_numbers:
74
74
  response: <?xml version="1.0" encoding="UTF-8"?><Response><Dial><Number>415-123-4567</Number><Number>415-123-4568</Number><Number>415-123-4569</Number></Dial></Response>
@@ -78,9 +78,9 @@ dial_conference:
78
78
 
79
79
  dial_muted_conference:
80
80
  response: <?xml version="1.0" encoding="UTF-8"?><Response><Dial><Conference mute="true">MyRoom</Conference></Dial></Response>
81
-
81
+
82
82
  hangup:
83
- response: <?xml version="1.0" encoding="UTF-8"?><Response><Hangup/></Response>
83
+ response: <?xml version="1.0" encoding="UTF-8"?><Response><Hangup/></Response>
84
84
 
85
85
  reject:
86
- response: <?xml version="1.0" encoding="UTF-8"?><Response><Reject/></Response>
86
+ response: <?xml version="1.0" encoding="UTF-8"?><Response><Reject/></Response>
@@ -1,35 +1,35 @@
1
1
  module TwilioHelpers #:nodoc:
2
-
3
- def stub_http_request(http_method, fixture_name, *opts)
2
+
3
+ def stub_http_request(http_method, fixture_name, *opts)
4
4
  if opts
5
5
  request_options = opts.pop if opts.last.is_a?(Hash)
6
6
  resource = opts.pop
7
7
  end
8
-
9
- fake_response = fixture(fixture_name)
8
+
9
+ fake_response = fixture(fixture_name)
10
10
  url = twilio_url(resource)
11
-
11
+
12
12
  if request_options
13
13
  stub_request(http_method, url).with(request_options).to_return(:body => fake_response)
14
14
  else
15
15
  stub_request(http_method, url).to_return(:body => fake_response)
16
16
  end
17
-
17
+
18
18
  return fake_response, url
19
19
  end
20
-
20
+
21
21
  def stub_get(fixture, *opts)
22
- stub_http_request(:get, fixture, *opts)
22
+ stub_http_request(:get, fixture, *opts)
23
23
  end
24
-
24
+
25
25
  def stub_post(fixture, *opts)
26
26
  stub_http_request(:post, fixture, *opts)
27
27
  end
28
-
28
+
29
29
  def stub_put(fixture, *opts)
30
30
  stub_http_request(:put, fixture, *opts)
31
31
  end
32
-
32
+
33
33
  def stub_delete(fixture, *opts)
34
34
  stub_http_request(:delete, fixture, *opts)
35
35
  end
@@ -38,9 +38,9 @@ module TwilioHelpers #:nodoc:
38
38
  path = File.join(File.dirname(__FILE__), "../fixtures/yml/verb_responses.yml")
39
39
  YAML.load_file(path)[verb.to_s]['response']
40
40
  end
41
-
41
+
42
42
  private
43
-
43
+
44
44
  def twilio_url(url=nil)
45
45
  "https://mysid:mytoken@api.twilio.com:443/2010-04-01/Accounts/mysid#{'/' + url if url}"
46
46
  end
@@ -1,21 +1,21 @@
1
1
  require 'spec_helper'
2
2
 
3
- describe 'Account' do
3
+ describe 'Account' do
4
4
  before(:all) do
5
5
  Twilio.connect('mysid', 'mytoken')
6
6
  end
7
-
8
- it "gets an account" do
7
+
8
+ it "gets an account" do
9
9
  response, url = stub_get(:account)
10
-
11
- Twilio::Account.get.should == response
10
+
11
+ Twilio::Account.get.should eql response
12
12
  WebMock.should have_requested(:get, twilio_url)
13
13
  end
14
-
14
+
15
15
  it "updates name" do
16
16
  response, url = stub_put(:account_renamed)
17
-
18
- Twilio::Account.update_name('Bubba').should == response
17
+
18
+ Twilio::Account.update_name('Bubba').should eql response
19
19
  WebMock.should have_requested(:put, twilio_url).with(:body => {:FriendlyName => 'Bubba'})
20
20
  end
21
21
  end
@@ -1,52 +1,52 @@
1
1
  require 'spec_helper'
2
2
 
3
- describe "Available Phone Numbers" do
3
+ describe "Available Phone Numbers" do
4
4
  before(:all) do
5
5
  Twilio.connect('mysid', 'mytoken')
6
6
  end
7
-
7
+
8
8
  context "Local Number" do
9
- it "is searchable" do
9
+ it "is searchable" do
10
10
  response, url = stub_get(:available_phone_numbers_local, 'AvailablePhoneNumbers/US/Local')
11
-
12
- Twilio::AvailablePhoneNumbers.search_local.should == response
11
+
12
+ Twilio::AvailablePhoneNumbers.search_local.should eql response
13
13
  WebMock.should have_requested(:get, url)
14
14
  end
15
-
16
- it "is searchable by area code" do
15
+
16
+ it "is searchable by area code" do
17
17
  response, url = stub_get(:available_phone_numbers_local_search, 'AvailablePhoneNumbers/US/Local?AreaCode=510')
18
-
19
- Twilio::AvailablePhoneNumbers.search_local(:area_code => 510).should == response
18
+
19
+ Twilio::AvailablePhoneNumbers.search_local(:area_code => 510).should eql response
20
20
  WebMock.should have_requested(:get, url)
21
21
  end
22
-
23
- it "is searchable by postal code" do
22
+
23
+ it "is searchable by postal code" do
24
24
  response, url = stub_get(:available_phone_numbers_local_search, 'AvailablePhoneNumbers/US/Local?InPostalCode=94612')
25
-
26
- Twilio::AvailablePhoneNumbers.search_local(:postal_code => 94612).should == response
25
+
26
+ Twilio::AvailablePhoneNumbers.search_local(:postal_code => 94612).should eql response
27
27
  WebMock.should have_requested(:get, url)
28
28
  end
29
-
30
- it "is searchable using multiple parameters" do
31
- response, url = stub_get(:available_phone_numbers_local_search, 'AvailablePhoneNumbers/US/Local?NearLatLong=37.806940%2C-122.270360&InRateCenter=OKLD0349T&NearNumber=15105551213&Distance=50&InRegion=CA&InLata=722&Contains=510555****')
32
-
33
- Twilio::AvailablePhoneNumbers.search_local(:in_region => 'CA', :contains => '510555****', :near_lat_long => '37.806940,-122.270360', :near_number => '15105551213', :in_lata => 722, :in_rate_center => 'OKLD0349T', :distance => 50).should == response
29
+
30
+ it "is searchable using multiple parameters" do
31
+ response, url = stub_get(:available_phone_numbers_local_search, 'AvailablePhoneNumbers/US/Local?NearLatLong=37.806940%2C-122.270360&InRateCenter=OKLD0349T&NearNumber=15105551213&Distance=50&InRegion=CA&InLata=722&Contains=510555****&Page=2&PageSize=30')
32
+
33
+ Twilio::AvailablePhoneNumbers.search_local(:in_region => 'CA', :contains => '510555****', :near_lat_long => '37.806940,-122.270360', :near_number => '15105551213', :in_lata => 722, :in_rate_center => 'OKLD0349T', :distance => 50, :page => 2, :page_size => 30).should eql response
34
34
  WebMock.should have_requested(:get, url)
35
35
  end
36
36
  end
37
37
 
38
38
  context "Toll-free Number" do
39
- it "is searchable" do
39
+ it "is searchable" do
40
40
  response, url = stub_get(:available_phone_numbers_toll_free, 'AvailablePhoneNumbers/US/TollFree')
41
-
42
- Twilio::AvailablePhoneNumbers.search_toll_free.should == response
41
+
42
+ Twilio::AvailablePhoneNumbers.search_toll_free.should eql response
43
43
  WebMock.should have_requested(:get, url)
44
44
  end
45
-
46
- it "is searchable as a vanity number" do
45
+
46
+ it "is searchable as a vanity number" do
47
47
  response, url = stub_get(:available_phone_numbers_toll_free_search, 'AvailablePhoneNumbers/US/TollFree?Contains=STORM')
48
-
49
- Twilio::AvailablePhoneNumbers.search_toll_free(:contains => 'STORM').should == response
48
+
49
+ Twilio::AvailablePhoneNumbers.search_toll_free(:contains => 'STORM').should eql response
50
50
  WebMock.should have_requested(:get, url)
51
51
  end
52
52
  end
@@ -5,60 +5,60 @@ describe "Call" do
5
5
  Twilio.connect('mysid', 'mytoken')
6
6
  @call_sid = 'CA42ed11f93dc08b952027ffbc406d0868'
7
7
  end
8
-
8
+
9
9
  it "can be made" do
10
10
  response, url = stub_post(:call_new, 'Calls')
11
-
12
- Twilio::Call.make('4158675309', '4155551212', 'http://localhost:3000/call_handler').should == response
11
+
12
+ Twilio::Call.make('4158675309', '4155551212', 'http://localhost:3000/call_handler').should eql response
13
13
  WebMock.should have_requested(:post, url)
14
14
  end
15
-
15
+
16
16
  it "can be redirected" do
17
17
  response, url = stub_post(:call_redirected, "Calls/#{@call_sid}")
18
-
19
- Twilio::Call.redirect(@call_sid, 'http://localhost:3000/redirect_handler').should == response
18
+
19
+ Twilio::Call.redirect(@call_sid, 'http://localhost:3000/redirect_handler').should eql response
20
20
  WebMock.should have_requested(:post, url)
21
21
  end
22
-
22
+
23
23
  it "gets a list of calls" do
24
24
  response, url = stub_get(:calls, 'Calls')
25
-
26
- Twilio::Call.list.should == response
25
+
26
+ Twilio::Call.list.should eql response
27
27
  WebMock.should have_requested(:get, url)
28
28
  end
29
-
29
+
30
30
  it "gets a specific call" do
31
31
  response, url = stub_get(:calls, "Calls/#{@call_sid}")
32
-
33
- Twilio::Call.get(@call_sid).should == response
32
+
33
+ Twilio::Call.get(@call_sid).should eql response
34
34
  WebMock.should have_requested(:get, url)
35
35
  end
36
-
36
+
37
37
  it "gets a list of call segments" do
38
38
  response, url = stub_get(:calls, "Calls/#{@call_sid}/Segments")
39
-
40
- Twilio::Call.segments(@call_sid).should == response
39
+
40
+ Twilio::Call.segments(@call_sid).should eql response
41
41
  WebMock.should have_requested(:get, url)
42
42
  end
43
-
43
+
44
44
  it "gets a specific call segment" do
45
45
  response, url = stub_get(:calls, "Calls/#{@call_sid}/Segments/abc123")
46
-
47
- Twilio::Call.segments(@call_sid, 'abc123').should == response
46
+
47
+ Twilio::Call.segments(@call_sid, 'abc123').should eql response
48
48
  WebMock.should have_requested(:get, url)
49
49
  end
50
-
50
+
51
51
  it "gets a list of call recordings" do
52
52
  response, url = stub_get(:recordings, "Calls/#{@call_sid}/Recordings")
53
-
54
- Twilio::Call.recordings(@call_sid).should == response
53
+
54
+ Twilio::Call.recordings(@call_sid).should eql response
55
55
  WebMock.should have_requested(:get, url)
56
56
  end
57
-
57
+
58
58
  it "gets a list of call notifications" do
59
59
  response, url = stub_get(:notifications, "Calls/#{@call_sid}/Notifications")
60
-
61
- Twilio::Call.notifications(@call_sid).should == response
60
+
61
+ Twilio::Call.notifications(@call_sid).should eql response
62
62
  WebMock.should have_requested(:get, url)
63
63
  end
64
64
  end
@@ -6,53 +6,53 @@ describe "Conference" do
6
6
  @conference_sid = 'CF9f2ead1ae43cdabeab102fa30d938378'
7
7
  @call_sid = 'CA9ae8e040497c0598481c2031a154919e'
8
8
  end
9
-
9
+
10
10
  it "gets a list of conferences" do
11
11
  response, url = stub_get(:conferences, 'Conferences')
12
-
13
- Twilio::Conference.list.should == response
12
+
13
+ Twilio::Conference.list.should eql response
14
14
  WebMock.should have_requested(:get, url)
15
15
  end
16
-
16
+
17
17
  it "gets a specific conference" do
18
18
  response, url = stub_get(:conference, "Conferences/#{@conference_sid}")
19
-
20
- Twilio::Conference.get(@conference_sid).should == response
19
+
20
+ Twilio::Conference.get(@conference_sid).should eql response
21
21
  WebMock.should have_requested(:get, url)
22
22
  end
23
-
23
+
24
24
  it "gets a list of participants" do
25
25
  response, url = stub_get(:conference_participants, "Conferences/#{@conference_sid}/Participants")
26
-
27
- Twilio::Conference.participants(@conference_sid).should == response
26
+
27
+ Twilio::Conference.participants(@conference_sid).should eql response
28
28
  WebMock.should have_requested(:get, url)
29
29
  end
30
30
 
31
31
  it "gets a specific participant" do
32
32
  response, url = stub_get(:conference_participant, "Conferences/#{@conference_sid}/Participants/#{@call_sid}")
33
-
34
- Twilio::Conference.participant(@conference_sid, @call_sid).should == response
33
+
34
+ Twilio::Conference.participant(@conference_sid, @call_sid).should eql response
35
35
  WebMock.should have_requested(:get, url)
36
36
  end
37
37
 
38
38
  it "can mute a particant" do
39
39
  response, url = stub_post(:conference_participant_muted, "Conferences/#{@conference_sid}/Participants/#{@call_sid}", :body => 'Muted=true')
40
-
41
- Twilio::Conference.mute_participant(@conference_sid, @call_sid).should == response
40
+
41
+ Twilio::Conference.mute_participant(@conference_sid, @call_sid).should eql response
42
42
  WebMock.should have_requested(:post, url)
43
43
  end
44
44
 
45
45
  it "can unmute a participant" do
46
46
  response, url = stub_post(:conference_participant, "Conferences/#{@conference_sid}/Participants/#{@call_sid}", :body => 'Muted=false')
47
-
48
- Twilio::Conference.unmute_participant(@conference_sid, @call_sid).should == response
47
+
48
+ Twilio::Conference.unmute_participant(@conference_sid, @call_sid).should eql response
49
49
  WebMock.should have_requested(:post, url)
50
50
  end
51
51
 
52
52
  it "can be kicked" do
53
53
  response, url = stub_delete(:conference_participant, "Conferences/#{@conference_sid}/Participants/#{@call_sid}")
54
-
55
- Twilio::Conference.kick_participant(@conference_sid, @call_sid).should == response
54
+
55
+ Twilio::Conference.kick_participant(@conference_sid, @call_sid).should eql response
56
56
  WebMock.should have_requested(:delete, url)
57
57
  end
58
58
  end
@@ -5,38 +5,38 @@ describe "Incoming Phone Number" do
5
5
  Twilio.connect('mysid', 'mytoken')
6
6
  @incoming_sid = 'PNe536dfda7c6184afab78d980cb8cdf43'
7
7
  end
8
-
8
+
9
9
  it "gets a specific phone number" do
10
10
  response, url = stub_get(:incoming_phone_number, "IncomingPhoneNumbers/#{@incoming_sid}")
11
-
12
- Twilio::IncomingPhoneNumber.get(@incoming_sid).should == response
11
+
12
+ Twilio::IncomingPhoneNumber.get(@incoming_sid).should eql response
13
13
  WebMock.should have_requested(:get, url)
14
14
  end
15
-
15
+
16
16
  it "gets a list of phone numbers" do
17
17
  response, url = stub_get(:incoming_phone_numbers, 'IncomingPhoneNumbers')
18
-
19
- Twilio::IncomingPhoneNumber.list.should == response
18
+
19
+ Twilio::IncomingPhoneNumber.list.should eql response
20
20
  WebMock.should have_requested(:get, url)
21
21
  end
22
-
22
+
23
23
  context "creating" do
24
24
  it "is created" do
25
25
  response, url = stub_post(:incoming_phone_number, 'IncomingPhoneNumbers')
26
26
 
27
- Twilio::IncomingPhoneNumber.create(:PhoneNumber => '8055551212').should == response
27
+ Twilio::IncomingPhoneNumber.create(:PhoneNumber => '8055551212').should eql response
28
28
  WebMock.should have_requested(:post, url)
29
29
  end
30
-
30
+
31
31
  it "raises an exception if PhoneNumber or AreaCode are not set" do
32
32
  expect { Twilio::IncomingPhoneNumber.create(:FriendlyName => 'Booyah') }.to raise_exception
33
33
  end
34
34
  end
35
-
35
+
36
36
  it "is deleted" do
37
37
  response, url = stub_delete(:incoming_phone_number, "IncomingPhoneNumbers/#{@incoming_sid}")
38
-
39
- Twilio::IncomingPhoneNumber.delete(@incoming_sid).should == response
38
+
39
+ Twilio::IncomingPhoneNumber.delete(@incoming_sid).should eql response
40
40
  WebMock.should have_requested(:delete, url)
41
41
  end
42
42
  end
@@ -1,7 +1,7 @@
1
1
  require 'spec_helper'
2
2
 
3
3
  # uncomment and add your own tests here
4
- =begin
4
+ =begin
5
5
  describe "testing with a live connection" do
6
6
  before(:all) do
7
7
  WebMock.allow_net_connect!
@@ -9,11 +9,11 @@ describe "testing with a live connection" do
9
9
  @token = '123'
10
10
  Twilio.connect(@sid, @token)
11
11
  end
12
-
12
+
13
13
  after(:all) do
14
14
  WebMock.disable_net_connect!
15
15
  end
16
-
16
+
17
17
  it "gets real account" do
18
18
  Twilio::Account.get.should include("TwilioResponse")
19
19
  end
@@ -8,22 +8,22 @@ describe "Notification" do
8
8
 
9
9
  it "gets a list of notifications" do
10
10
  response, url = stub_get(:notifications, 'Notifications')
11
-
12
- Twilio::Notification.list.should == response
11
+
12
+ Twilio::Notification.list.should eql response
13
13
  WebMock.should have_requested(:get, url)
14
14
  end
15
-
15
+
16
16
  it "gets a specific notification" do
17
17
  response, url = stub_get(:notification, "Notifications/#{@notification_sid}")
18
-
19
- Twilio::Notification.get(@notification_sid).should == response
18
+
19
+ Twilio::Notification.get(@notification_sid).should eql response
20
20
  WebMock.should have_requested(:get, url)
21
21
  end
22
-
22
+
23
23
  it "is deleted" do
24
24
  response, url = stub_delete(:notification, "Notifications/#{@notification_sid}")
25
-
26
- Twilio::Notification.delete(@notification_sid).should == response
25
+
26
+ Twilio::Notification.delete(@notification_sid).should eql response
27
27
  WebMock.should have_requested(:delete, url)
28
28
  end
29
29
  end
@@ -5,39 +5,39 @@ describe "Outgoing Caller ID" do
5
5
  Twilio.connect('mysid', 'mytoken')
6
6
  @callerid_sid = 'PNe536dfda7c6184afab78d980cb8cdf43'
7
7
  end
8
-
8
+
9
9
  it "gets a list of caller id's" do
10
10
  response, url = stub_get(:outgoing_caller_ids, 'OutgoingCallerIds')
11
-
12
- Twilio::OutgoingCallerId.list.should == response
11
+
12
+ Twilio::OutgoingCallerId.list.should eql response
13
13
  WebMock.should have_requested(:get, url)
14
14
  end
15
-
15
+
16
16
  it "gets a specific caller id" do
17
17
  response, url = stub_get(:outgoing_caller_id, "OutgoingCallerIds/#{@callerid_sid}")
18
-
19
- Twilio::OutgoingCallerId.get(@callerid_sid).should == response
18
+
19
+ Twilio::OutgoingCallerId.get(@callerid_sid).should eql response
20
20
  WebMock.should have_requested(:get, url)
21
21
  end
22
-
22
+
23
23
  it "is created" do
24
24
  response, url = stub_post(:outgoing_caller_id_new, 'OutgoingCallerIds')
25
-
26
- Twilio::OutgoingCallerId.create('4158675309', 'My Home Phone').should == response
25
+
26
+ Twilio::OutgoingCallerId.create('4158675309', 'My Home Phone').should eql response
27
27
  WebMock.should have_requested(:post, url)
28
28
  end
29
-
29
+
30
30
  it "is deleted" do
31
31
  response, url = stub_delete(:outgoing_caller_id, "OutgoingCallerIds/#{@callerid_sid}")
32
-
33
- Twilio::OutgoingCallerId.delete(@callerid_sid).should == response
32
+
33
+ Twilio::OutgoingCallerId.delete(@callerid_sid).should eql response
34
34
  WebMock.should have_requested(:delete, url)
35
35
  end
36
-
36
+
37
37
  it "updates name" do
38
38
  response, url = stub_put(:outgoing_caller_id, "OutgoingCallerIds/#{@callerid_sid}")
39
-
40
- Twilio::OutgoingCallerId.update_name(@callerid_sid, 'My office line').should == response
39
+
40
+ Twilio::OutgoingCallerId.update_name(@callerid_sid, 'My office line').should eql response
41
41
  WebMock.should have_requested(:put, url)
42
42
  end
43
43
  end
@@ -6,39 +6,39 @@ describe "Recording" do
6
6
  @recording_sid = 'RE41331862605f3d662488fdafda2e175f'
7
7
  @transcription_sid = 'TRbdece5b75f2cd8f6ef38e0a10f5c4447'
8
8
  end
9
-
9
+
10
10
  it "gets a list of recordings" do
11
11
  response, url = stub_get(:recordings, 'Recordings')
12
-
13
- Twilio::Recording.list.should == response
12
+
13
+ Twilio::Recording.list.should eql response
14
14
  WebMock.should have_requested(:get, url)
15
15
  end
16
-
16
+
17
17
  it "gets a specific recording" do
18
18
  response, url = stub_get(:recording, "Recordings/#{@recording_sid}")
19
-
20
- Twilio::Recording.get(@recording_sid).should == response
19
+
20
+ Twilio::Recording.get(@recording_sid).should eql response
21
21
  WebMock.should have_requested(:get, url)
22
22
  end
23
-
23
+
24
24
  it "is deleted" do
25
25
  response, url = stub_delete(:recording, "Recordings/#{@recording_sid}")
26
-
27
- Twilio::Recording.delete(@recording_sid).should == response
26
+
27
+ Twilio::Recording.delete(@recording_sid).should eql response
28
28
  WebMock.should have_requested(:delete, url)
29
29
  end
30
-
30
+
31
31
  it "gets a list of transcriptions" do
32
32
  response, url = stub_get(:transcriptions, "Recordings/#{@recording_sid}/Transcriptions")
33
-
34
- Twilio::Recording.transcriptions(@recording_sid).should == response
33
+
34
+ Twilio::Recording.transcriptions(@recording_sid).should eql response
35
35
  WebMock.should have_requested(:get, url)
36
36
  end
37
37
 
38
38
  it "gets a specific transcription" do
39
39
  response, url = stub_get(:transcriptions, "Recordings/#{@recording_sid}/Transcriptions/#{@transcription_sid}")
40
-
41
- Twilio::Recording.transcriptions(@recording_sid, @transcription_sid).should == response
40
+
41
+ Twilio::Recording.transcriptions(@recording_sid, @transcription_sid).should eql response
42
42
  WebMock.should have_requested(:get, url)
43
43
  end
44
44
  end
@@ -5,32 +5,32 @@ describe "SMS" do
5
5
  Twilio.connect('mysid', 'mytoken')
6
6
  @sms_sid = 'SM872fb94e3b358913777cdb313f25b46f'
7
7
  end
8
-
8
+
9
9
  it "gets a list of SMS messages" do
10
10
  response, url = stub_get(:sms_messages, 'SMS/Messages')
11
-
12
- Twilio::Sms.list.should == response
11
+
12
+ Twilio::Sms.list.should eql response
13
13
  WebMock.should have_requested(:get, url)
14
14
  end
15
15
 
16
16
  it "gets a specific SMS message" do
17
17
  response, url = stub_get(:sms, "SMS/Messages/#{@sms_sid}")
18
-
19
- Twilio::Sms.get(@sms_sid).should == response
18
+
19
+ Twilio::Sms.get(@sms_sid).should eql response
20
20
  WebMock.should have_requested(:get, url)
21
21
  end
22
-
22
+
23
23
  it "is created" do
24
24
  response, url = stub_post(:sms_new, "SMS/Messages")
25
-
26
- Twilio::Sms.message('4155551212', '5558675309', 'Hi Jenny! Want to grab dinner?').should == response
25
+
26
+ Twilio::Sms.message('4155551212', '5558675309', 'Hi Jenny! Want to grab dinner?').should eql response
27
27
  WebMock.should have_requested(:post, url)
28
28
  end
29
-
29
+
30
30
  it "is created with a callback URL" do
31
31
  response, url = stub_post(:sms_new_with_callback, "SMS/Messages")
32
-
33
- Twilio::Sms.message('4155551212', '5558675309', 'Hi Jenny! Want to grab dinner?', 'http://example.com/callback').should == response
32
+
33
+ Twilio::Sms.message('4155551212', '5558675309', 'Hi Jenny! Want to grab dinner?', 'http://example.com/callback').should eql response
34
34
  WebMock.should have_requested(:post, url)
35
35
  end
36
36
  end
@@ -1,7 +1,7 @@
1
1
  require 'spec_helper'
2
2
 
3
3
  describe "Verb" do
4
-
4
+
5
5
  context "Say" do
6
6
  it "says 'hi'" do
7
7
  Twilio::Verb.say('hi').should match %r{<Say( loop="1"| language="en"| voice="man"){3}>hi</Say>}
@@ -28,7 +28,7 @@ describe "Verb" do
28
28
  v.say 'hi', :loop => 1
29
29
  v.pause
30
30
  v.say 'bye'
31
- }.response.should match %r{<Say( loop="1"| language="en"| voice="man"){3}>hi</Say><Pause></Pause><Say( loop="1"| language="en"| voice="man"){3}>bye</Say>}
31
+ }.response.should match %r{<Say( loop="1"| language="en"| voice="man"){3}>hi</Say><Pause/><Say( loop="1"| language="en"| voice="man"){3}>bye</Say>}
32
32
  end
33
33
 
34
34
  it "says 'hi' with 2 second pause and say 'bye'" do
@@ -37,9 +37,9 @@ describe "Verb" do
37
37
  v.pause :length => 2
38
38
  v.say 'bye'
39
39
  }.response.should match %r{<Say( loop="1"| language="en"| voice="man"){3}>hi</Say><Pause length="2"/><Say( loop="1"| language="en"| voice="man"){3}>bye</Say>}
40
- end
40
+ end
41
41
  end
42
-
42
+
43
43
  context "Play" do
44
44
  it "plays mp3 response" do
45
45
  Twilio::Verb.play('http://foo.com/cowbell.mp3').should == verb_response(:play_mp3)
@@ -53,7 +53,7 @@ describe "Verb" do
53
53
  Twilio::Verb.play('http://foo.com/cowbell.mp3', :loop => 2, :pause => true).should == verb_response(:play_mp3_two_times_with_pause)
54
54
  end
55
55
  end
56
-
56
+
57
57
  context "Gather" do
58
58
  it "gathers" do
59
59
  Twilio::Verb.gather.should == verb_response(:gather)
@@ -210,7 +210,7 @@ describe "Verb" do
210
210
  }.response.should == verb_response(:dial_muted_conference)
211
211
  end
212
212
  end
213
-
213
+
214
214
  context "Hang Up" do
215
215
  it "hangs up" do
216
216
  Twilio::Verb.hangup.should == verb_response(:hangup)
@@ -223,7 +223,7 @@ describe "Verb" do
223
223
  }.response.should match %r{<Say( loop="1"| language="en"| voice="man"){3}>hi</Say><Hangup/>}
224
224
  end
225
225
  end
226
-
226
+
227
227
  context "Reject" do
228
228
  it "rejects" do
229
229
  Twilio::Verb.reject.should == verb_response(:reject)
@@ -241,7 +241,7 @@ describe "Verb" do
241
241
  }.response.should match %r{<Reject reason="busy"/>}
242
242
  end
243
243
  end
244
-
244
+
245
245
  context "SMS" do
246
246
  it "sends a simple SMS message" do
247
247
  verb = Twilio::Verb.new { |v|
@@ -20,11 +20,11 @@ Gem::Specification.new do |s|
20
20
  s.require_paths = ["lib"]
21
21
 
22
22
  s.add_dependency "builder", ">= 2.1.2"
23
- s.add_dependency "httparty", "~> 0.8"
23
+ s.add_dependency "httparty", ">= 0.8"
24
24
 
25
25
  {
26
26
  'rake' => '~> 0.8.7',
27
- 'rspec' => '~> 2.5.0',
27
+ 'rspec' => '~> 2.12',
28
28
  'webmock' => '~> 1.6.2'
29
29
  }.each { |l, v| s. add_development_dependency l, v }
30
30
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: twilio
3
3
  version: !ruby/object:Gem::Version
4
- version: 3.1.0
4
+ version: 3.1.1
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -15,11 +15,11 @@ authors:
15
15
  autorequire:
16
16
  bindir: bin
17
17
  cert_chain: []
18
- date: 2011-11-18 00:00:00.000000000 Z
18
+ date: 2013-01-12 00:00:00.000000000 Z
19
19
  dependencies:
20
20
  - !ruby/object:Gem::Dependency
21
21
  name: builder
22
- requirement: &70110448346600 !ruby/object:Gem::Requirement
22
+ requirement: !ruby/object:Gem::Requirement
23
23
  none: false
24
24
  requirements:
25
25
  - - ! '>='
@@ -27,21 +27,31 @@ dependencies:
27
27
  version: 2.1.2
28
28
  type: :runtime
29
29
  prerelease: false
30
- version_requirements: *70110448346600
30
+ version_requirements: !ruby/object:Gem::Requirement
31
+ none: false
32
+ requirements:
33
+ - - ! '>='
34
+ - !ruby/object:Gem::Version
35
+ version: 2.1.2
31
36
  - !ruby/object:Gem::Dependency
32
37
  name: httparty
33
- requirement: &70110448345880 !ruby/object:Gem::Requirement
38
+ requirement: !ruby/object:Gem::Requirement
34
39
  none: false
35
40
  requirements:
36
- - - ~>
41
+ - - ! '>='
37
42
  - !ruby/object:Gem::Version
38
43
  version: '0.8'
39
44
  type: :runtime
40
45
  prerelease: false
41
- version_requirements: *70110448345880
46
+ version_requirements: !ruby/object:Gem::Requirement
47
+ none: false
48
+ requirements:
49
+ - - ! '>='
50
+ - !ruby/object:Gem::Version
51
+ version: '0.8'
42
52
  - !ruby/object:Gem::Dependency
43
53
  name: rake
44
- requirement: &70110448345060 !ruby/object:Gem::Requirement
54
+ requirement: !ruby/object:Gem::Requirement
45
55
  none: false
46
56
  requirements:
47
57
  - - ~>
@@ -49,21 +59,31 @@ dependencies:
49
59
  version: 0.8.7
50
60
  type: :development
51
61
  prerelease: false
52
- version_requirements: *70110448345060
62
+ version_requirements: !ruby/object:Gem::Requirement
63
+ none: false
64
+ requirements:
65
+ - - ~>
66
+ - !ruby/object:Gem::Version
67
+ version: 0.8.7
53
68
  - !ruby/object:Gem::Dependency
54
69
  name: rspec
55
- requirement: &70110448344600 !ruby/object:Gem::Requirement
70
+ requirement: !ruby/object:Gem::Requirement
56
71
  none: false
57
72
  requirements:
58
73
  - - ~>
59
74
  - !ruby/object:Gem::Version
60
- version: 2.5.0
75
+ version: '2.12'
61
76
  type: :development
62
77
  prerelease: false
63
- version_requirements: *70110448344600
78
+ version_requirements: !ruby/object:Gem::Requirement
79
+ none: false
80
+ requirements:
81
+ - - ~>
82
+ - !ruby/object:Gem::Version
83
+ version: '2.12'
64
84
  - !ruby/object:Gem::Dependency
65
85
  name: webmock
66
- requirement: &70110448344160 !ruby/object:Gem::Requirement
86
+ requirement: !ruby/object:Gem::Requirement
67
87
  none: false
68
88
  requirements:
69
89
  - - ~>
@@ -71,7 +91,12 @@ dependencies:
71
91
  version: 1.6.2
72
92
  type: :development
73
93
  prerelease: false
74
- version_requirements: *70110448344160
94
+ version_requirements: !ruby/object:Gem::Requirement
95
+ none: false
96
+ requirements:
97
+ - - ~>
98
+ - !ruby/object:Gem::Version
99
+ version: 1.6.2
75
100
  description: Twilio API wrapper
76
101
  email:
77
102
  - github@webficient.com
@@ -157,7 +182,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
157
182
  version: '0'
158
183
  segments:
159
184
  - 0
160
- hash: -1539534090918622271
185
+ hash: 2539554735793806744
161
186
  required_rubygems_version: !ruby/object:Gem::Requirement
162
187
  none: false
163
188
  requirements:
@@ -166,10 +191,10 @@ required_rubygems_version: !ruby/object:Gem::Requirement
166
191
  version: '0'
167
192
  segments:
168
193
  - 0
169
- hash: -1539534090918622271
194
+ hash: 2539554735793806744
170
195
  requirements: []
171
196
  rubyforge_project: twilio
172
- rubygems_version: 1.8.10
197
+ rubygems_version: 1.8.24
173
198
  signing_key:
174
199
  specification_version: 3
175
200
  summary: Twilio API Client