twilio 2.7.0 → 2.8.0
Sign up to get free protection for your applications and to get access to all the features.
- data/LICENSE +1 -1
- data/README.rdoc +2 -1
- data/Rakefile +1 -1
- data/VERSION.yml +1 -1
- data/lib/twilio/local_phone_number.rb +7 -2
- data/lib/twilio/sms.rb +4 -3
- data/lib/twilio/toll_free_phone_number.rb +5 -0
- data/test/fixtures/xml/sms_new_with_callback.xml +15 -0
- data/test/twilio/local_phone_number_test.rb +6 -0
- data/test/twilio/sms_test.rb +4 -0
- data/test/twilio/toll_free_phone_number_test.rb +7 -0
- data/twilio.gemspec +6 -5
- metadata +39 -13
data/LICENSE
CHANGED
data/README.rdoc
CHANGED
@@ -42,10 +42,11 @@ If you need to tweak the source code, clone this repository and do a rake build
|
|
42
42
|
|
43
43
|
== Copyright
|
44
44
|
|
45
|
-
Copyright (c) 2009 Phil Misiowiec, Webficient LLC. See LICENSE for details.
|
45
|
+
Copyright (c) 2009-2010 Phil Misiowiec, Webficient LLC. See LICENSE for details.
|
46
46
|
|
47
47
|
== Contributors
|
48
48
|
|
49
49
|
Kyle Daigle
|
50
50
|
Jonathan Rudenberg
|
51
|
+
Jeff Wigal
|
51
52
|
Alex K Wolfe
|
data/Rakefile
CHANGED
@@ -8,7 +8,7 @@ begin
|
|
8
8
|
gem.description = %Q{Twilio API wrapper}
|
9
9
|
gem.email = "github@webficient.com"
|
10
10
|
gem.homepage = "http://github.com/webficient/twilio"
|
11
|
-
gem.authors = ["Phil Misiowiec", "Jonathan Rudenberg", "Alex K Wolfe", "Kyle Daigle"]
|
11
|
+
gem.authors = ["Phil Misiowiec", "Jonathan Rudenberg", "Alex K Wolfe", "Kyle Daigle", "Jeff Wigal"]
|
12
12
|
gem.add_dependency 'builder', '>= 2.1.2'
|
13
13
|
gem.add_dependency 'httparty', '>= 0.4.3'
|
14
14
|
end
|
data/VERSION.yml
CHANGED
@@ -5,17 +5,22 @@ module Twilio
|
|
5
5
|
# Twilio.connect('my_twilio_sid', 'my_auth_token')
|
6
6
|
# Twilio::LocalPhoneNumber.list
|
7
7
|
class LocalPhoneNumber < TwilioObject
|
8
|
-
def create(url, area_code = nil, method = 'POST', friendly_name = nil)
|
8
|
+
def create(url, area_code = nil, method = 'POST', friendly_name = nil, options = {})
|
9
9
|
Twilio.post("/IncomingPhoneNumbers/Local", :body => {
|
10
10
|
:Url => url,
|
11
11
|
:AreaCode => area_code,
|
12
12
|
:Method => method,
|
13
13
|
:FriendlyName => friendly_name
|
14
|
-
})
|
14
|
+
}.merge(options))
|
15
15
|
end
|
16
16
|
|
17
17
|
def list
|
18
18
|
Twilio.get("/IncomingPhoneNumbers/Local")
|
19
19
|
end
|
20
|
+
|
21
|
+
def delete(phone_number_sid)
|
22
|
+
Twilio.delete("/IncomingPhoneNumbers/#{phone_number_sid}")
|
23
|
+
end
|
24
|
+
|
20
25
|
end
|
21
26
|
end
|
data/lib/twilio/sms.rb
CHANGED
@@ -4,9 +4,10 @@ module Twilio
|
|
4
4
|
class Sms < TwilioObject
|
5
5
|
# Example:
|
6
6
|
# Twilio.connect('my_twilio_sid', 'my_auth_token')
|
7
|
-
# Twilio::Sms.message(CALLER_ID, user_number, 'This is my simple SMS message')
|
8
|
-
def message(from, to, body)
|
9
|
-
|
7
|
+
# Twilio::Sms.message(CALLER_ID, user_number, 'This is my simple SMS message', 'http://example.com/sms_callback')
|
8
|
+
def message(from, to, body, callback_url=nil)
|
9
|
+
callback = callback_url ? {:StatusCallback => callback_url} : {}
|
10
|
+
Twilio.post("/SMS/Messages", :body => {:From => from, :To => to, :Body => body}.merge(callback))
|
10
11
|
end
|
11
12
|
|
12
13
|
def list(optional = {})
|
@@ -0,0 +1,15 @@
|
|
1
|
+
<TwilioResponse>
|
2
|
+
<SMSMessage>
|
3
|
+
<Sid>SM872fb94e3b358913777cdb313f25b46f</Sid>
|
4
|
+
<DateCreated>Sun, 04 Oct 2009 03:48:08 -0700</DateCreated>
|
5
|
+
<DateUpdated>Sun, 04 Oct 2009 03:48:10 -0700</DateUpdated>
|
6
|
+
<DateSent>Sun, 04 Oct 2009 03:48:10 -0700</DateSent>
|
7
|
+
<AccountSid>AC5ea872f6da5a21de157d80997a64bd33</AccountSid>
|
8
|
+
<To>5558675309</To>
|
9
|
+
<From>4155551212</From>
|
10
|
+
<Body>Hi Jenny! Want to grab dinner?</Body>
|
11
|
+
<StatusCallback>http://example.com/callback</StatusCallback>
|
12
|
+
<Status>sent</Status>
|
13
|
+
<Flags>2</Flags>
|
14
|
+
</SMSMessage>
|
15
|
+
</TwilioResponse>
|
@@ -15,6 +15,12 @@ class LocalPhoneNumberTest < Test::Unit::TestCase #:nodoc: all
|
|
15
15
|
assert_equal stub_response(:post, :incoming_phone_number, :resource => 'IncomingPhoneNumbers/Local'),
|
16
16
|
Twilio::LocalPhoneNumber.create('http://test.local/call_handler')
|
17
17
|
end
|
18
|
+
|
19
|
+
should "be deleted" do
|
20
|
+
stub_response(:delete, :incoming_phone_number, { :resource => 'IncomingPhoneNumbers/PNe536dfda7c6184afab78d980cb8cdf43',
|
21
|
+
:status => [ 204, "HTTPNoContent" ] })
|
22
|
+
assert Twilio::LocalPhoneNumber.delete('PNe536dfda7c6184afab78d980cb8cdf43')
|
23
|
+
end
|
18
24
|
|
19
25
|
context "using deprecated API" do
|
20
26
|
setup do
|
data/test/twilio/sms_test.rb
CHANGED
@@ -10,6 +10,10 @@ class SmsTest < Test::Unit::TestCase #:nodoc: all
|
|
10
10
|
assert_equal stub_response(:post, :sms_new, :resource => 'SMS/Messages'),
|
11
11
|
Twilio::Sms.message('4155551212', '5558675309', 'Hi Jenny! Want to grab dinner?')
|
12
12
|
end
|
13
|
+
should "be messaged with a callback URL" do
|
14
|
+
assert_equal stub_response(:post, :sms_new_with_callback, :resource => 'SMS/Messages'),
|
15
|
+
Twilio::Sms.message('4155551212', '5558675309', 'Hi Jenny! Want to grab dinner?', 'http://example.com/callback')
|
16
|
+
end
|
13
17
|
|
14
18
|
should "be retrievable as a list" do
|
15
19
|
assert_equal stub_response(:get, :sms_messages, :resource => 'SMS/Messages'), Twilio::Sms.list
|
@@ -15,6 +15,13 @@ class TollFreePhoneNumberTest < Test::Unit::TestCase #:nodoc: all
|
|
15
15
|
assert_equal stub_response(:post, :incoming_phone_number, :resource => 'IncomingPhoneNumbers/TollFree'),
|
16
16
|
Twilio::TollFreePhoneNumber.create('http://test.local/call_handler')
|
17
17
|
end
|
18
|
+
|
19
|
+
should "be deleted" do
|
20
|
+
stub_response(:delete, :incoming_phone_number, { :resource => 'IncomingPhoneNumbers/PNe536dfda7c6184afab78d980cb8cdf43',
|
21
|
+
:status => [ 204, "HTTPNoContent" ] })
|
22
|
+
assert Twilio::TollFreePhoneNumber.delete('PNe536dfda7c6184afab78d980cb8cdf43')
|
23
|
+
end
|
24
|
+
|
18
25
|
|
19
26
|
context "using deprecated API" do
|
20
27
|
setup do
|
data/twilio.gemspec
CHANGED
@@ -5,11 +5,11 @@
|
|
5
5
|
|
6
6
|
Gem::Specification.new do |s|
|
7
7
|
s.name = %q{twilio}
|
8
|
-
s.version = "2.
|
8
|
+
s.version = "2.8.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", "Jonathan Rudenberg", "Alex K Wolfe", "Kyle Daigle"]
|
12
|
-
s.date = %q{2010-
|
11
|
+
s.authors = ["Phil Misiowiec", "Jonathan Rudenberg", "Alex K Wolfe", "Kyle Daigle", "Jeff Wigal"]
|
12
|
+
s.date = %q{2010-05-25}
|
13
13
|
s.description = %q{Twilio API wrapper}
|
14
14
|
s.email = %q{github@webficient.com}
|
15
15
|
s.extra_rdoc_files = [
|
@@ -59,6 +59,7 @@ Gem::Specification.new do |s|
|
|
59
59
|
"test/fixtures/xml/sms.xml",
|
60
60
|
"test/fixtures/xml/sms_messages.xml",
|
61
61
|
"test/fixtures/xml/sms_new.xml",
|
62
|
+
"test/fixtures/xml/sms_new_with_callback.xml",
|
62
63
|
"test/fixtures/xml/transcription.xml",
|
63
64
|
"test/fixtures/xml/transcriptions.xml",
|
64
65
|
"test/fixtures/yml/verb_responses.yml",
|
@@ -80,7 +81,7 @@ Gem::Specification.new do |s|
|
|
80
81
|
s.homepage = %q{http://github.com/webficient/twilio}
|
81
82
|
s.rdoc_options = ["--charset=UTF-8"]
|
82
83
|
s.require_paths = ["lib"]
|
83
|
-
s.rubygems_version = %q{1.3.
|
84
|
+
s.rubygems_version = %q{1.3.7}
|
84
85
|
s.summary = %q{Twilio API Client}
|
85
86
|
s.test_files = [
|
86
87
|
"test/test_helper.rb",
|
@@ -102,7 +103,7 @@ Gem::Specification.new do |s|
|
|
102
103
|
current_version = Gem::Specification::CURRENT_SPECIFICATION_VERSION
|
103
104
|
s.specification_version = 3
|
104
105
|
|
105
|
-
if Gem::Version.new(Gem::
|
106
|
+
if Gem::Version.new(Gem::VERSION) >= Gem::Version.new('1.2.0') then
|
106
107
|
s.add_runtime_dependency(%q<builder>, [">= 2.1.2"])
|
107
108
|
s.add_runtime_dependency(%q<httparty>, [">= 0.4.3"])
|
108
109
|
else
|
metadata
CHANGED
@@ -1,40 +1,59 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: twilio
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
|
4
|
+
hash: 47
|
5
|
+
prerelease: false
|
6
|
+
segments:
|
7
|
+
- 2
|
8
|
+
- 8
|
9
|
+
- 0
|
10
|
+
version: 2.8.0
|
5
11
|
platform: ruby
|
6
12
|
authors:
|
7
13
|
- Phil Misiowiec
|
8
14
|
- Jonathan Rudenberg
|
9
15
|
- Alex K Wolfe
|
10
16
|
- Kyle Daigle
|
17
|
+
- Jeff Wigal
|
11
18
|
autorequire:
|
12
19
|
bindir: bin
|
13
20
|
cert_chain: []
|
14
21
|
|
15
|
-
date: 2010-
|
22
|
+
date: 2010-05-25 00:00:00 -07:00
|
16
23
|
default_executable:
|
17
24
|
dependencies:
|
18
25
|
- !ruby/object:Gem::Dependency
|
19
26
|
name: builder
|
20
|
-
|
21
|
-
|
22
|
-
|
27
|
+
prerelease: false
|
28
|
+
requirement: &id001 !ruby/object:Gem::Requirement
|
29
|
+
none: false
|
23
30
|
requirements:
|
24
31
|
- - ">="
|
25
32
|
- !ruby/object:Gem::Version
|
33
|
+
hash: 15
|
34
|
+
segments:
|
35
|
+
- 2
|
36
|
+
- 1
|
37
|
+
- 2
|
26
38
|
version: 2.1.2
|
27
|
-
|
39
|
+
type: :runtime
|
40
|
+
version_requirements: *id001
|
28
41
|
- !ruby/object:Gem::Dependency
|
29
42
|
name: httparty
|
30
|
-
|
31
|
-
|
32
|
-
|
43
|
+
prerelease: false
|
44
|
+
requirement: &id002 !ruby/object:Gem::Requirement
|
45
|
+
none: false
|
33
46
|
requirements:
|
34
47
|
- - ">="
|
35
48
|
- !ruby/object:Gem::Version
|
49
|
+
hash: 9
|
50
|
+
segments:
|
51
|
+
- 0
|
52
|
+
- 4
|
53
|
+
- 3
|
36
54
|
version: 0.4.3
|
37
|
-
|
55
|
+
type: :runtime
|
56
|
+
version_requirements: *id002
|
38
57
|
description: Twilio API wrapper
|
39
58
|
email: github@webficient.com
|
40
59
|
executables: []
|
@@ -87,6 +106,7 @@ files:
|
|
87
106
|
- test/fixtures/xml/sms.xml
|
88
107
|
- test/fixtures/xml/sms_messages.xml
|
89
108
|
- test/fixtures/xml/sms_new.xml
|
109
|
+
- test/fixtures/xml/sms_new_with_callback.xml
|
90
110
|
- test/fixtures/xml/transcription.xml
|
91
111
|
- test/fixtures/xml/transcriptions.xml
|
92
112
|
- test/fixtures/yml/verb_responses.yml
|
@@ -114,21 +134,27 @@ rdoc_options:
|
|
114
134
|
require_paths:
|
115
135
|
- lib
|
116
136
|
required_ruby_version: !ruby/object:Gem::Requirement
|
137
|
+
none: false
|
117
138
|
requirements:
|
118
139
|
- - ">="
|
119
140
|
- !ruby/object:Gem::Version
|
141
|
+
hash: 3
|
142
|
+
segments:
|
143
|
+
- 0
|
120
144
|
version: "0"
|
121
|
-
version:
|
122
145
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
146
|
+
none: false
|
123
147
|
requirements:
|
124
148
|
- - ">="
|
125
149
|
- !ruby/object:Gem::Version
|
150
|
+
hash: 3
|
151
|
+
segments:
|
152
|
+
- 0
|
126
153
|
version: "0"
|
127
|
-
version:
|
128
154
|
requirements: []
|
129
155
|
|
130
156
|
rubyforge_project:
|
131
|
-
rubygems_version: 1.3.
|
157
|
+
rubygems_version: 1.3.7
|
132
158
|
signing_key:
|
133
159
|
specification_version: 3
|
134
160
|
summary: Twilio API Client
|