twilio 2.5.0 → 2.6.0

Sign up to get free protection for your applications and to get access to all the features.
data/README.rdoc CHANGED
@@ -28,9 +28,9 @@ For example, in a Ruby on Rails application, you could do the following inside a
28
28
 
29
29
  and you can nest multiple verbs inside a block:
30
30
 
31
- verb = Twilio::Verb.new {
32
- say "The time is #{Time.now}"
33
- hangup
31
+ verb = Twilio::Verb.new { |v|
32
+ v.say "The time is #{Time.now}"
33
+ v.hangup
34
34
  }
35
35
  verb.response
36
36
 
@@ -46,4 +46,5 @@ Copyright (c) 2009 Phil Misiowiec, Webficient LLC. See LICENSE for details.
46
46
 
47
47
  == Contributors
48
48
 
49
+ Alex K Wolfe
49
50
  Jonathan Rudenberg
data/Rakefile CHANGED
@@ -7,7 +7,7 @@ begin
7
7
  gem.summary = %Q{Twilio API Client}
8
8
  gem.email = "github@webficient.com"
9
9
  gem.homepage = "http://github.com/webficient/twilio"
10
- gem.authors = ["Phil Misiowiec"]
10
+ gem.authors = ["Phil Misiowiec", "Alex K Wolfe"]
11
11
  gem.add_dependency 'builder', '>= 2.1.2'
12
12
  gem.add_dependency 'httparty', '>= 0.4.3'
13
13
  end
data/VERSION.yml CHANGED
@@ -1,4 +1,5 @@
1
1
  ---
2
- :minor: 5
3
2
  :patch: 0
4
3
  :major: 2
4
+ :minor: 6
5
+ :build:
data/lib/twilio/verb.rb CHANGED
@@ -9,9 +9,9 @@ module Twilio
9
9
  #
10
10
  # But if you need to chain several verbs together, just wrap them in an instance block and call the 'response' attribute:
11
11
  #
12
- # verb = Twilio::Verb.new {
13
- # dial '415-123-4567'
14
- # redirect 'http://www.foo.com/nextInstructions'
12
+ # verb = Twilio::Verb.new { |v|
13
+ # v.dial '415-123-4567'
14
+ # v.redirect 'http://www.foo.com/nextInstructions'
15
15
  # }
16
16
  # verb.response
17
17
  class Verb
@@ -31,7 +31,7 @@ module Twilio
31
31
 
32
32
  if block_given?
33
33
  @chain = true
34
- @response = @xml.Response { instance_eval(&block) }
34
+ @response = @xml.Response { block.call(self) }
35
35
  end
36
36
  end
37
37
 
@@ -131,18 +131,18 @@ module Twilio
131
131
  #
132
132
  # Gather also lets you nest the Play, Say, and Pause verbs:
133
133
  #
134
- # verb = Twilio::Verb.new {
135
- # gather(:action => '/process_gather', :method => 'GET) {
136
- # say 'Please enter your account number followed by the pound sign'
134
+ # verb = Twilio::Verb.new { |v|
135
+ # v.gather(:action => '/process_gather', :method => 'GET) {
136
+ # v.say 'Please enter your account number followed by the pound sign'
137
137
  # }
138
- # say "We didn't receive any input. Goodbye!"
138
+ # v.say "We didn't receive any input. Goodbye!"
139
139
  # }
140
140
  # verb.response # represents the final xml output
141
141
  def gather(*args, &block)
142
142
  options = args.shift || {}
143
143
  output {
144
144
  if block_given?
145
- @xml.Gather(options) { block.call }
145
+ @xml.Gather(options) { block.call}
146
146
  else
147
147
  @xml.Gather(options)
148
148
  end
@@ -185,11 +185,11 @@ module Twilio
185
185
  #
186
186
  # Twilio also supports an alternate form in which a Number object is nested inside Dial:
187
187
  #
188
- # verb = Twilio::Verb.new {
189
- # dial {
190
- # number '415-123-4567'
191
- # number '415-123-4568'
192
- # number '415-123-4569'
188
+ # verb = Twilio::Verb.new { |v|
189
+ # v.dial { |v|
190
+ # v.number '415-123-4567'
191
+ # v.number '415-123-4568'
192
+ # v.number '415-123-4569'
193
193
  # }
194
194
  # }
195
195
  # verb.response # represents the final xml output
@@ -224,9 +224,9 @@ module Twilio
224
224
  # Options (see http://www.twilio.com/docs/api_reference/TwiML/conference) are passed in as a hash
225
225
  #
226
226
  # Examples:
227
- # verb = Twilio::Verb.new {
228
- # dial {
229
- # conference 'MyRoom', :muted => true
227
+ # verb = Twilio::Verb.new { |v|
228
+ # v.dial {
229
+ # v.conference 'MyRoom', :muted => true
230
230
  # }
231
231
  # }
232
232
  # verb.response
@@ -253,10 +253,10 @@ module Twilio
253
253
  # Options (see http://www.twilio.com/docs/api_reference/TwiML/pause) are passed in as a hash
254
254
  #
255
255
  # Examples:
256
- # verb = Twilio::Verb.new {
257
- # say 'greetings'
258
- # pause :length => 2
259
- # say 'have a nice day'
256
+ # verb = Twilio::Verb.new { |v|
257
+ # v.say 'greetings'
258
+ # v.pause :length => 2
259
+ # v.say 'have a nice day'
260
260
  # }
261
261
  # verb.response
262
262
  def pause(*args)
@@ -270,9 +270,9 @@ module Twilio
270
270
  # Options (see http://www.twilio.com/docs/api_reference/TwiML/redirect) are passed in as a hash
271
271
  #
272
272
  # Examples:
273
- # verb = Twilio::Verb.new {
274
- # dial '415-123-4567'
275
- # redirect 'http://www.foo.com/nextInstructions'
273
+ # verb = Twilio::Verb.new { |v|
274
+ # v.dial '415-123-4567'
275
+ # v.redirect 'http://www.foo.com/nextInstructions'
276
276
  # }
277
277
  # verb.response
278
278
  def redirect(*args)
@@ -301,9 +301,9 @@ module Twilio
301
301
  #
302
302
  # If your response is chained:
303
303
  #
304
- # verb = Twilio::Verb.new {
305
- # say "The time is #{Time.now}"
306
- # hangup
304
+ # verb = Twilio::Verb.new { |v|
305
+ # v.say "The time is #{Time.now}"
306
+ # v.hangup
307
307
  # }
308
308
  # verb.response
309
309
  def hangup
@@ -28,19 +28,19 @@ class VerbTest < Test::Unit::TestCase #:nodoc: all
28
28
  end
29
29
 
30
30
  should "say 'hi' with pause and say 'bye'" do
31
- verb = Twilio::Verb.new {
32
- say 'hi', :loop => 1
33
- pause
34
- say 'bye'
31
+ verb = Twilio::Verb.new { |v|
32
+ v.say 'hi', :loop => 1
33
+ v.pause
34
+ v.say 'bye'
35
35
  }
36
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
37
37
  end
38
38
 
39
39
  should "say 'hi' with 2 second pause and say 'bye'" do
40
- verb = Twilio::Verb.new {
41
- say 'hi'
42
- pause :length => 2
43
- say 'bye'
40
+ verb = Twilio::Verb.new { |v|
41
+ v.say 'hi'
42
+ v.pause :length => 2
43
+ v.say 'bye'
44
44
  }
45
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
46
46
  end
@@ -92,21 +92,21 @@ class VerbTest < Test::Unit::TestCase #:nodoc: all
92
92
  end
93
93
 
94
94
  should "gather and say instructions" do
95
- verb = Twilio::Verb.new {
96
- gather {
97
- say 'Please enter your account number followed by the pound sign'
95
+ verb = Twilio::Verb.new { |v|
96
+ v.gather {
97
+ v.say 'Please enter your account number followed by the pound sign'
98
98
  }
99
- say "We didn't receive any input. Goodbye!"
99
+ v.say "We didn't receive any input. Goodbye!"
100
100
  }
101
101
  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
102
102
  end
103
103
 
104
104
  should "gather with timeout and say instructions" do
105
- verb = Twilio::Verb.new {
106
- gather(:timeout => 10) {
107
- say 'Please enter your account number followed by the pound sign'
105
+ verb = Twilio::Verb.new { |v|
106
+ v.gather(:timeout => 10) {
107
+ v.say 'Please enter your account number followed by the pound sign'
108
108
  }
109
- say "We didn't receive any input. Goodbye!"
109
+ v.say "We didn't receive any input. Goodbye!"
110
110
  }
111
111
  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
112
112
  end
@@ -174,46 +174,46 @@ class VerbTest < Test::Unit::TestCase #:nodoc: all
174
174
  end
175
175
 
176
176
  should "dial with redirect" do
177
- verb = Twilio::Verb.new {
178
- dial '415-123-4567'
179
- redirect 'http://www.foo.com/nextInstructions'
177
+ verb = Twilio::Verb.new { |v|
178
+ v.dial '415-123-4567'
179
+ v.redirect 'http://www.foo.com/nextInstructions'
180
180
  }
181
181
  assert_equal verb_response(:dial_with_redirect), verb.response
182
182
  end
183
183
 
184
184
  should "dial with number and send digits" do
185
- verb = Twilio::Verb.new {
186
- dial {
187
- number('415-123-4567', :sendDigits => 'wwww1928')
185
+ verb = Twilio::Verb.new { |v|
186
+ v.dial {
187
+ v.number('415-123-4567', :sendDigits => 'wwww1928')
188
188
  }
189
189
  }
190
190
  assert_equal verb_response(:dial_with_number_and_send_digits), verb.response
191
191
  end
192
192
 
193
193
  should "dial multiple numbers" do
194
- verb = Twilio::Verb.new {
195
- dial {
196
- number '415-123-4567'
197
- number '415-123-4568'
198
- number '415-123-4569'
194
+ verb = Twilio::Verb.new { |v|
195
+ v.dial {
196
+ v.number '415-123-4567'
197
+ v.number '415-123-4568'
198
+ v.number '415-123-4569'
199
199
  }
200
200
  }
201
201
  assert_equal verb_response(:dial_multiple_numbers), verb.response
202
202
  end
203
203
 
204
204
  should "dial a conference" do
205
- verb = Twilio::Verb.new {
206
- dial {
207
- conference 'MyRoom'
205
+ verb = Twilio::Verb.new { |v|
206
+ v.dial {
207
+ v.conference 'MyRoom'
208
208
  }
209
209
  }
210
210
  assert_equal verb_response(:dial_conference), verb.response
211
211
  end
212
212
 
213
213
  should "dial a muted conference" do
214
- verb = Twilio::Verb.new {
215
- dial {
216
- conference 'MyRoom', :mute => :true
214
+ verb = Twilio::Verb.new { |v|
215
+ v.dial {
216
+ v.conference 'MyRoom', :mute => :true
217
217
  }
218
218
  }
219
219
  assert_equal verb_response(:dial_muted_conference), verb.response
@@ -224,9 +224,9 @@ class VerbTest < Test::Unit::TestCase #:nodoc: all
224
224
  end
225
225
 
226
226
  should "say hi and hangup" do
227
- verb = Twilio::Verb.new {
228
- say 'hi'
229
- hangup
227
+ verb = Twilio::Verb.new { |v|
228
+ v.say 'hi'
229
+ v.hangup
230
230
  }
231
231
  assert_match %r{<Say( loop="1"| language="en"| voice="man"){3}>hi</Say><Hangup/>},
232
232
  verb.response
data/twilio.gemspec CHANGED
@@ -1,15 +1,15 @@
1
1
  # Generated by jeweler
2
- # DO NOT EDIT THIS FILE
3
- # Instead, edit Jeweler::Tasks in Rakefile, and run `rake gemspec`
2
+ # DO NOT EDIT THIS FILE DIRECTLY
3
+ # Instead, edit Jeweler::Tasks in Rakefile, and run the gemspec command
4
4
  # -*- encoding: utf-8 -*-
5
5
 
6
6
  Gem::Specification.new do |s|
7
7
  s.name = %q{twilio}
8
- s.version = "2.5.0"
8
+ s.version = "2.6.0"
9
9
 
10
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-11-28}
11
+ s.authors = ["Phil Misiowiec", "Alex K Wolfe"]
12
+ s.date = %q{2010-02-11}
13
13
  s.email = %q{github@webficient.com}
14
14
  s.extra_rdoc_files = [
15
15
  "LICENSE",
@@ -107,3 +107,4 @@ Gem::Specification.new do |s|
107
107
  s.add_dependency(%q<httparty>, [">= 0.4.3"])
108
108
  end
109
109
  end
110
+
metadata CHANGED
@@ -1,15 +1,16 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: twilio
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.5.0
4
+ version: 2.6.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Phil Misiowiec
8
+ - Alex K Wolfe
8
9
  autorequire:
9
10
  bindir: bin
10
11
  cert_chain: []
11
12
 
12
- date: 2009-11-28 00:00:00 -08:00
13
+ date: 2010-02-11 00:00:00 -08:00
13
14
  default_executable:
14
15
  dependencies:
15
16
  - !ruby/object:Gem::Dependency