sms-easy 1.2.5 → 1.3.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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 9ebbb4a315e7bd8aa8e3d60bb5c48ac654639e1a
4
- data.tar.gz: ae9dd7b8675d2db218e85f34ccbd0f1ccb20f390
3
+ metadata.gz: f5dff88cbbc4e89b10867b01aff88219734ad508
4
+ data.tar.gz: 7d79086cedebfaea3d492459951905ffe3a695e8
5
5
  SHA512:
6
- metadata.gz: 017125dfa0606ffca0b3ce00b0ce8e8f5159b0c92ae39c34a956e690608e7d55cd4d6a1b7a5acb48e0132bbb2291abda16d15c7ff294f9afe7eaed212779d1b3
7
- data.tar.gz: ade68078e0be3ad58cc8a436dac1dc714ff011708c0a315b3f5ac7a52b5f58a43c85f044b1771fb16b205c3ec10fe38570293e0f345154999665c730fda8d132
6
+ metadata.gz: 844a56587cc568969635907c5d5b5f23cbce7c5f78a391a724f7fd4c6143f75d20b910637e35530c7a09ccc71248f0cb49e3c0b81aa5d3de0790913942a07455
7
+ data.tar.gz: 5b8faee7cbae74472739b74eab363d8455dd0d27e196257f25266e31d5303601cc21613ce82f5bd450bd873f17fa03249297870f533cbb03f69b6fa58426d137
data/README.rdoc CHANGED
@@ -58,7 +58,7 @@ limitation. Some of these carriers are include, Mobitel, Etisalat, T-Mobile (Ne
58
58
  * Basic Rails Configuration
59
59
 
60
60
  # Override the default "from" address with config/initializers/sms-easy.rb
61
- SMSEasy::Client.config['form_address'] = "noreply@example.com"
61
+ SMSEasy::Client.config['from_address'] = "noreply@example.com"
62
62
 
63
63
  # Or, you can completely copy sms-easy.yml to your app (http://github.com/preston/sms-easy/blob/master/templates/sms-easy.yml), change it to your liking, and override the default configuration with:
64
64
 
data/lib/sms/easy/easy.rb CHANGED
@@ -1,79 +1,83 @@
1
1
  module SMSEasy
2
2
 
3
- class Client
4
-
5
- @@config = YAML::load(File.open(File.join(File.dirname(__FILE__), '..', '..', '..', 'templates', 'sms-easy.yml')))
6
-
7
- # Delivers the SMS message in the form of an e-mail
8
- # sms-easy.deliver("1234567890","at&t","hello world")
9
- def deliver(number, carrier, message, options = {})
10
- raise SMSEasyException.new("Can't deliver blank message to #{SMSEasy::Client.format_number(number)}") if message.nil? || message.empty?
11
-
12
- limit = options[:limit] || message.length
13
- from = options[:from] || SMSEasy::Client.from_address
14
- message = message[0..limit-1]
15
- email = SMSEasy::Client.sms_address(number,carrier)
16
-
17
- if @delivery == :pony
18
- Pony.mail({:to => email, :body => message, :from => from}.merge!(@pony_config))
19
- else
20
- SMSEasyNotifier.send_sms(email, message, from).deliver
21
- end
22
- end
23
-
24
- class << self
25
- def configure(opts = {})
26
- @@config.merge!(opts)
27
- # require 'pp'
28
- # pp @@@@config
29
- end
30
-
31
- def config
32
- @@config
33
- end
34
-
35
- # Returns back a list of all carriers
36
- # SMSEasy.carriers
37
- def carriers
38
- @@config['carriers']
39
- end
40
-
41
- def from_address
42
- @@config['from_address']
43
- end
44
-
45
- def carrier_name(key)
46
- carrier(key)['name']
47
- end
48
-
49
- def carrier_email(key)
50
- carrier(key.downcase)['value']
51
- end
52
-
53
- def carrier(key)
54
- raise SMSEasyException.new("Carrier (#{key}) is not supported") unless SMSEasy::Client.carriers.has_key?(key.downcase)
55
- carriers[key]
56
- end
57
-
58
- # Returns back a properly formatted SMS e-mail address
59
- # SMSEasy.sms_address("1234567890","at&t")
60
- def sms_address(number,carrier)
61
- raise SMSEasyException.new("Missing number or carrier") if number.nil? || carrier.nil?
62
- format_number(number) + carrier_email(carrier.downcase)
63
- end
64
-
65
- def format_number(number)
66
- stripped = number.gsub("-","").strip
67
- formatted = (stripped.length == 11 && stripped[0,1] == "1") ? stripped[1..stripped.length] : stripped
68
- raise SMSEasyException.new("Number (#{number}) is not formatted correctly") unless valid_number?(formatted)
69
- formatted
70
- end
71
-
72
- def valid_number?(number)
73
- number.length >= 10 && number[/^.\d+$/]
74
- end
75
-
76
- end
77
-
78
- end
3
+ class Client
4
+
5
+ @@config = YAML::load(File.open(File.join(File.dirname(__FILE__), '..', '..', '..', 'templates', 'sms-easy.yml')))
6
+
7
+ # Delivers the SMS message in the form of an e-mail
8
+ # sms-easy.deliver("1234567890","at&t","hello world")
9
+ def deliver(number, carrier, message, options = {})
10
+ raise SMSEasyException.new("Can't deliver blank message to #{SMSEasy::Client.format_number(number)}") if message.nil? || message.empty?
11
+
12
+ limit = options[:limit] || message.length
13
+ from = options[:from] || SMSEasy::Client.from_address
14
+ message = message[0..limit-1]
15
+ email = SMSEasy::Client.sms_address(number,carrier)
16
+
17
+ if @delivery == :pony
18
+ Pony.mail({:to => email, :body => message, :from => from}.merge!(@pony_config))
19
+ else
20
+ if ActionMailer.version.version.to_f >= 4.2
21
+ SMSEasyNotifier.send_sms(email, message, from).deliver_now
22
+ else
23
+ SMSEasyNotifier.send_sms(email, message, from).deliver
24
+ end
25
+ end
26
+ end
27
+
28
+ class << self
29
+ def configure(opts = {})
30
+ @@config.merge!(opts)
31
+ # require 'pp'
32
+ # pp @@@@config
33
+ end
34
+
35
+ def config
36
+ @@config
37
+ end
38
+
39
+ # Returns back a list of all carriers
40
+ # SMSEasy.carriers
41
+ def carriers
42
+ @@config['carriers']
43
+ end
44
+
45
+ def from_address
46
+ @@config['from_address']
47
+ end
48
+
49
+ def carrier_name(key)
50
+ carrier(key)['name']
51
+ end
52
+
53
+ def carrier_email(key)
54
+ carrier(key.downcase)['value']
55
+ end
56
+
57
+ def carrier(key)
58
+ raise SMSEasyException.new("Carrier (#{key}) is not supported") unless SMSEasy::Client.carriers.has_key?(key.downcase)
59
+ carriers[key]
60
+ end
61
+
62
+ # Returns back a properly formatted SMS e-mail address
63
+ # SMSEasy.sms_address("1234567890","at&t")
64
+ def sms_address(number,carrier)
65
+ raise SMSEasyException.new("Missing number or carrier") if number.nil? || carrier.nil?
66
+ format_number(number) + carrier_email(carrier.downcase)
67
+ end
68
+
69
+ def format_number(number)
70
+ stripped = number.gsub("-","").strip
71
+ formatted = (stripped.length == 11 && stripped[0,1] == "1") ? stripped[1..stripped.length] : stripped
72
+ raise SMSEasyException.new("Number (#{number}) is not formatted correctly") unless valid_number?(formatted)
73
+ formatted
74
+ end
75
+
76
+ def valid_number?(number)
77
+ number.length >= 10 && number[/^.\d+$/]
78
+ end
79
+
80
+ end
81
+
82
+ end
79
83
  end
@@ -1,3 +1,3 @@
1
1
  module SMSEasy
2
- VERSION = "1.2.5"
2
+ VERSION = "1.3.0"
3
3
  end
@@ -2,107 +2,110 @@ from_address: noreply@example.com
2
2
 
3
3
  # Loosely based on the Wikipedia page: https://en.wikipedia.org/wiki/List_of_SMS_gateways
4
4
  carriers:
5
+ aio:
6
+ name: 'Aio Wireless'
7
+ value: '@mms.aiowireless.net'
5
8
  alltel:
6
9
  name: Alltel
7
10
  value: '@sms.alltel.com'
8
11
  ameritech:
9
12
  name: Ameritech
10
13
  value: '@paging.acswireless.com'
11
- at&t:
14
+ at&t:
12
15
  name: 'AT&T'
13
16
  value: '@txt.att.net'
14
- bell-atlantic:
17
+ bell-atlantic:
15
18
  name: Bell Atlantic
16
19
  value: '@message.bam.com'
17
20
  bellsouthmobility:
18
21
  name: Bellsouth Mobility
19
22
  value: '@blsdcs.net'
20
- blueskyfrog:
23
+ blueskyfrog:
21
24
  name: BlueSkyFrog
22
25
  value: '@blueskyfrog.com'
23
- boost:
26
+ boost:
24
27
  name: Boost Mobile
25
28
  value: '@myboostmobile.com'
26
- cellularsouth:
29
+ cellularsouth:
27
30
  name: Cellular South
28
31
  value: '@csouth1.com'
29
- comcast:
32
+ comcast:
30
33
  name: Comcast PCS
31
34
  value: '@comcastpcs.textmsg.com'
32
- cricket:
35
+ cricket:
33
36
  name: Cricket
34
37
  value: '@sms.mycricket.com'
35
- kajeet:
38
+ kajeet:
36
39
  name: kajeet
37
40
  value: '@mobile.kajeet.net'
38
- metropcs:
41
+ metropcs:
39
42
  name: Metro PCS
40
43
  value: '@mymetropcs.com'
41
44
  nextel:
42
45
  name: Nextel
43
46
  value: '@messaging.nextel.com'
44
- powertel:
47
+ powertel:
45
48
  name: Powertel
46
49
  value: '@ptel.net'
47
- pscwireless:
50
+ pscwireless:
48
51
  name: PSC Wireless
49
52
  value: '@sms.pscel.com'
50
- qwest:
53
+ qwest:
51
54
  name: Qwest
52
55
  value: '@qwestmp.com'
53
- southernlink:
56
+ southernlink:
54
57
  name: Southern Link
55
58
  value: '@page.southernlinc.com'
56
- sprint:
59
+ sprint:
57
60
  name: Sprint PCS
58
61
  value: '@messaging.sprintpcs.com'
59
- suncom:
62
+ suncom:
60
63
  name: Suncom
61
64
  value: '@tms.suncom.com'
62
- t-mobile:
65
+ t-mobile:
63
66
  name: T-Mobile
64
67
  value: '@tmomail.net'
65
- tracfone:
68
+ tracfone:
66
69
  name: Tracfone
67
70
  value: '@mmst5.tracfone.com'
68
- telus-mobility:
71
+ telus-mobility:
69
72
  name: Telus Mobility
70
73
  value: '@msg.telus.com'
71
- virgin:
74
+ virgin:
72
75
  name: Virgin Mobile
73
76
  value: '@vmobl.net'
74
- verizon:
77
+ verizon:
75
78
  name: Verizon Wireless
76
79
  value: '@vtext.com'
77
80
  # International Carriers
78
81
  aliant-canada:
79
82
  name: Aliant (Canada)
80
83
  value: '@chat.wirefree.ca'
81
- beeline-ua:
84
+ beeline-ua:
82
85
  name: Beeline
83
86
  value: '@sms.beeline.ua'
84
87
  bellmobility-canada:
85
88
  name: Bell Mobility (Canada)
86
89
  value: '@txt.bell.ca'
87
- bpl-mobile:
90
+ bpl-mobile:
88
91
  name: BPL Mobile
89
92
  value: '@bplmobile.com'
90
93
  claro-brazil:
91
94
  name: Claro (Brazil)
92
95
  value: '@clarotorpedo.com.br'
93
- claro-nicaragua:
96
+ claro-nicaragua:
94
97
  name: Claro (Nicaragua)
95
98
  value: '@ideasclaro-ca.com'
96
- du-arab-emirates:
99
+ du-arab-emirates:
97
100
  name: Du (UAE)
98
101
  value: '@email2sms.ae'
99
- e-plus-germany:
102
+ e-plus-germany:
100
103
  name: E-Plus (Germany)
101
104
  value: '@smsmail.eplus.de'
102
- etisalat-arab-emirates:
105
+ etisalat-arab-emirates:
103
106
  name: Etisalat (UAE)
104
107
  value: '@email2sms.ae'
105
- fido-canada:
108
+ fido-canada:
106
109
  name: Fido
107
110
  value: '@fido.ca'
108
111
  manitobatelecom-canada:
@@ -111,34 +114,34 @@ carriers:
111
114
  mobinil-egypt:
112
115
  name: Mobinil
113
116
  value: '@mobinil.net'
114
- mobistar-belgium:
117
+ mobistar-belgium:
115
118
  name: Mobistar (Belgium)
116
119
  value: '@mobistar.be'
117
- mobitel:
120
+ mobitel:
118
121
  name: Mobitel
119
122
  value: '@sms.mobitel.lk'
120
- movistar-spain:
123
+ movistar-spain:
121
124
  name: Movistar (Spain)
122
125
  value: '@correo.movistar.net'
123
126
  northerntel-canada:
124
127
  name: NorthernTel (Canada)
125
128
  value: '@txt.northerntelmobility.com'
126
- o2-germany:
129
+ o2-germany:
127
130
  name: o2 (Germany)
128
131
  value: '@o2online.de'
129
- o2-uk:
132
+ o2-uk:
130
133
  name: o2 (UK)
131
134
  value: '@mmail.co.uk'
132
- orange-mumbai:
135
+ orange-mumbai:
133
136
  name: Orange (Mumbai)
134
137
  value: '@orangemail.co.in'
135
- orange-netherlands:
138
+ orange-netherlands:
136
139
  name: Orange (Netherlands)
137
140
  value: '@sms.orange.nl'
138
- orange-uk:
141
+ orange-uk:
139
142
  name: Orange (UK)
140
143
  value: '@orange.net'
141
- rogers-wireless:
144
+ rogers-wireless:
142
145
  name: Rogers Wireless
143
146
  value: '@pcs.rogers.com'
144
147
  rogers-canada:
@@ -147,25 +150,25 @@ carriers:
147
150
  sasktel-canada:
148
151
  name: SaskTel (canada)
149
152
  value: '@sms.sasktel.ca'
150
- sfr-france:
153
+ sfr-france:
151
154
  name: SFR (France)
152
155
  value: '@sfr.fr'
153
- t-mobile-austria:
156
+ t-mobile-austria:
154
157
  name: T-Mobile (Austria)
155
158
  value: '@sms.t-mobile.at'
156
- t-mobile-germany:
159
+ t-mobile-germany:
157
160
  name: T-Mobile (Germany)
158
161
  value: '@t-d1-sms.de'
159
- t-mobile-germany:
162
+ t-mobile-germany:
160
163
  name: T-Mobile (Netherlands)
161
164
  value: '@gin.nl'
162
- t-mobile-uk:
165
+ t-mobile-uk:
163
166
  name: T-Mobile (UK)
164
167
  value: '@t-mobile.uk.net'
165
168
  telebec-canada:
166
169
  name: Telebec (Canada)
167
170
  value: '@txt.telebecmobilite.com'
168
- telefonica-spain:
171
+ telefonica-spain:
169
172
  name: Telefonica (Spain)
170
173
  value: '@movistar.net'
171
174
  telus-canada:
@@ -174,60 +177,60 @@ carriers:
174
177
  virgin-canada:
175
178
  name: Virgin (Canada)
176
179
  value: '@vmobile.ca '
177
- vodafone-germany:
180
+ vodafone-germany:
178
181
  name: Vodafone (Germany)
179
182
  value: '@vodafone-sms.de'
180
- vodafone-egypt:
183
+ vodafone-egypt:
181
184
  name: Vodafone (Egypt)
182
185
  value: '@vodafone.com.eg'
183
- vodafone-uk:
186
+ vodafone-uk:
184
187
  name: Vodafone (UK)
185
188
  value: '@sms.vodafone.net'
186
- vodafone-italy:
189
+ vodafone-italy:
187
190
  name: Vodafone (Italy)
188
191
  value: '@sms.vodafone.it'
189
- vodafone-jp-chuugoku:
192
+ vodafone-jp-chuugoku:
190
193
  name: Vodafone (Japan - Chuugoku)
191
194
  value: '@n.vodafone.ne.jp'
192
- vodafone-jp-hokkaido:
195
+ vodafone-jp-hokkaido:
193
196
  name: Vodafone (Japan - Hokkaido)
194
197
  value: '@d.vodafone.ne.jp'
195
- vodafone-jp-hokuriko:
198
+ vodafone-jp-hokuriko:
196
199
  name: Vodafone (Japan - Hokuriko)
197
200
  value: '@r.vodafone.ne.jp'
198
- vodafone-jp-kansai:
201
+ vodafone-jp-kansai:
199
202
  name: Vodafone (Japan - Kansai)
200
203
  value: '@k.vodafone.ne.jp'
201
- vodafone-jp-osaka:
204
+ vodafone-jp-osaka:
202
205
  name: Vodafone (Japan - Osaka)
203
206
  value: '@k.vodafone.ne.jp'
204
- vodafone-jp-kanto:
207
+ vodafone-jp-kanto:
205
208
  name: Vodafone (Japan - Kanto)
206
209
  value: '@k.vodafone.ne.jp'
207
- vodafone-jp-koushin:
210
+ vodafone-jp-koushin:
208
211
  name: Vodafone (Japan - Koushin)
209
212
  value: '@k.vodafone.ne.jp'
210
- vodafone-jp-tokyo:
213
+ vodafone-jp-tokyo:
211
214
  name: Vodafone (Japan - Tokyo)
212
215
  value: '@k.vodafone.ne.jp'
213
- vodafone-jp-kyuushu:
216
+ vodafone-jp-kyuushu:
214
217
  name: Vodafone (Japan - Kyuushu)
215
218
  value: '@q.vodafone.ne.jp'
216
- vodafone-jp-okinawa:
219
+ vodafone-jp-okinawa:
217
220
  name: Vodafone (Japan - Okinawa)
218
221
  value: '@q.vodafone.ne.jp'
219
- vodafone-jp-shikoku:
222
+ vodafone-jp-shikoku:
220
223
  name: Vodafone (Japan - Shikoku)
221
224
  value: '@s.vodafone.ne.jp'
222
- vodafone-jp-touhoku:
225
+ vodafone-jp-touhoku:
223
226
  name: Vodafone (Japan - Touhoku)
224
227
  value: '@h.vodafone.ne.jp'
225
- vodafone-jp-niigata:
228
+ vodafone-jp-niigata:
226
229
  name: Vodafone (Japan - Niigata)
227
230
  value: '@h.vodafone.ne.jp'
228
- vodafone-jp-toukai:
231
+ vodafone-jp-toukai:
229
232
  name: Vodafone (Japan - Toukai)
230
233
  value: '@h.vodafone.ne.jp'
231
- vodafone-spain:
234
+ vodafone-spain:
232
235
  name: Vodafone (Japan - Spain)
233
236
  value: '@vodafone.es'
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: sms-easy
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.2.5
4
+ version: 1.3.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Brendan G. Lim
@@ -10,7 +10,7 @@ authors:
10
10
  autorequire:
11
11
  bindir: bin
12
12
  cert_chain: []
13
- date: 2014-10-10 00:00:00.000000000 Z
13
+ date: 2015-05-18 00:00:00.000000000 Z
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
16
  name: actionmailer
@@ -98,7 +98,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
98
98
  version: '0'
99
99
  requirements: []
100
100
  rubyforge_project:
101
- rubygems_version: 2.2.2
101
+ rubygems_version: 2.4.6
102
102
  signing_key:
103
103
  specification_version: 4
104
104
  summary: SMSEasy allows you to send text messages to a mobile recipient for free.