twilio_contactable 0.7.1 → 0.7.2
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/contactable.rb +6 -6
- data/test/twilio_contactable_contactable_test.rb +9 -7
- data/twilio_contactable.gemspec +3 -3
- metadata +8 -3
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.7.
|
1
|
+
0.7.2
|
data/lib/contactable.rb
CHANGED
@@ -114,7 +114,7 @@ module TwilioContactable
|
|
114
114
|
|
115
115
|
confirmation_code = TwilioContactable.generate_confirmation_code
|
116
116
|
|
117
|
-
response = TwilioContactable::Gateway.initiate_voice_call(self,
|
117
|
+
response = TwilioContactable::Gateway.initiate_voice_call(self, _TC_formatted_phone_number)
|
118
118
|
|
119
119
|
if response.success?
|
120
120
|
update_twilio_contactable_voice_confirmation confirmation_code
|
@@ -129,7 +129,7 @@ module TwilioContactable
|
|
129
129
|
def sms_confirm_with(code)
|
130
130
|
if _TC_sms_confirmation_code.to_s.downcase == code.downcase
|
131
131
|
# save the phone number into the 'confirmed phone number' attribute
|
132
|
-
self._TC_sms_confirmed_phone_number =
|
132
|
+
self._TC_sms_confirmed_phone_number = _TC_formatted_phone_number
|
133
133
|
save
|
134
134
|
else
|
135
135
|
false
|
@@ -140,7 +140,7 @@ module TwilioContactable
|
|
140
140
|
# the user for recieving TXT messages.
|
141
141
|
def sms_confirmed?
|
142
142
|
return false if _TC_sms_confirmed_phone_number.blank?
|
143
|
-
self._TC_sms_confirmed_phone_number ==
|
143
|
+
self._TC_sms_confirmed_phone_number == _TC_formatted_phone_number
|
144
144
|
end
|
145
145
|
|
146
146
|
# Compares user-provided code with the stored confirmation
|
@@ -149,7 +149,7 @@ module TwilioContactable
|
|
149
149
|
def voice_confirm_with(code)
|
150
150
|
if _TC_voice_confirmation_code.to_s.downcase == code.downcase
|
151
151
|
# save the phone number into the 'confirmed phone number' attribute
|
152
|
-
self._TC_voice_confirmed_phone_number =
|
152
|
+
self._TC_voice_confirmed_phone_number = _TC_formatted_phone_number
|
153
153
|
save
|
154
154
|
else
|
155
155
|
false
|
@@ -160,7 +160,7 @@ module TwilioContactable
|
|
160
160
|
# the user by receiving a phone call
|
161
161
|
def voice_confirmed?
|
162
162
|
return false if _TC_voice_confirmed_phone_number.blank?
|
163
|
-
self._TC_voice_confirmed_phone_number ==
|
163
|
+
self._TC_voice_confirmed_phone_number == _TC_formatted_phone_number
|
164
164
|
end
|
165
165
|
|
166
166
|
# Sends one or more TXT messages to the contactable record's
|
@@ -177,7 +177,7 @@ module TwilioContactable
|
|
177
177
|
|
178
178
|
# split into pieces that fit as individual messages.
|
179
179
|
msg.to_s.scan(/.{1,160}/m).map do |text|
|
180
|
-
if TwilioContactable::Gateway.deliver_sms(text,
|
180
|
+
if TwilioContactable::Gateway.deliver_sms(text, _TC_formatted_phone_number).success?
|
181
181
|
text.size
|
182
182
|
else
|
183
183
|
false
|
@@ -77,7 +77,7 @@ class TwilioContactableContactableTest < ActiveSupport::TestCase
|
|
77
77
|
assert @worked
|
78
78
|
end
|
79
79
|
should "save the phone number into the confirmed attribute" do
|
80
|
-
assert_equal @user.
|
80
|
+
assert_equal @user._TC_formatted_phone_number,
|
81
81
|
@user._TC_sms_confirmed_phone_number,
|
82
82
|
@user.reload.inspect
|
83
83
|
end
|
@@ -87,6 +87,7 @@ class TwilioContactableContactableTest < ActiveSupport::TestCase
|
|
87
87
|
context "and then attempting to confirm another number" do
|
88
88
|
setup {
|
89
89
|
@user._TC_phone_number = "206-555-8990"
|
90
|
+
@user.save
|
90
91
|
TwilioContactable::Gateway.stubs(:deliver).returns(Success).once
|
91
92
|
@user.send_sms_confirmation!
|
92
93
|
}
|
@@ -112,7 +113,7 @@ class TwilioContactableContactableTest < ActiveSupport::TestCase
|
|
112
113
|
end
|
113
114
|
should "save the phone number into the confirmed attribute" do
|
114
115
|
assert_equal @user._TC_sms_confirmed_phone_number,
|
115
|
-
@user.
|
116
|
+
@user._TC_formatted_phone_number
|
116
117
|
end
|
117
118
|
end
|
118
119
|
context "calling sms_confirm_with(wrong_code)" do
|
@@ -122,7 +123,7 @@ class TwilioContactableContactableTest < ActiveSupport::TestCase
|
|
122
123
|
end
|
123
124
|
should "not save the phone number into the confirmed attribute" do
|
124
125
|
assert_not_equal @user._TC_sms_confirmed_phone_number,
|
125
|
-
@user.
|
126
|
+
@user._TC_formatted_phone_number
|
126
127
|
end
|
127
128
|
should_not_change "confirmed phone number attribute" do
|
128
129
|
@user.reload._TC_sms_confirmed_phone_number
|
@@ -135,7 +136,7 @@ class TwilioContactableContactableTest < ActiveSupport::TestCase
|
|
135
136
|
message = "long message blah blah MYCODE blah"
|
136
137
|
TwilioContactable.expects(:generate_confirmation_code).returns('MYCODE').once
|
137
138
|
TwilioContactable.expects(:confirmation_message).returns(message).once
|
138
|
-
TwilioContactable::Gateway.expects(:deliver).with(message, @user.
|
139
|
+
TwilioContactable::Gateway.expects(:deliver).with(message, @user._TC_formatted_phone_number).once
|
139
140
|
@user.send_sms_confirmation!
|
140
141
|
}
|
141
142
|
end
|
@@ -193,7 +194,7 @@ class TwilioContactableContactableTest < ActiveSupport::TestCase
|
|
193
194
|
assert @worked
|
194
195
|
end
|
195
196
|
should "save the phone number into the confirmed attribute" do
|
196
|
-
assert_equal @user.
|
197
|
+
assert_equal @user._TC_formatted_phone_number,
|
197
198
|
@user._TC_voice_confirmed_phone_number,
|
198
199
|
@user.reload.inspect
|
199
200
|
end
|
@@ -203,6 +204,7 @@ class TwilioContactableContactableTest < ActiveSupport::TestCase
|
|
203
204
|
context "and then attempting to confirm another number" do
|
204
205
|
setup {
|
205
206
|
@user._TC_phone_number = "206-555-8990"
|
207
|
+
@user.save
|
206
208
|
TwilioContactable::Gateway.stubs(:deliver).returns(Success).once
|
207
209
|
@user.send_voice_confirmation!
|
208
210
|
}
|
@@ -228,7 +230,7 @@ class TwilioContactableContactableTest < ActiveSupport::TestCase
|
|
228
230
|
end
|
229
231
|
should "save the phone number into the confirmed attribute" do
|
230
232
|
assert_equal @user._TC_voice_confirmed_phone_number,
|
231
|
-
@user.
|
233
|
+
@user._TC_formatted_phone_number
|
232
234
|
end
|
233
235
|
end
|
234
236
|
context "calling voice_confirm_with(wrong_code)" do
|
@@ -238,7 +240,7 @@ class TwilioContactableContactableTest < ActiveSupport::TestCase
|
|
238
240
|
end
|
239
241
|
should "not save the phone number into the confirmed attribute" do
|
240
242
|
assert_not_equal @user._TC_voice_confirmed_phone_number,
|
241
|
-
@user.
|
243
|
+
@user._TC_formatted_phone_number
|
242
244
|
end
|
243
245
|
should_not_change "confirmed phone number attribute" do
|
244
246
|
@user.reload._TC_voice_confirmed_phone_number
|
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.2"
|
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.7}
|
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::VERSION) >= 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
|
+
- 2
|
9
|
+
version: 0.7.2
|
10
10
|
platform: ruby
|
11
11
|
authors:
|
12
12
|
- Jack Danger Canty
|
@@ -21,6 +21,7 @@ dependencies:
|
|
21
21
|
name: twiliolib
|
22
22
|
prerelease: false
|
23
23
|
requirement: &id001 !ruby/object:Gem::Requirement
|
24
|
+
none: false
|
24
25
|
requirements:
|
25
26
|
- - ">="
|
26
27
|
- !ruby/object:Gem::Version
|
@@ -35,6 +36,7 @@ dependencies:
|
|
35
36
|
name: shoulda
|
36
37
|
prerelease: false
|
37
38
|
requirement: &id002 !ruby/object:Gem::Requirement
|
39
|
+
none: false
|
38
40
|
requirements:
|
39
41
|
- - ">="
|
40
42
|
- !ruby/object:Gem::Version
|
@@ -47,6 +49,7 @@ dependencies:
|
|
47
49
|
name: mocha
|
48
50
|
prerelease: false
|
49
51
|
requirement: &id003 !ruby/object:Gem::Requirement
|
52
|
+
none: false
|
50
53
|
requirements:
|
51
54
|
- - ">="
|
52
55
|
- !ruby/object:Gem::Version
|
@@ -91,6 +94,7 @@ rdoc_options:
|
|
91
94
|
require_paths:
|
92
95
|
- lib
|
93
96
|
required_ruby_version: !ruby/object:Gem::Requirement
|
97
|
+
none: false
|
94
98
|
requirements:
|
95
99
|
- - ">="
|
96
100
|
- !ruby/object:Gem::Version
|
@@ -98,6 +102,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
98
102
|
- 0
|
99
103
|
version: "0"
|
100
104
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
105
|
+
none: false
|
101
106
|
requirements:
|
102
107
|
- - ">="
|
103
108
|
- !ruby/object:Gem::Version
|
@@ -107,7 +112,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
107
112
|
requirements: []
|
108
113
|
|
109
114
|
rubyforge_project:
|
110
|
-
rubygems_version: 1.3.
|
115
|
+
rubygems_version: 1.3.7
|
111
116
|
signing_key:
|
112
117
|
specification_version: 3
|
113
118
|
summary: Help authorize the users of your Rails apps to confirm and use their phone numbers
|