twilio_contactable 0.7.2 → 0.7.3
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/VERSION +1 -1
- data/lib/controller.rb +3 -1
- data/lib/gateway.rb +2 -8
- data/test/twilio_contactable_controller_test.rb +17 -0
- data/twilio_contactable.gemspec +3 -3
- metadata +3 -8
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.7.
|
1
|
+
0.7.3
|
data/lib/controller.rb
CHANGED
@@ -4,7 +4,8 @@ module TwilioContactable
|
|
4
4
|
def self.included(controller)
|
5
5
|
controller.instance_eval do
|
6
6
|
# the developer should specify which model(s) will be sought
|
7
|
-
# when the app receives incoming requests
|
7
|
+
# when the app receives incoming requests.
|
8
|
+
# See the 'Controller' part of the README for details
|
8
9
|
protected
|
9
10
|
def twilio_contactable(*klasses)
|
10
11
|
@@contactable_classes = klasses
|
@@ -55,6 +56,7 @@ module TwilioContactable
|
|
55
56
|
def receive_voice_confirmation
|
56
57
|
@contactable = params[:contactable_type].constantize.find(params[:contactable_id])
|
57
58
|
@contactable.voice_confirm_with(params['Digits'])
|
59
|
+
render :xml => ''
|
58
60
|
end
|
59
61
|
|
60
62
|
protected
|
data/lib/gateway.rb
CHANGED
@@ -53,7 +53,7 @@ module TwilioContactable
|
|
53
53
|
|
54
54
|
def deliver_sms(message, to, from = nil)
|
55
55
|
deliver :sms,
|
56
|
-
'
|
56
|
+
'Body' => message,
|
57
57
|
'To' => to,
|
58
58
|
'From' => from
|
59
59
|
end
|
@@ -85,17 +85,11 @@ module TwilioContactable
|
|
85
85
|
'Calls'
|
86
86
|
end
|
87
87
|
|
88
|
-
|
89
|
-
|
90
|
-
Net::HTTPCreated == response.code_type ?
|
91
|
-
TwilioContactable::Gateway::Success :
|
92
|
-
TwilioContactable::Gateway::Error
|
88
|
+
post service, data
|
93
89
|
end
|
94
90
|
|
95
91
|
def post(service, data = {})
|
96
92
|
url = "/#{API_VERSION}/Accounts/#{TwilioContactable.configuration.client_id}/#{service}"
|
97
|
-
puts "putting data: #{data.inspect}"
|
98
|
-
puts "to url: #{url}"
|
99
93
|
account.request url,
|
100
94
|
"POST",
|
101
95
|
data
|
@@ -93,5 +93,22 @@ class TwilioContactableControllerTest < ActionController::TestCase
|
|
93
93
|
}, @response.body
|
94
94
|
end
|
95
95
|
end
|
96
|
+
context "receiving digits from Twilio" do
|
97
|
+
setup {
|
98
|
+
@digits = '12345'
|
99
|
+
@user = User.create! :phone_number => '206 555 6666',
|
100
|
+
:voice_confirmation_code => @digits
|
101
|
+
@receive_params = {"contactable_type"=>"User", "contactable_id"=>@user.id, "Digits"=>@digits, "FromState"=>"WA", "Direction"=>"outbound-api", "CalledState"=>"WA", "ToState"=>"WA", "AccountSid"=>"ABCDEFG", "CallerCountry"=>"US", "CallerZip"=>"98077", "Caller"=>"{number}", "FromCity"=>"WOODINVILLE", "From"=>"{number}", "action"=>"receive_voice_confirmation", "CallerCity"=>"WOODINVILLE", "FromCountry"=>"US", "FromZip"=>"98077", "To"=>"+12069305710", "ToCity"=>"SEATTLE", "CallStatus"=>"in-progress", "controller"=>"twilio_contactable", "ToZip"=>"98188", "CalledZip"=>"98188", "CallerState"=>"WA", "CalledCity"=>"SEATTLE", "Called"=>"+12069305710", "CalledCountry"=>"US", "CallSid"=>"ABCD", "ToCountry"=>"US", "ApiVersion"=>"2010-04-01"}
|
102
|
+
get :receive_voice_confirmation, @receive_params
|
103
|
+
}
|
104
|
+
should_respond_with :success
|
105
|
+
should_respond_with_content_type :xml
|
106
|
+
should "set the user to confirmed via voice" do
|
107
|
+
assert @user.reload.voice_confirmed?
|
108
|
+
end
|
109
|
+
should "not change the user's sms confirmation setting" do
|
110
|
+
assert !@user.sms_confirmed?
|
111
|
+
end
|
112
|
+
end
|
96
113
|
end
|
97
114
|
end
|
data/twilio_contactable.gemspec
CHANGED
@@ -5,7 +5,7 @@
|
|
5
5
|
|
6
6
|
Gem::Specification.new do |s|
|
7
7
|
s.name = %q{twilio_contactable}
|
8
|
-
s.version = "0.7.
|
8
|
+
s.version = "0.7.3"
|
9
9
|
|
10
10
|
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
11
11
|
s.authors = ["Jack Danger Canty"]
|
@@ -37,7 +37,7 @@ Gem::Specification.new do |s|
|
|
37
37
|
s.homepage = %q{http://github.com/JackDanger/twilio_contactable}
|
38
38
|
s.rdoc_options = ["--charset=UTF-8"]
|
39
39
|
s.require_paths = ["lib"]
|
40
|
-
s.rubygems_version = %q{1.3.
|
40
|
+
s.rubygems_version = %q{1.3.6}
|
41
41
|
s.summary = %q{Help authorize the users of your Rails apps to confirm and use their phone numbers}
|
42
42
|
s.test_files = [
|
43
43
|
"test/test_helper.rb",
|
@@ -50,7 +50,7 @@ Gem::Specification.new do |s|
|
|
50
50
|
current_version = Gem::Specification::CURRENT_SPECIFICATION_VERSION
|
51
51
|
s.specification_version = 3
|
52
52
|
|
53
|
-
if Gem::Version.new(Gem::
|
53
|
+
if Gem::Version.new(Gem::RubyGemsVersion) >= Gem::Version.new('1.2.0') then
|
54
54
|
s.add_runtime_dependency(%q<twiliolib>, [">= 2.0.5"])
|
55
55
|
s.add_development_dependency(%q<shoulda>, [">= 0"])
|
56
56
|
s.add_development_dependency(%q<mocha>, [">= 0"])
|
metadata
CHANGED
@@ -5,8 +5,8 @@ version: !ruby/object:Gem::Version
|
|
5
5
|
segments:
|
6
6
|
- 0
|
7
7
|
- 7
|
8
|
-
-
|
9
|
-
version: 0.7.
|
8
|
+
- 3
|
9
|
+
version: 0.7.3
|
10
10
|
platform: ruby
|
11
11
|
authors:
|
12
12
|
- Jack Danger Canty
|
@@ -21,7 +21,6 @@ dependencies:
|
|
21
21
|
name: twiliolib
|
22
22
|
prerelease: false
|
23
23
|
requirement: &id001 !ruby/object:Gem::Requirement
|
24
|
-
none: false
|
25
24
|
requirements:
|
26
25
|
- - ">="
|
27
26
|
- !ruby/object:Gem::Version
|
@@ -36,7 +35,6 @@ dependencies:
|
|
36
35
|
name: shoulda
|
37
36
|
prerelease: false
|
38
37
|
requirement: &id002 !ruby/object:Gem::Requirement
|
39
|
-
none: false
|
40
38
|
requirements:
|
41
39
|
- - ">="
|
42
40
|
- !ruby/object:Gem::Version
|
@@ -49,7 +47,6 @@ dependencies:
|
|
49
47
|
name: mocha
|
50
48
|
prerelease: false
|
51
49
|
requirement: &id003 !ruby/object:Gem::Requirement
|
52
|
-
none: false
|
53
50
|
requirements:
|
54
51
|
- - ">="
|
55
52
|
- !ruby/object:Gem::Version
|
@@ -94,7 +91,6 @@ rdoc_options:
|
|
94
91
|
require_paths:
|
95
92
|
- lib
|
96
93
|
required_ruby_version: !ruby/object:Gem::Requirement
|
97
|
-
none: false
|
98
94
|
requirements:
|
99
95
|
- - ">="
|
100
96
|
- !ruby/object:Gem::Version
|
@@ -102,7 +98,6 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
102
98
|
- 0
|
103
99
|
version: "0"
|
104
100
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
105
|
-
none: false
|
106
101
|
requirements:
|
107
102
|
- - ">="
|
108
103
|
- !ruby/object:Gem::Version
|
@@ -112,7 +107,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
112
107
|
requirements: []
|
113
108
|
|
114
109
|
rubyforge_project:
|
115
|
-
rubygems_version: 1.3.
|
110
|
+
rubygems_version: 1.3.6
|
116
111
|
signing_key:
|
117
112
|
specification_version: 3
|
118
113
|
summary: Help authorize the users of your Rails apps to confirm and use their phone numbers
|