twilio_contactable 0.7.6 → 0.8.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/README.markdown +12 -5
- data/VERSION +1 -1
- data/lib/contactable.rb +8 -2
- data/lib/twilio_contactable.rb +0 -2
- data/twilio_contactable.gemspec +1 -1
- metadata +4 -4
data/README.markdown
CHANGED
@@ -30,12 +30,19 @@ Connect This Code To Your App
|
|
30
30
|
Include Twilio::Contactable into your User class or whatever you're using to represent an entity with a phone number.
|
31
31
|
|
32
32
|
class User < ActiveRecord::Base
|
33
|
+
|
34
|
+
include TwilioContactable::Contactable
|
35
|
+
|
33
36
|
twilio_contactable
|
37
|
+
|
34
38
|
end
|
35
39
|
|
36
40
|
If you're using custom column names you can easily overwrite any of them:
|
37
41
|
|
38
42
|
class User < ActiveRecord::Base
|
43
|
+
|
44
|
+
include TwilioContactable::Contactable
|
45
|
+
|
39
46
|
twilio_contactable do |config|
|
40
47
|
config.phone_number_column = :mobile_number
|
41
48
|
config.formatted_phone_number_column = :formatted_mobile_number
|
@@ -47,11 +54,11 @@ If you're using custom column names you can easily overwrite any of them:
|
|
47
54
|
config.voice_confirmation_code_column = :the_voice_confirmation_code
|
48
55
|
config.voice_confirmation_attempted_column = :when_was_the_voice_confirmation_attempted
|
49
56
|
config.voice_confirmed_phone_number_column = :the_mobile_number_thats_been_confirmed_for_voice
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
57
|
+
# Defaults to the name on the left (minus the '_column' at the end)
|
58
|
+
# e.g., the sms_blocked_column is 'sms_blocked'
|
59
|
+
#
|
60
|
+
# You don't need all those columns, omit any that you're sure you won't want.
|
61
|
+
end
|
55
62
|
end
|
56
63
|
|
57
64
|
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.
|
1
|
+
0.8.0
|
data/lib/contactable.rb
CHANGED
@@ -68,15 +68,19 @@ module TwilioContactable
|
|
68
68
|
Attributes.each do |attr|
|
69
69
|
eval %Q{
|
70
70
|
def _TC_#{attr}
|
71
|
-
|
71
|
+
send self.class.twilio_contactable.#{attr}_column
|
72
72
|
end
|
73
73
|
def _TC_#{attr}=(value)
|
74
|
-
|
74
|
+
send self.class.twilio_contactable.#{attr}_column.to_s+'=', value
|
75
75
|
end
|
76
76
|
}
|
77
77
|
end
|
78
78
|
|
79
79
|
|
80
|
+
def has_valid_phone_number?
|
81
|
+
format_phone_number
|
82
|
+
_TC_formatted_phone_number =~ /^\+[\d]{11,12}$/
|
83
|
+
end
|
80
84
|
|
81
85
|
# Sends an SMS validation request through the gateway
|
82
86
|
def send_sms_confirmation!
|
@@ -84,6 +88,7 @@ module TwilioContactable
|
|
84
88
|
return true if sms_confirmed?
|
85
89
|
return false if _TC_phone_number.blank?
|
86
90
|
|
91
|
+
format_phone_number
|
87
92
|
confirmation_code = TwilioContactable.generate_confirmation_code
|
88
93
|
|
89
94
|
# Use this class' confirmation_message method if it
|
@@ -112,6 +117,7 @@ module TwilioContactable
|
|
112
117
|
return true if voice_confirmed?
|
113
118
|
return false if _TC_phone_number.blank?
|
114
119
|
|
120
|
+
format_phone_number
|
115
121
|
confirmation_code = TwilioContactable.generate_confirmation_code
|
116
122
|
|
117
123
|
response = TwilioContactable::Gateway.initiate_voice_call(self, _TC_formatted_phone_number)
|
data/lib/twilio_contactable.rb
CHANGED
@@ -36,5 +36,3 @@ require File.expand_path(File.join(File.dirname(__FILE__), 'configuration'))
|
|
36
36
|
require File.expand_path(File.join(File.dirname(__FILE__), 'gateway'))
|
37
37
|
require File.expand_path(File.join(File.dirname(__FILE__), 'contactable'))
|
38
38
|
require File.expand_path(File.join(File.dirname(__FILE__), 'controller'))
|
39
|
-
|
40
|
-
ActiveRecord::Base.send :include, TwilioContactable::Contactable
|
data/twilio_contactable.gemspec
CHANGED
metadata
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: twilio_contactable
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash:
|
4
|
+
hash: 63
|
5
5
|
prerelease: false
|
6
6
|
segments:
|
7
7
|
- 0
|
8
|
-
-
|
9
|
-
-
|
10
|
-
version: 0.
|
8
|
+
- 8
|
9
|
+
- 0
|
10
|
+
version: 0.8.0
|
11
11
|
platform: ruby
|
12
12
|
authors:
|
13
13
|
- Jack Danger Canty
|