twilio 2.3.0 → 2.4.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
data/.gitignore ADDED
@@ -0,0 +1,5 @@
1
+ *.sw?
2
+ .DS_Store
3
+ coverage
4
+ rdoc
5
+ pkg
data/Rakefile CHANGED
@@ -1,4 +1,3 @@
1
- require 'rubygems'
2
1
  require 'rake'
3
2
 
4
3
  begin
@@ -9,8 +8,8 @@ begin
9
8
  gem.email = "github@webficient.com"
10
9
  gem.homepage = "http://github.com/webficient/twilio"
11
10
  gem.authors = ["Phil Misiowiec"]
12
- gem.add_dependency 'builder'
13
- gem.add_dependency 'httparty'
11
+ gem.add_dependency 'builder', '>= 2.1.2'
12
+ gem.add_dependency 'httparty', '>= 0.4.3'
14
13
  end
15
14
  rescue LoadError
16
15
  puts "Jeweler not available. Install it with: sudo gem install technicalpickles-jeweler -s http://gems.github.com"
data/VERSION.yml CHANGED
@@ -1,4 +1,4 @@
1
1
  ---
2
2
  :patch: 0
3
3
  :major: 2
4
- :minor: 3
4
+ :minor: 4
data/lib/twilio.rb CHANGED
@@ -1,5 +1,3 @@
1
- $:.unshift(File.dirname(__FILE__))
2
-
3
1
  #--
4
2
  # Copyright (c) 2009 Phil Misiowiec, phil@webficient.com
5
3
  #
@@ -23,12 +21,8 @@ $:.unshift(File.dirname(__FILE__))
23
21
  # WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
24
22
  #++
25
23
 
26
- require 'rubygems'
27
- gem 'httparty', '>= 0.4.3'
28
24
  require 'httparty'
29
- gem 'builder', '>= 2.1.2'
30
25
  require 'builder'
31
-
32
26
  require 'twilio/twilio_object'
33
27
  require 'twilio/account'
34
28
  require 'twilio/call'
@@ -1,30 +1,3 @@
1
- say_hi:
2
- response: <?xml version="1.0" encoding="UTF-8"?><Response><Say loop="1" language="en" voice="man">hi</Say></Response>
3
-
4
- say_hi_with_female_voice:
5
- response: <?xml version="1.0" encoding="UTF-8"?><Response><Say loop="1" language="en" voice="woman">hi</Say></Response>
6
-
7
- say_hi_in_spanish_with_female_voice:
8
- response: <?xml version="1.0" encoding="UTF-8"?><Response><Say loop="1" language="es" voice="woman">hola</Say></Response>
9
-
10
- say_hi_three_times:
11
- response: <?xml version="1.0" encoding="UTF-8"?><Response><Say loop="3" language="en" voice="man">hi</Say></Response>
12
-
13
- say_hi_three_times_with_pause:
14
- response: <?xml version="1.0" encoding="UTF-8"?><Response><Say language="en" voice="man">hi</Say><Pause/><Say language="en" voice="man">hi</Say><Pause/><Say language="en" voice="man">hi</Say></Response>
15
-
16
- say_hi_with_pause:
17
- response: <?xml version="1.0" encoding="UTF-8"?><Response><Say loop="1" language="en" voice="man">hi</Say><Pause/></Response>
18
-
19
- say_hi_with_pause_and_say_bye:
20
- response: <?xml version="1.0" encoding="UTF-8"?><Response><Say loop="1" language="en" voice="man">hi</Say><Pause></Pause><Say loop="1" language="en" voice="man">bye</Say></Response>
21
-
22
- say_hi_with_2_second_pause_and_say_bye:
23
- response: <?xml version="1.0" encoding="UTF-8"?><Response><Say loop="1" language="en" voice="man">hi</Say><Pause length="2"/><Say loop="1" language="en" voice="man">bye</Say></Response>
24
-
25
- say_hi_and_hangup:
26
- response: <?xml version="1.0" encoding="UTF-8"?><Response><Say loop="1" language="en" voice="man">hi</Say><Hangup/></Response>
27
-
28
1
  play_mp3:
29
2
  response: <?xml version="1.0" encoding="UTF-8"?><Response><Play loop="1">http://foo.com/cowbell.mp3</Play></Response>
30
3
 
@@ -52,15 +25,6 @@ gather_with_finish_key:
52
25
  gather_with_num_digits:
53
26
  response: <?xml version="1.0" encoding="UTF-8"?><Response><Gather numDigits="5"/></Response>
54
27
 
55
- gather_with_all_options_set:
56
- response: <?xml version="1.0" encoding="UTF-8"?><Response><Gather finishOnKey="*" action="http://foobar.com" method="GET" numDigits="5" timeout="10"/></Response>
57
-
58
- gather_and_say_instructions:
59
- response: <?xml version="1.0" encoding="UTF-8"?><Response><Gather><Say loop="1" language="en" voice="man">Please enter your account number followed by the pound sign</Say></Gather><Say loop="1" language="en" voice="man">We didn't receive any input. Goodbye!</Say></Response>
60
-
61
- gather_with_timeout_and_say_instructions:
62
- response: <?xml version="1.0" encoding="UTF-8"?><Response><Gather timeout="10"><Say loop="1" language="en" voice="man">Please enter your account number followed by the pound sign</Say></Gather><Say loop="1" language="en" voice="man">We didn't receive any input. Goodbye!</Say></Response>
63
-
64
28
  record:
65
29
  response: <?xml version="1.0" encoding="UTF-8"?><Response><Record></Record></Response>
66
30
 
@@ -78,9 +42,6 @@ record_with_finish_key:
78
42
 
79
43
  record_with_max_length:
80
44
  response: <?xml version="1.0" encoding="UTF-8"?><Response><Record maxLength="1800"/></Response>
81
-
82
- record_with_transcribe:
83
- response: <?xml version="1.0" encoding="UTF-8"?><Response><Record transcribe="true" transcribeCallback="/handle_transcribe"/></Response>
84
45
 
85
46
  dial:
86
47
  response: <?xml version="1.0" encoding="UTF-8"?><Response><Dial>415-123-4567</Dial></Response>
@@ -103,9 +64,6 @@ dial_with_time_limit:
103
64
  dial_with_caller_id:
104
65
  response: <?xml version="1.0" encoding="UTF-8"?><Response><Dial callerId="858-987-6543">415-123-4567</Dial></Response>
105
66
 
106
- dial_with_timeout_and_caller_id:
107
- response: <?xml version="1.0" encoding="UTF-8"?><Response><Dial callerId="858-987-6543" timeout="10">415-123-4567</Dial></Response>
108
-
109
67
  dial_with_redirect:
110
68
  response: <?xml version="1.0" encoding="UTF-8"?><Response><Dial>415-123-4567</Dial><Redirect>http://www.foo.com/nextInstructions</Redirect></Response>
111
69
 
data/test/test_helper.rb CHANGED
@@ -1,16 +1,11 @@
1
- require 'rubygems'
2
1
  require 'test/unit'
3
2
  require 'fakeweb'
4
3
  require 'shoulda'
5
- require 'matchy'
6
4
  require 'yaml'
5
+ require 'twilio'
7
6
 
8
7
  FakeWeb.allow_net_connect = false
9
8
 
10
- $LOAD_PATH.unshift(File.join(File.dirname(__FILE__), '..', 'lib'))
11
- $LOAD_PATH.unshift(File.dirname(__FILE__))
12
- require 'twilio'
13
-
14
9
  class Test::Unit::TestCase #:nodoc: all
15
10
  end
16
11
 
@@ -3,23 +3,28 @@ require File.dirname(__FILE__) + '/../test_helper'
3
3
  class VerbTest < Test::Unit::TestCase #:nodoc: all
4
4
  context "A Twilio Verb" do
5
5
  should "say 'hi'" do
6
- assert_equal verb_response(:say_hi), Twilio::Verb.say('hi')
6
+ assert_match %r{<Say( loop="1"| language="en"| voice="man"){3}>hi</Say>},
7
+ Twilio::Verb.say('hi')
7
8
  end
8
9
 
9
10
  should "say 'hi' with female voice" do
10
- assert_equal verb_response(:say_hi_with_female_voice), Twilio::Verb.say('hi', :voice => 'woman')
11
+ assert_match %r{<Say( loop="1"| language="en"| voice="woman"){3}>hi</Say>},
12
+ Twilio::Verb.say('hi', :voice => 'woman')
11
13
  end
12
14
 
13
15
  should "say 'hola' in Spanish with female voice" do
14
- assert_equal verb_response(:say_hi_in_spanish_with_female_voice), Twilio::Verb.say('hola', {:voice => 'woman', :language => 'es'})
16
+ assert_match %r{<Say( loop="1"| language="es"| voice="woman"){3}>hola</Say>},
17
+ Twilio::Verb.say('hola', {:voice => 'woman', :language => 'es'})
15
18
  end
16
19
 
17
20
  should "say 'hi' three times" do
18
- assert_equal verb_response(:say_hi_three_times), Twilio::Verb.say('hi', :loop => 3)
21
+ assert_match %r{<Say( loop="3"| language="en"| voice="man"){3}>hi</Say>},
22
+ Twilio::Verb.say('hi', :loop => 3)
19
23
  end
20
24
 
21
25
  should "say 'hi' three times with pause" do
22
- assert_equal verb_response(:say_hi_three_times_with_pause), Twilio::Verb.say('hi', :loop => 3, :pause => true)
26
+ assert_match %r{<Say( language="en"| voice="man"){2}>hi</Say><Pause/><Say( language="en"| voice="man"){2}>hi</Say><Pause/><Say( language="en"| voice="man"){2}>hi</Say>},
27
+ Twilio::Verb.say('hi', :loop => 3, :pause => true)
23
28
  end
24
29
 
25
30
  should "say 'hi' with pause and say 'bye'" do
@@ -28,7 +33,7 @@ class VerbTest < Test::Unit::TestCase #:nodoc: all
28
33
  v.pause
29
34
  v.say('bye')
30
35
  }
31
- assert_equal verb_response(:say_hi_with_pause_and_say_bye), verb.response
36
+ assert_match %r{<Say( loop="1"| language="en"| voice="man"){3}>hi</Say><Pause></Pause><Say( loop="1"| language="en"| voice="man"){3}>bye</Say>}, verb.response
32
37
  end
33
38
 
34
39
  should "say 'hi' with 2 second pause and say 'bye'" do
@@ -37,7 +42,7 @@ class VerbTest < Test::Unit::TestCase #:nodoc: all
37
42
  v.pause(:length => 2)
38
43
  v.say('bye')
39
44
  }
40
- assert_equal verb_response(:say_hi_with_2_second_pause_and_say_bye), verb.response
45
+ assert_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>}, verb.response
41
46
  end
42
47
 
43
48
  should "play mp3 response" do
@@ -77,7 +82,12 @@ class VerbTest < Test::Unit::TestCase #:nodoc: all
77
82
  end
78
83
 
79
84
  should "gather with all options set" do
80
- assert_equal verb_response(:gather_with_all_options_set), Twilio::Verb.gather(:action => 'http://foobar.com', :method => 'GET', :timeout => 10, :finishOnKey => '*', :numDigits => 5)
85
+ verb_response = Twilio::Verb.gather :action => 'http://foobar.com',
86
+ :finishOnKey => '*',
87
+ :method => 'GET',
88
+ :numDigits => 5,
89
+ :timeout => 10
90
+ assert_match %r{<Gather( finishOnKey="\*"| action="http://foobar.com"| method="GET"| numDigits="5"| timeout="10"){5}/>}, verb_response
81
91
  end
82
92
 
83
93
  should "gather and say instructions" do
@@ -87,7 +97,7 @@ class VerbTest < Test::Unit::TestCase #:nodoc: all
87
97
  }
88
98
  v.say("We didn't receive any input. Goodbye!")
89
99
  }
90
- assert_equal verb_response(:gather_and_say_instructions), verb.response
100
+ assert_match %r{<Gather><Say( loop="1"| language="en"| voice="man"){3}>Please enter your account number followed by the pound sign</Say></Gather><Say( loop="1"| language="en"| voice="man"){3}>We didn't receive any input. Goodbye!</Say>}, verb.response
91
101
  end
92
102
 
93
103
  should "gather with timeout and say instructions" do
@@ -97,7 +107,7 @@ class VerbTest < Test::Unit::TestCase #:nodoc: all
97
107
  }
98
108
  v.say("We didn't receive any input. Goodbye!")
99
109
  }
100
- assert_equal verb_response(:gather_with_timeout_and_say_instructions), verb.response
110
+ assert_match %r{<Gather timeout="10"><Say( loop="1"| language="en"| voice="man"){3}>Please enter your account number followed by the pound sign</Say></Gather><Say( loop="1"| language="en"| voice="man"){3}>We didn't receive any input. Goodbye!</Say>}, verb.response
101
111
  end
102
112
 
103
113
  should "record" do
@@ -125,7 +135,8 @@ class VerbTest < Test::Unit::TestCase #:nodoc: all
125
135
  end
126
136
 
127
137
  should "record with transcribe" do
128
- assert_equal verb_response(:record_with_transcribe), Twilio::Verb.record(:transcribe => true, :transcribeCallback => '/handle_transcribe')
138
+ assert_match %r{<Record( transcribe="true"| transcribeCallback="/handle_transcribe"){2}/>},
139
+ Twilio::Verb.record(:transcribe => true, :transcribeCallback => '/handle_transcribe')
129
140
  end
130
141
 
131
142
  should "dial" do
@@ -157,7 +168,11 @@ class VerbTest < Test::Unit::TestCase #:nodoc: all
157
168
  end
158
169
 
159
170
  should "dial with timeout and caller id" do
160
- assert_equal verb_response(:dial_with_timeout_and_caller_id), Twilio::Verb.dial('415-123-4567', {:timeout => 10, :callerId => '858-987-6543'})
171
+ assert_match %r{<Dial( timeout="10"| callerId="858-987-6543"){2}>415-123-4567</Dial>},
172
+ Twilio::Verb.dial('415-123-4567', {
173
+ :timeout => 10,
174
+ :callerId => '858-987-6543' }
175
+ )
161
176
  end
162
177
 
163
178
  should "dial with redirect" do
@@ -197,7 +212,8 @@ class VerbTest < Test::Unit::TestCase #:nodoc: all
197
212
  v.say('hi')
198
213
  v.hangup
199
214
  }
200
- assert_equal verb_response(:say_hi_and_hangup), verb.response
215
+ assert_match %r{<Say( loop="1"| language="en"| voice="man"){3}>hi</Say><Hangup/>},
216
+ verb.response
201
217
  end
202
218
  end
203
219
 
data/twilio.gemspec ADDED
@@ -0,0 +1,100 @@
1
+ # Generated by jeweler
2
+ # DO NOT EDIT THIS FILE
3
+ # Instead, edit Jeweler::Tasks in Rakefile, and run `rake gemspec`
4
+ # -*- encoding: utf-8 -*-
5
+
6
+ Gem::Specification.new do |s|
7
+ s.name = %q{twilio}
8
+ s.version = "2.4.0"
9
+
10
+ s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
+ s.authors = ["Phil Misiowiec"]
12
+ s.date = %q{2009-09-03}
13
+ s.email = %q{github@webficient.com}
14
+ s.extra_rdoc_files = [
15
+ "LICENSE",
16
+ "README.rdoc"
17
+ ]
18
+ s.files = [
19
+ ".gitignore",
20
+ "LICENSE",
21
+ "README.rdoc",
22
+ "Rakefile",
23
+ "VERSION.yml",
24
+ "lib/twilio.rb",
25
+ "lib/twilio/account.rb",
26
+ "lib/twilio/call.rb",
27
+ "lib/twilio/connection.rb",
28
+ "lib/twilio/incoming_phone_number.rb",
29
+ "lib/twilio/local_phone_number.rb",
30
+ "lib/twilio/notification.rb",
31
+ "lib/twilio/outgoing_caller_id.rb",
32
+ "lib/twilio/recording.rb",
33
+ "lib/twilio/toll_free_phone_number.rb",
34
+ "lib/twilio/twilio_object.rb",
35
+ "lib/twilio/verb.rb",
36
+ "test/fixtures/xml/account.xml",
37
+ "test/fixtures/xml/account_renamed.xml",
38
+ "test/fixtures/xml/call.xml",
39
+ "test/fixtures/xml/call_new.xml",
40
+ "test/fixtures/xml/calls.xml",
41
+ "test/fixtures/xml/incoming_phone_number.xml",
42
+ "test/fixtures/xml/incoming_phone_numbers.xml",
43
+ "test/fixtures/xml/notification.xml",
44
+ "test/fixtures/xml/notifications.xml",
45
+ "test/fixtures/xml/outgoing_caller_id.xml",
46
+ "test/fixtures/xml/outgoing_caller_id_new.xml",
47
+ "test/fixtures/xml/outgoing_caller_ids.xml",
48
+ "test/fixtures/xml/recording.xml",
49
+ "test/fixtures/xml/recordings.xml",
50
+ "test/fixtures/xml/transcription.xml",
51
+ "test/fixtures/xml/transcriptions.xml",
52
+ "test/fixtures/yml/verb_responses.yml",
53
+ "test/test_helper.rb",
54
+ "test/twilio/account_test.rb",
55
+ "test/twilio/call_test.rb",
56
+ "test/twilio/connection_test.rb",
57
+ "test/twilio/incoming_phone_number_test.rb",
58
+ "test/twilio/local_phone_number_test.rb",
59
+ "test/twilio/notification_test.rb",
60
+ "test/twilio/outgoing_caller_id_test.rb",
61
+ "test/twilio/recording_test.rb",
62
+ "test/twilio/toll_free_phone_number_test.rb",
63
+ "test/twilio/verb_test.rb",
64
+ "twilio.gemspec"
65
+ ]
66
+ s.homepage = %q{http://github.com/webficient/twilio}
67
+ s.rdoc_options = ["--charset=UTF-8"]
68
+ s.require_paths = ["lib"]
69
+ s.rubygems_version = %q{1.3.5}
70
+ s.summary = %q{Twilio API Client}
71
+ s.test_files = [
72
+ "test/test_helper.rb",
73
+ "test/twilio/account_test.rb",
74
+ "test/twilio/call_test.rb",
75
+ "test/twilio/connection_test.rb",
76
+ "test/twilio/incoming_phone_number_test.rb",
77
+ "test/twilio/local_phone_number_test.rb",
78
+ "test/twilio/notification_test.rb",
79
+ "test/twilio/outgoing_caller_id_test.rb",
80
+ "test/twilio/recording_test.rb",
81
+ "test/twilio/toll_free_phone_number_test.rb",
82
+ "test/twilio/verb_test.rb"
83
+ ]
84
+
85
+ if s.respond_to? :specification_version then
86
+ current_version = Gem::Specification::CURRENT_SPECIFICATION_VERSION
87
+ s.specification_version = 3
88
+
89
+ if Gem::Version.new(Gem::RubyGemsVersion) >= Gem::Version.new('1.2.0') then
90
+ s.add_runtime_dependency(%q<builder>, [">= 2.1.2"])
91
+ s.add_runtime_dependency(%q<httparty>, [">= 0.4.3"])
92
+ else
93
+ s.add_dependency(%q<builder>, [">= 2.1.2"])
94
+ s.add_dependency(%q<httparty>, [">= 0.4.3"])
95
+ end
96
+ else
97
+ s.add_dependency(%q<builder>, [">= 2.1.2"])
98
+ s.add_dependency(%q<httparty>, [">= 0.4.3"])
99
+ end
100
+ 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: 2.3.0
4
+ version: 2.4.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Phil Misiowiec
@@ -9,7 +9,7 @@ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
11
 
12
- date: 2009-06-22 00:00:00 -07:00
12
+ date: 2009-09-03 00:00:00 -07:00
13
13
  default_executable:
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
@@ -20,7 +20,7 @@ dependencies:
20
20
  requirements:
21
21
  - - ">="
22
22
  - !ruby/object:Gem::Version
23
- version: "0"
23
+ version: 2.1.2
24
24
  version:
25
25
  - !ruby/object:Gem::Dependency
26
26
  name: httparty
@@ -30,7 +30,7 @@ dependencies:
30
30
  requirements:
31
31
  - - ">="
32
32
  - !ruby/object:Gem::Version
33
- version: "0"
33
+ version: 0.4.3
34
34
  version:
35
35
  description:
36
36
  email: github@webficient.com
@@ -42,6 +42,7 @@ extra_rdoc_files:
42
42
  - LICENSE
43
43
  - README.rdoc
44
44
  files:
45
+ - .gitignore
45
46
  - LICENSE
46
47
  - README.rdoc
47
48
  - Rakefile
@@ -86,6 +87,7 @@ files:
86
87
  - test/twilio/recording_test.rb
87
88
  - test/twilio/toll_free_phone_number_test.rb
88
89
  - test/twilio/verb_test.rb
90
+ - twilio.gemspec
89
91
  has_rdoc: true
90
92
  homepage: http://github.com/webficient/twilio
91
93
  licenses: []
@@ -112,7 +114,7 @@ requirements: []
112
114
  rubyforge_project:
113
115
  rubygems_version: 1.3.5
114
116
  signing_key:
115
- specification_version: 2
117
+ specification_version: 3
116
118
  summary: Twilio API Client
117
119
  test_files:
118
120
  - test/test_helper.rb