sms_fu 1.1.1

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,339 @@
1
+ commit 36591f0eea341a46b48719e1aefa9f7b464a1b93
2
+ Author: Brendan G. Lim <brendangl@gmail.com>
3
+ Date: Mon Aug 23 23:12:36 2010 -0400
4
+
5
+ Updating readme
6
+
7
+ commit f04b37c5fadbe2f4058782280cc622461b901c0d
8
+ Author: Brendan G. Lim <brendangl@gmail.com>
9
+ Date: Mon Aug 23 23:09:01 2010 -0400
10
+
11
+ Reorganizing for gem
12
+
13
+ commit 97ee600bab782955a917cf70c971499bfb6fe1f2
14
+ Author: Brendan G. Lim <brendangl@gmail.com>
15
+ Date: Mon Aug 23 18:09:09 2010 -0400
16
+
17
+ Updating for gem consumption
18
+
19
+ commit a59ba52a34e86c17a02ee4d4f4a1b08d9b3dccc1
20
+ Author: Brendan G. Lim <brendangl@gmail.com>
21
+ Date: Fri Oct 30 15:17:21 2009 -0400
22
+
23
+ Updating README and CHANGELOG
24
+
25
+ commit 569bf6f5c0d3f47cc2f4c49771f4ddcc4f196f52
26
+ Author: Brendan G. Lim <brendangl@gmail.com>
27
+ Date: Fri Oct 30 15:15:08 2009 -0400
28
+
29
+ Updating README and CHANGELOG
30
+
31
+ commit f93349785ebcc991bec1b463712d7cfef04fb91b
32
+ Author: pboling <peter.boling@peterboling.com>
33
+ Date: Fri Oct 23 03:00:06 2009 -0400
34
+
35
+ default phrase should not force a blank option tag, now it is optional
36
+
37
+ commit f77d6d076da2785da5c06e569c9891ba4b198c48
38
+ Author: pboling <peter.boling@peterboling.com>
39
+ Date: Fri Oct 23 02:23:41 2009 -0400
40
+
41
+ added SMSFu.carrier_name(key) to lookup carrier names in the YAML
42
+
43
+ commit aca2e94475da51114771fec3e29cbf2d69fc77b9
44
+ Author: mike castleman <m@mlcastle.net>
45
+ Date: Thu Oct 22 18:03:44 2009 -0400
46
+
47
+ add nextel to default YAML
48
+
49
+ commit 8ce7858e829bb409febe5da6e47fa7d2a691e3d2
50
+ Author: pboling <peter.boling@peterboling.com>
51
+ Date: Thu Oct 22 15:37:50 2009 -0400
52
+
53
+ improved setting of RAILS_CONFIG_ROOT
54
+
55
+ commit e010096f2a9c1f5ddecbad998051b210ba47b3dd
56
+ Author: pboling <peter.boling@peterboling.com>
57
+ Date: Thu Oct 22 14:59:23 2009 -0400
58
+
59
+ fixed tests so that they actually run (and all pass)
60
+
61
+ commit 0411f1f60ae8be13ac4a732a48e44d3153441002
62
+ Merge: d5a7437 17f23b1
63
+ Author: pboling <peter.boling@peterboling.com>
64
+ Date: Thu Oct 22 13:51:32 2009 -0400
65
+
66
+ Added 8 Canadian Carriers
67
+
68
+ commit d5a74370ef16af4514d3b9d01983ba3f7b1efb41
69
+ Author: pboling <peter.boling@peterboling.com>
70
+ Date: Thu Oct 22 13:38:16 2009 -0400
71
+
72
+ merge mlc/master
73
+
74
+ commit f31a115d9a0b4b54913c3c9c79d4b0ce605f8448
75
+ Merge: efd3df6 cd5fc17
76
+ Author: pboling <peter.boling@peterboling.com>
77
+ Date: Thu Oct 22 13:33:51 2009 -0400
78
+
79
+ Merge commit 'mlc/master'
80
+
81
+ commit efd3df69b9e232f40cacc0e0b94115e7a57e0238
82
+ Author: pboling <peter.boling@peterboling.com>
83
+ Date: Thu Oct 22 13:33:01 2009 -0400
84
+
85
+ merge adamalex/master and added .gitignore
86
+
87
+ commit 78a08891eb6d9b7b3b3ac78f531c5f4df35fce1c
88
+ Merge: 05679c8 a699a9e
89
+ Author: pboling <peter.boling@peterboling.com>
90
+ Date: Thu Oct 22 13:28:53 2009 -0400
91
+
92
+ Merge commit 'adamalex/master'
93
+
94
+ commit cd5fc1743e976e35cbaeeba2a3fcf2bf1ad3c5fd
95
+ Author: mike castleman <m@mlcastle.net>
96
+ Date: Tue Sep 29 16:39:45 2009 -0400
97
+
98
+ in carrier_select, allow caller to pre-select a carrier
99
+
100
+ commit 05679c809195764832f62f9739032a7693d54f78
101
+ Author: Brendan G. Lim <brendangl@gmail.com>
102
+ Date: Tue Aug 4 00:11:50 2009 -0400
103
+
104
+ Fixing typo in yml for BlueSkyFrog
105
+
106
+ commit b0fd12533cc998618d41c27f2ec18334bf62afe2
107
+ Author: Brendan G. Lim <brendangl@gmail.com>
108
+ Date: Mon Jul 20 19:15:18 2009 -0400
109
+
110
+ Regenerated gemspec for version 1.0.0
111
+
112
+ commit a9f07f6502b70143058219f8966cb7dc8b237d66
113
+ Author: Brendan G. Lim <brendangl@gmail.com>
114
+ Date: Mon Jul 20 19:15:09 2009 -0400
115
+
116
+ Adding in gemspec
117
+
118
+ commit 74d6e1c9a109d2b576df148a01a34a9548c1ffd6
119
+ Author: Brendan G. Lim <brendangl@gmail.com>
120
+ Date: Mon Jul 20 19:13:41 2009 -0400
121
+
122
+ Version bump to 0.0.0
123
+
124
+ commit 899050db2a8877fe508738811c121247571aaea2
125
+ Author: Brendan G. Lim <brendangl@gmail.com>
126
+ Date: Thu Jul 2 11:47:27 2009 -0400
127
+
128
+ Adding support for SFR (France)
129
+
130
+ commit ad7cabcb7eb5ca8001ef187339d382664b1c3e81
131
+ Author: Brendan G. Lim <brendangl@gmail.com>
132
+ Date: Thu Jul 2 11:40:53 2009 -0400
133
+
134
+ Adding Mobistar (Belgium), T-Mobile (Netherlands), and Vodafone (Netherlands) to supporter carrier list
135
+
136
+ commit a699a9ec3119a717aefdca034b9dacefaab6f57f
137
+ Merge: 03d93f0 15d31df
138
+ Author: Adam Alexander <adamalex@gmail.com>
139
+ Date: Sun Mar 1 11:49:58 2009 -0500
140
+
141
+ Merge commit 'brendanlim/master'
142
+
143
+ commit 15d31df11aa0d77a688d44955daf9647aad70b2b
144
+ Author: Brent Collier <brentmc79@gmail.com>
145
+ Date: Sat Feb 28 22:47:53 2009 -0500
146
+
147
+ fixin syntax error in helper
148
+
149
+ commit 1c0903356b8b9ba96acd407e678b84d8fc186c3f
150
+ Author: Brendan G. Lim <brendan@intridea.com>
151
+ Date: Sat Feb 28 20:54:46 2009 -0500
152
+
153
+ fixing some issues with 2.2
154
+
155
+ commit 03d93f094b43cd1b66e4ca904b6bb895e2afb087
156
+ Author: Adam Alexander <adamalex@gmail.com>
157
+ Date: Fri Feb 27 06:07:58 2009 -0500
158
+
159
+ Added carrier_select_default to allow for providing default value
160
+
161
+ commit 7c918f19794ed618b10eb2db5d8dc6e6badadbda
162
+ Author: Adam Alexander <adamalex@gmail.com>
163
+ Date: Fri Feb 27 06:07:17 2009 -0500
164
+
165
+ Modified carrier_collection to return carrier name and key
166
+
167
+ commit 570b1e244ce64ce318d55e778ec629dc5177f6e8
168
+ Author: Brendan G. Lim <brendan@intridea.com>
169
+ Date: Thu Feb 26 17:20:04 2009 -0500
170
+
171
+ Message sent out should be in plain text
172
+
173
+ commit 752126921ea6948c46ac527b9f4b5a67f72a1048
174
+ Author: Brendan G. Lim <brendan@intridea.com>
175
+ Date: Tue Feb 24 01:32:35 2009 -0500
176
+
177
+ Completely restructing yaml and now showing proper names in select box -- again
178
+
179
+ commit e06b82db487e937c67a431ad3219a65b187b7827
180
+ Author: Brendan G. Lim <brendan@intridea.com>
181
+ Date: Tue Feb 24 01:30:30 2009 -0500
182
+
183
+ Completely restructing yaml and now showing proper names in select box
184
+
185
+ commit f17677ff1d47305d0217f56472a3156277eabda7
186
+ Author: Brendan G. Lim <brendan@intridea.com>
187
+ Date: Mon Feb 23 22:53:58 2009 -0500
188
+
189
+ Adding in quite a few more mobile carriers to our supported list
190
+
191
+ commit 1c7c3d79ee9eeae1b0fd55c9f2654633566d308f
192
+ Author: Brendan G. Lim <brendan@intridea.com>
193
+ Date: Mon Feb 23 22:44:10 2009 -0500
194
+
195
+ Adding in Beeline (UA) to the list of carriers
196
+
197
+ commit c62df8bf641c3b2e009dd2e64e3585e610778519
198
+ Author: Brendan G. Lim <brendan@intridea.com>
199
+ Date: Wed Feb 18 20:26:00 2009 -0500
200
+
201
+ ... and I'm updating the changelog once again
202
+
203
+ commit 8abc7168dd392b083fdfd3a9cb2ce1e7c1d068a0
204
+ Author: Brendan G. Lim <brendan@intridea.com>
205
+ Date: Wed Feb 18 20:25:05 2009 -0500
206
+
207
+ Some structural changes to SMS Fu
208
+
209
+ commit 4e5aa349ac9d4c12da5d53de08d1fd3281bcfa0d
210
+ Author: Brendan G. Lim <brendan@intridea.com>
211
+ Date: Wed Feb 18 20:12:55 2009 -0500
212
+
213
+ Updating CHANGELOG
214
+
215
+ commit 4c1b777458b90de5d7c01cf7d14ef0be2fdcc4e6
216
+ Author: Brendan G. Lim <brendan@intridea.com>
217
+ Date: Wed Feb 18 20:12:33 2009 -0500
218
+
219
+ Adding in some view helpers for mobile carrier select boxes and updating README
220
+
221
+ commit 0d804bdd6e48aa3eae548665c4740b2e2d4e3b86
222
+ Author: Brendan G. Lim <brendan@intridea.com>
223
+ Date: Mon Dec 15 14:17:16 2008 -0500
224
+
225
+ Adding Etisalat support and adding country designation to mobinil and movistar
226
+
227
+ commit 0d417e1f30f5b153e9658e5649144630b95c2ec1
228
+ Author: Brendan G. Lim <brendan@intridea.com>
229
+ Date: Thu Dec 11 19:09:20 2008 -0500
230
+
231
+ Adding Vodafone Egypt, Virgin Mobile Canada, and Mobitel Sri Lanka to supported SMS carriers
232
+
233
+ commit ec20bd73afe7c26583bcdb7037028161f65cc8a5
234
+ Author: Brendan G. Lim <brendan@intridea.com>
235
+ Date: Thu Dec 11 13:31:17 2008 -0500
236
+
237
+ Adding a good chunk of carriers into SMS Fu
238
+
239
+ commit 17f23b116729beaf6dc399d1111f18f0a07b0619
240
+ Author: Michael Edwards <medwards@pilgrim.walledcity.ca>
241
+ Date: Sat Sep 6 22:00:05 2008 -0600
242
+
243
+ added canadian carriers
244
+
245
+ commit 8d9a829177f6a249206892ccc7a13b8ae5467496
246
+ Author: Brendan G. Lim <brendan@intridea.com>
247
+ Date: Thu Jul 31 13:48:30 2008 -0400
248
+
249
+ Upating the CHANGELOG
250
+
251
+ commit 3912b0b91621ba1a827585f3b22c1426fc70c9e4
252
+ Author: Brendan G. Lim <brendan@intridea.com>
253
+ Date: Thu Jul 31 13:48:15 2008 -0400
254
+
255
+ Adding ability to specify custom from address per mailing
256
+
257
+ commit 09fc1fa3076082d98b61f7cdf0d10dd5abd30a1a
258
+ Author: Brendan G. Lim <brendan@intridea.com>
259
+ Date: Thu Jun 19 02:18:09 2008 -0400
260
+
261
+ Updating CHANGELOG
262
+
263
+ commit f1026d0aca169caf57dd44e57661177bd66e2e37
264
+ Author: Brendan G. Lim <brendan@intridea.com>
265
+ Date: Thu Jun 19 02:17:08 2008 -0400
266
+
267
+ Updating to be compatibile with Rails 2.1
268
+
269
+ commit de241d15bfa878f600a462f49b4fd3c92285c3ab
270
+ Author: Brendan G. Lim <brendan@intridea.com>
271
+ Date: Sat May 31 10:05:16 2008 -0700
272
+
273
+ Merging in changes from gcnovus for fixing warnings and redundant YAML parsing when requiring sms_fu more than once.
274
+
275
+ commit d23d86216ffc5a6b44db5b354934f40178e9dfc0
276
+ Author: Brendan G. Lim <brendan@intridea.com>
277
+ Date: Sat Apr 19 01:23:45 2008 -0500
278
+
279
+ Another update to README
280
+
281
+ commit e8386f3b75f5f4794d5f280025772a34e79542ba
282
+ Author: Brendan G. Lim <brendan@intridea.com>
283
+ Date: Sat Apr 19 01:23:17 2008 -0500
284
+
285
+ Another update to README
286
+
287
+ commit d16925d6f60669d492005b419df212d26b3d21bd
288
+ Author: Brendan G. Lim <brendan@intridea.com>
289
+ Date: Sat Apr 19 01:17:51 2008 -0500
290
+
291
+ Adding in kajeet to carrier list and updated README
292
+
293
+ commit 9cf4ef9db332418dd167bd942f29ed34d11f20f9
294
+ Author: Jannis Leidel <jannis@leidel.info>
295
+ Date: Sat Apr 12 13:40:30 2008 +0200
296
+
297
+ added some international carriers
298
+
299
+ commit 364997b52bdb1c7ae8b3382b4742b5fbd52fb20c
300
+ Author: Brendan G. Lim <brendan@intridea.com>
301
+ Date: Mon Mar 31 18:23:53 2008 -0400
302
+
303
+ Fixed indentation of README and minor tweak
304
+
305
+ commit 5ecbaaee4d38543a66767b02d5b41ef9e885f2d5
306
+ Author: Brendan G. Lim <brendan@intridea.com>
307
+ Date: Mon Mar 31 18:18:40 2008 -0400
308
+
309
+ Fixed some of the tests
310
+
311
+ commit cb0138f5f1f637bcd5065e548b0dac04d413acd8
312
+ Author: Brendan G. Lim <brendan@intridea.com>
313
+ Date: Mon Mar 31 17:58:07 2008 -0400
314
+
315
+ Quick fix for international numbers
316
+
317
+ commit fc874c849ed5fb4f7b1e35b3e6b0e1496b95cf4f
318
+ Author: Brendan G. Lim <brendan@intridea.com>
319
+ Date: Mon Mar 31 17:45:09 2008 -0400
320
+
321
+ Updating README with International carrier information
322
+
323
+ commit 7813e59c8535f6180852a534fd0bfd7ba6085ace
324
+ Author: Brendan G. Lim <brendan@intridea.com>
325
+ Date: Mon Mar 31 17:37:02 2008 -0400
326
+
327
+ Adding in international support and externalizing carrier list into sms_fu.yml
328
+
329
+ commit 5393cc834ce85da8856ed8869e7b5e66b004239f
330
+ Author: Brendan G. Lim <brendan@intridea.com>
331
+ Date: Sun Mar 30 19:01:20 2008 -0400
332
+
333
+ Made some readme changes
334
+
335
+ commit aba05f07d765306b5bd5f6c403a318092a437c0b
336
+ Author: Brendan G. Lim <brendan@intridea.com>
337
+ Date: Sun Mar 30 16:10:05 2008 -0400
338
+
339
+ Initial import
@@ -0,0 +1,20 @@
1
+ Copyright (c) 2008-2010 Brendan G. Lim (brendan@intridea.com)
2
+
3
+ Permission is hereby granted, free of charge, to any person obtaining
4
+ a copy of this software and associated documentation files (the
5
+ "Software"), to deal in the Software without restriction, including
6
+ without limitation the rights to use, copy, modify, merge, publish,
7
+ distribute, sublicense, and/or sell copies of the Software, and to
8
+ permit persons to whom the Software is furnished to do so, subject to
9
+ the following conditions:
10
+
11
+ The above copyright notice and this permission notice shall be
12
+ included in all copies or substantial portions of the Software.
13
+
14
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
15
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
16
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
17
+ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
18
+ LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
19
+ OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
20
+ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
@@ -0,0 +1,137 @@
1
+ = SMS Fu (sms_fu)
2
+
3
+ Want to send an SMS from your Ruby application? SMS Fu allows you to do just that.
4
+ It allows you to send a text message in the form of an e-mail to a cell phone on any
5
+ of the many supported carriers.
6
+
7
+ == Supported Carriers (US & International):
8
+
9
+ Alltel, Ameritech, AT&T, Bell Atlantic, BellSouth Mobility, Beeline(UA), BlueSkyFrog,
10
+ Boost Mobile, BPL Mobile, Cellular South, Claro (Brazil, Nicaragua), Comcast, Du,
11
+ E-Plus, Etisalat, Fido, kajeet, Mobinil, Mobitel, Movistar, Metro PCS, O2, Orange,
12
+ Powertel, PSC Wireless, Qwest, Rogers, Southern Link, Sprint, Suncom,
13
+ T-Mobile (US/UK/Germany), Telefonica, Tracfone, Virgin Mobile, Verizon Wireless,
14
+ Vodafone (UK, Egypt, Italy, Japan, Spain), and many more ...
15
+
16
+ == Opt-In Warning for Some International Carriers
17
+
18
+ Some International carriers require that their users subscribe to an Email to SMS
19
+ feature before they are able to receive SMS messages this way. If one your users
20
+ mentions that they are not receiving their messages, chances are it is due to this
21
+ limitation.
22
+
23
+ Some carriers that need this include, Mobitel, Etisalat, T-Mobile (Netherlands),
24
+ etc.
25
+
26
+ == Requirements
27
+
28
+ * SMS Fu requires that 'action_mailer' (>= 3.0.0rc2) and 'pony' (>= 1.0) are installed.
29
+
30
+ * If you require SMS Fu on an older version of ActionMailer, make sure to use the older plugin version of SMS Fu at http://github.com/brendanlim/sms-fu/tree/plugin
31
+
32
+ == Setup Instructions
33
+
34
+ * Install sms_fu gem
35
+
36
+ sudo gem install sms_fu
37
+
38
+ * Add sms_fu.yml to your config folder (Rails only)
39
+
40
+ http://github.com/brendanlim/sms-fu/blob/master/templates/sms_fu.yml
41
+
42
+ * (Optional) Modify sms_fu.yml in your config folder with your reply-to e-mail address.
43
+
44
+ == Numbers and Carriers
45
+
46
+ * You have to send in the phone number, without any non-numeric characters. The
47
+ phone numbers must be 10 digits in length.
48
+ * The two required parameters are the phone number and the phone carrier.
49
+ * Here are some of the default carrier values:
50
+
51
+ Alltel Wireless => "alltel"
52
+ AT&T/Cingular => "at&t"
53
+ Boost Mobile => "boost"
54
+ Sprint Wireless => "sprint"
55
+ T-Mobile US => "t-mobile"
56
+ T-Mobile UK => "t-mobile-uk"
57
+ Virgin Mobile => "virgin"
58
+ Verizon Wireless => "verizon"
59
+ Vodafone Tokyo => "vodafone-jp-tokyo"
60
+
61
+ * Check sms_fu.yml for a complete list of supported carriers, including international
62
+ carriers as well.
63
+
64
+ == Configuration and Usage
65
+
66
+ * SMS Fu relies on either ActionMailer or Pony for delivery. You can now specify
67
+ which you'd like to use for delivery.
68
+
69
+ * You can use your ActionMailer settings by just specifying the :delivery option as
70
+ :action_mailer.
71
+
72
+ * If you would like to use Pony, you can configure it to use :sendmail or :smtp via
73
+ Pony. Set the :delivery option to :pony and then make sure to specify the
74
+ :pony_options as well, if necessary.
75
+
76
+ # ActionMailer delivery
77
+ sms_fu = SMSFu.configure(:action_mailer)
78
+
79
+ # Pony delivery via Sendmail
80
+ sms_fu = SMSFu.configure(:pony, :pony_options => { :via => :sendmail })
81
+
82
+ # Pony delivery via SMTP
83
+ sms_fu = SMSFu.configure(:pony, :pony_options => { :via => :smtp,
84
+ :via_options => {
85
+ :address => 'smtp.gmail.com',
86
+ :port => '587',
87
+ :user_name => 'username',
88
+ :password => 'password',
89
+ :authentication => :plain,
90
+ :domain => "localhost.localdomain"
91
+ :enable_starttls_auto => true,
92
+ }})
93
+
94
+ * You can view more pony 'via_options' at http://github.com/benprew/pony
95
+
96
+ * Basic delivery
97
+
98
+ sms_fu.deliver("5558675309","at&t","message")
99
+
100
+ * If you want to set a custom from e-mail per SMS message, you can do so
101
+ by doing the following.
102
+
103
+ sms_fu.deliver("5558675309","at&t","message", :from => "bob@test.com")
104
+
105
+ * You can set the maximum length of the SMS message, which is not set by
106
+ default. Most phones can only accept 128 characters. To do this just
107
+ specify the limit option.
108
+
109
+ sms_fu.deliver("5558675309","at&t","message", :limit => 128)
110
+
111
+ * You can retrieve just the formatted address to use in your own mailer.
112
+
113
+ sms_fu.sms_address("5558675309","at&t") # => "5558675309@txt.att.net"
114
+
115
+ == View Helpers (Rails)
116
+
117
+ * Retrieve a collection of all carriers
118
+
119
+ <%= carrier_collection %>
120
+
121
+ * Display a select box with mobile carriers
122
+
123
+ <%= carrier_select %>
124
+
125
+ * Display a custom select box with mobile carriers
126
+
127
+ <%= carrier_select('user[carrier_name]', "Please choose a carrier") %>
128
+
129
+ == Special Thanks
130
+
131
+ I want to thank the following individuals with their help with adding some patches to SMS Fu:
132
+
133
+ * Brent Collier (brentmc79)
134
+ * Peter Boling (pboling)
135
+ * Mike (mic)
136
+
137
+ Copyright (c) 2010 Brendan G. Lim, Intridea, Inc., released under the MIT license
@@ -0,0 +1,23 @@
1
+ require 'rake'
2
+ require 'rake/testtask'
3
+ require 'rake/rdoctask'
4
+
5
+ desc 'Default: run unit tests.'
6
+ task :default => :test
7
+
8
+ desc 'Test the sms_fu plugin.'
9
+ Rake::TestTask.new(:test) do |t|
10
+ t.libs << 'lib'
11
+ t.pattern = 'test/**/*_test.rb'
12
+ t.verbose = true
13
+ end
14
+
15
+ desc 'Generate documentation for the sms_fu plugin.'
16
+ Rake::RDocTask.new(:rdoc) do |rdoc|
17
+ rdoc.rdoc_dir = 'rdoc'
18
+ rdoc.title = 'SmsFu'
19
+ rdoc.options << '--line-numbers' << '--inline-source'
20
+ rdoc.rdoc_files.include('README')
21
+ rdoc.rdoc_files.include('lib/**/*.rb')
22
+ end
23
+
@@ -0,0 +1,4 @@
1
+ require 'ftools'
2
+ require 'fileutils'
3
+ puts IO.read(File.join(File.dirname(__FILE__), 'README.rdoc'))
4
+ File.copy(File.dirname(__FILE__)+'/templates/sms_fu.yml', File.dirname(__FILE__)+'/../../../config')
@@ -0,0 +1,7 @@
1
+ require 'action_mailer'
2
+ require 'pony'
3
+ require 'yaml'
4
+
5
+ require 'sms_fu/sms_fu'
6
+ require 'sms_fu/sms_fu_helper'
7
+ require 'sms_fu/sms_notifier'
@@ -0,0 +1,112 @@
1
+ module SMSFu
2
+ class Client
3
+ DELIVERY_METHODS = [:action_mailer, :pony]
4
+ attr_accessor :delivery, :pony_config
5
+
6
+ # Sets up a new SMSFu::Client. Allows for use of ActionMailer or
7
+ # Pony for e-mail delivery. Pony requires :pony_config to be
8
+ # defined to work properly.
9
+ #
10
+ # * ActionMailer 3
11
+ # sms_fu = SMSFu::Client.configure(:delivery => :action_mailer)
12
+ #
13
+ # * Pony 1.0
14
+ # sms_fu = SMSFu::Client.configure(:delivery => :pony,
15
+ # :pony_config => { :via => :sendmail })
16
+ #
17
+ def self.configure(opts = {})
18
+ new(opts)
19
+ end
20
+
21
+ def initialize(opts = {})
22
+ self.delivery = opts[:delivery].to_sym
23
+ self.pony_config = opts[:pony_config]
24
+ raise SMSFuException.new("Pony configuration required") if @delivery == :pony && @pony_config.nil?
25
+ end
26
+
27
+ def delivery=(new_delivery)
28
+ if DELIVERY_METHODS.include?(new_delivery.to_sym)
29
+ @delivery = new_delivery
30
+ else
31
+ raise SMSFuException.new("Delivery options can only be: '#{DELIVERY_METHODS.join(", ")}'")
32
+ end
33
+ end
34
+
35
+ # Delivers the SMS message in the form of an e-mail
36
+ # sms_fu.deliver("1234567890","at&t","hello world")
37
+ def deliver(number, carrier, message, options = {})
38
+ raise SMSFuException.new("Can't deliver blank message to #{format_number(number)}") if message.nil? || message.empty?
39
+
40
+ limit = options[:limit] || message.length
41
+ from = options[:from] || SMSFu.from_address
42
+ message = message[0..limit-1]
43
+ email = SMSFu.sms_address(number,carrier)
44
+
45
+ if @delivery == :pony
46
+ Pony.mail({:to => email, :body => message, :from => from}.merge!(@pony_config))
47
+ else
48
+ SMSNotifier.send_sms(email, message, from).deliver
49
+ end
50
+ end
51
+ end
52
+
53
+ class << self
54
+ def config_yaml
55
+ @@config_yaml ||= YAML::load(File.open("#{template_directory}/sms_fu.yml"))
56
+ end
57
+
58
+ # Returns back a list of all carriers
59
+ # SMSFu.carriers
60
+ def carriers
61
+ config_yaml['carriers']
62
+ end
63
+
64
+ def from_address
65
+ config_yaml['config']['from_address']
66
+ end
67
+
68
+ def carrier_name(key)
69
+ carrier(key)['name']
70
+ end
71
+
72
+ def carrier_email(key)
73
+ carrier(key.downcase)['value']
74
+ end
75
+
76
+ def carrier(key)
77
+ raise SMSFuException.new("Carrier (#{key}) is not supported") unless SMSFu.carriers.has_key?(key.downcase)
78
+ carriers[key]
79
+ end
80
+
81
+ # Returns back a properly formatted SMS e-mail address
82
+ # SMSFu.sms_address("1234567890","at&t")
83
+ def sms_address(number,carrier)
84
+ raise SMSFuException.new("Missing number or carrier") if number.nil? || carrier.nil?
85
+ format_number(number) + carrier_email(carrier.downcase)
86
+ end
87
+
88
+ protected
89
+
90
+ def format_number(number)
91
+ stripped = number.gsub("-","").strip
92
+ formatted = (stripped.length == 11 && stripped[0,1] == "1") ? stripped[1..stripped.length] : stripped
93
+ raise SMSFuException.new("Number (#{number}) is not formatted correctly") unless valid_number?(formatted)
94
+ formatted
95
+ end
96
+
97
+ def valid_number?(number)
98
+ number.length >= 10 && number[/^.\d+$/]
99
+ end
100
+
101
+ def template_directory
102
+ directory = defined?(Rails) ? "#{RAILS_ROOT}/config" : "#{File.dirname(__FILE__)}/../../templates"
103
+ if (defined?(Rails) && Rails.env == 'test') || (defined?(RAILS_ENV) && RAILS_ENV == 'test)')
104
+ "#{File.dirname(__FILE__)}/../../templates"
105
+ else
106
+ directory
107
+ end
108
+ end
109
+ end
110
+ end
111
+
112
+ class SMSFuException < StandardError; end
@@ -0,0 +1,19 @@
1
+ module SMSFuHelper
2
+ # Returns a collection of carriers to be used in your own select tag
3
+ # e.g., <%= f.select :mobile_carrier, carrier_collection %>
4
+ def carrier_collection
5
+ SMSFu.carriers.sort.collect{ |carrier| [carrier[1]["name"], carrier[0]] }
6
+ end
7
+
8
+ # Returns a formatted select box filled with carriers
9
+ # e.g., <%= carrier_select %>
10
+ # - name => name of the method in which you want to store the carrier name
11
+ # - phrase => default selected blank option in select box
12
+ # - selected => carrier to pre-select
13
+ # - include_blank => Do you want the blank option tag (in ADDITION to the value-less 'phrase' option above)?
14
+ def carrier_select(name = :mobile_carrier, phrase = "Select a Carrier", selected = nil, include_blank = true)
15
+ options = phrase.nil? ? carrier_collection : include_blank ? [phrase,nil] + carrier_collection : [phrase] + carrier_collection
16
+ select_tag name, options_for_select(options, selected || phrase)
17
+ end
18
+
19
+ end
@@ -0,0 +1,8 @@
1
+ class SMSNotifier < ActionMailer::Base
2
+ def send_sms(recipient, message, sender_email)
3
+ mail(:to => recipient, :from => sender_email, :subject => '') do |format|
4
+ format.text { render :text => message }
5
+ format.html { render :text => message }
6
+ end
7
+ end
8
+ end
@@ -0,0 +1,55 @@
1
+ # -*- encoding: utf-8 -*-
2
+
3
+ Gem::Specification.new do |s|
4
+ s.name = %q{sms_fu}
5
+ s.version = "1.1.1"
6
+
7
+ s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
8
+ s.authors = ["Brendan G. Lim"]
9
+ s.date = %q{2010-08-23}
10
+ s.description = %q{SMS Fu allows you to send text messages to a mobile recipient for free. It leverages ActionMailer or Pony for delivery of text messages through e-mail.}
11
+ s.email = %q{brendangl@gmail.com}
12
+ s.extra_rdoc_files = [
13
+ "README.rdoc"
14
+ ]
15
+ s.files = [
16
+ "CHANGELOG",
17
+ "MIT-LICENSE",
18
+ "README.rdoc",
19
+ "Rakefile",
20
+ "install.rb",
21
+ "lib/sms_fu.rb",
22
+ "lib/sms_fu/sms_fu.rb",
23
+ "lib/sms_fu/sms_fu_helper.rb",
24
+ "lib/sms_fu/sms_notifier.rb",
25
+ "sms_fu.gemspec",
26
+ "tasks/sms_fu_tasks.rake",
27
+ "templates/sms_fu.yml",
28
+ "test/sms_fu_test.rb"
29
+ ]
30
+ s.has_rdoc = true
31
+ s.homepage = %q{http://github.com/brendanlim/sms-fu}
32
+ s.rdoc_options = ["--charset=UTF-8"]
33
+ s.require_paths = ["lib"]
34
+ s.rubygems_version = %q{1.3.1}
35
+ s.summary = %q{sms_fu allows you to send free text messages to a mobile recipient.}
36
+ s.test_files = [
37
+ "test/sms_fu_test.rb"
38
+ ]
39
+
40
+ if s.respond_to? :specification_version then
41
+ current_version = Gem::Specification::CURRENT_SPECIFICATION_VERSION
42
+ s.specification_version = 3
43
+
44
+ if Gem::Version.new(Gem::RubyGemsVersion) >= Gem::Version.new('1.2.0') then
45
+ s.add_development_dependency(%q<action_mailer>, [">= 3.0.0.rc2"])
46
+ s.add_development_dependency(%q<pony>, [">= 1.0"])
47
+ else
48
+ s.add_dependency(%q<action_mailer>, [">= 3.0.0.rc2"])
49
+ s.add_dependency(%q<pony>, [">= 1.0"])
50
+ end
51
+ else
52
+ s.add_dependency(%q<action_mailer>, [">= 3.0.0.rc2"])
53
+ s.add_dependency(%q<pony>, [">= 1.0"])
54
+ end
55
+ end
File without changes
@@ -0,0 +1,233 @@
1
+ config:
2
+ from_address: noreply@domain.com
3
+
4
+ carriers:
5
+ alltel:
6
+ name: Alltel
7
+ value: @message.alltel.com
8
+ ameritech:
9
+ name: Ameritech
10
+ value: @paging.acswireless.com
11
+ at&t:
12
+ name: AT&T
13
+ value: @txt.att.net
14
+ bell-atlantic:
15
+ name: Bell Atlantic
16
+ value: @message.bam.com
17
+ bellsouthmobility:
18
+ name: Bellsouth Mobility
19
+ value: @blsdcs.net
20
+ blueskyfrog:
21
+ name: BlueSkyFrog
22
+ value: @blueskyfrog.com
23
+ boost:
24
+ name: Boost Mobile
25
+ value: @myboostmobile.com
26
+ cellularsouth:
27
+ name: Cellular South
28
+ value: @csouth1.com
29
+ comcast:
30
+ name: Comcast PCS
31
+ value: @comcastpcs.textmsg.com
32
+ cricket:
33
+ name: Cricket
34
+ value: @sms.mycricket.com
35
+ kajeet:
36
+ name: kajeet
37
+ value: @mobile.kajeet.net
38
+ metropcs:
39
+ name: Metro PCS
40
+ value: @mymetropcs.com
41
+ nextel:
42
+ name: Nextel
43
+ value: @messaging.nextel.com
44
+ powertel:
45
+ name: Powertel
46
+ value: @ptel.net
47
+ pscwireless:
48
+ name: PSC Wireless
49
+ value: @sms.pscel.com
50
+ qwest:
51
+ name: Qwest
52
+ value: @qwestmp.com
53
+ southernlink:
54
+ name: Southern Link
55
+ value: @page.southernlinc.com
56
+ sprint:
57
+ name: Sprint PCS
58
+ value: @messaging.sprintpcs.com
59
+ suncom:
60
+ name: Suncom
61
+ value: @tms.suncom.com
62
+ t-mobile:
63
+ name: T-Mobile
64
+ value: @tmomail.net
65
+ tracfone:
66
+ name: Tracfone
67
+ value: @mmst5.tracfone.com
68
+ telus-mobility:
69
+ name: Telus Mobility
70
+ value: @msg.telus.com
71
+ virgin:
72
+ name: Virgin Mobile
73
+ value: @vmobl.net
74
+ verizon:
75
+ name: Verizon Wireless
76
+ value: @vtext.com
77
+ # International Carriers
78
+ aliant-canada:
79
+ name: Aliant (Canada)
80
+ value: @chat.wirefree.ca
81
+ beeline-ua:
82
+ name: Beeline
83
+ value: @sms.beeline.ua
84
+ bellmobility-canada:
85
+ name: Bell Mobility (Canada)
86
+ value: @txt.bell.ca
87
+ bpl-mobile:
88
+ name: BPL Mobile
89
+ value: @bplmobile.com
90
+ claro-brazil:
91
+ name: Claro (Brazil)
92
+ value: @clarotorpedo.com.br
93
+ claro-nicaragua:
94
+ name: Claro (Nicaragua)
95
+ value: @ideasclaro-ca.com
96
+ du-arab-emirates:
97
+ name: Du (UAE)
98
+ value: @email2sms.ae
99
+ e-plus-germany:
100
+ name: E-Plus (Germany)
101
+ value: @smsmail.eplus.de
102
+ etisalat-arab-emirates:
103
+ name: Etisalat (UAE)
104
+ value: @email2sms.ae
105
+ fido-canada:
106
+ name: Fido
107
+ value: @fido.ca
108
+ manitobatelecom-canada:
109
+ name: Manitoba Telecom (Canada)
110
+ value: @text.mtsmobility.com
111
+ mobinil-egypt:
112
+ name: Mobinil
113
+ value: @mobinil.net
114
+ mobistar-belgium:
115
+ name: Mobistar (Belgium)
116
+ value: @mobistar.be
117
+ mobitel:
118
+ name: Mobitel
119
+ value: @sms.mobitel.lk
120
+ movistar-spain:
121
+ name: Movistar (Spain)
122
+ value: @correo.movistar.net
123
+ northerntel-canada:
124
+ name: NorthernTel (Canada)
125
+ value: @txt.northerntelmobility.com
126
+ o2-germany:
127
+ name: o2 (Germany)
128
+ value: @o2online.de
129
+ o2-uk:
130
+ name: o2 (UK)
131
+ value: @mmail.co.uk
132
+ orange-mumbai:
133
+ name: Orange (Mumbai)
134
+ value: @orangemail.co.in
135
+ orange-netherlands:
136
+ name: Orange (Netherlands)
137
+ value: @sms.orange.nl
138
+ orange-uk:
139
+ name: Orange (UK)
140
+ value: @orange.net
141
+ rogers-wireless:
142
+ name: Rogers Wireless
143
+ value: @pcs.rogers.com
144
+ rogers-canada:
145
+ name: Rogers (Canada)
146
+ value: @pcs.rogers.ca
147
+ sasktel-canada:
148
+ name: SaskTel (canada)
149
+ value: @sms.sasktel.ca
150
+ sfr-france:
151
+ name: SFR (France)
152
+ value: @sfr.fr
153
+ t-mobile-austria:
154
+ name: T-Mobile (Austria)
155
+ value: @sms.t-mobile.at
156
+ t-mobile-germany:
157
+ name: T-Mobile (Germany)
158
+ value: @t-d1-sms.de
159
+ t-mobile-germany:
160
+ name: T-Mobile (Netherlands)
161
+ value: @gin.nl
162
+ t-mobile-uk:
163
+ name: T-Mobile (UK)
164
+ value: @t-mobile.uk.net
165
+ telebec-canada:
166
+ name: Telebec (Canada)
167
+ value: @txt.telebecmobilite.com
168
+ telefonica-spain:
169
+ name: Telefonica (Spain)
170
+ value: @movistar.net
171
+ telus-canada:
172
+ name: Telus (Canada)
173
+ value: @msg.telus.com
174
+ virgin-canada:
175
+ name: Virgin (Canada)
176
+ value: @vmobile.ca
177
+ vodafone-germany:
178
+ name: Vodafone (Germany)
179
+ value: @vodafone-sms.de
180
+ vodafone-egypt:
181
+ name: Vodafone (Egypt)
182
+ value: @vodafone.com.eg
183
+ vodafone-uk:
184
+ name: Vodafone (UK)
185
+ value: @sms.vodafone.net
186
+ vodafone-italy:
187
+ name: Vodafone (Italy)
188
+ value: @sms.vodafone.it
189
+ vodafone-jp-chuugoku:
190
+ name: Vodafone (Japan - Chuugoku)
191
+ value: @n.vodafone.ne.jp
192
+ vodafone-jp-hokkaido:
193
+ name: Vodafone (Japan - Hokkaido)
194
+ value: @d.vodafone.ne.jp
195
+ vodafone-jp-hokuriko:
196
+ name: Vodafone (Japan - Hokuriko)
197
+ value: @r.vodafone.ne.jp
198
+ vodafone-jp-kansai:
199
+ name: Vodafone (Japan - Kansai)
200
+ value: @k.vodafone.ne.jp
201
+ vodafone-jp-osaka:
202
+ name: Vodafone (Japan - Osaka)
203
+ value: @k.vodafone.ne.jp
204
+ vodafone-jp-kanto:
205
+ name: Vodafone (Japan - Kanto)
206
+ value: @k.vodafone.ne.jp
207
+ vodafone-jp-koushin:
208
+ name: Vodafone (Japan - Koushin)
209
+ value: @k.vodafone.ne.jp
210
+ vodafone-jp-tokyo:
211
+ name: Vodafone (Japan - Tokyo)
212
+ value: @k.vodafone.ne.jp
213
+ vodafone-jp-kyuushu:
214
+ name: Vodafone (Japan - Kyuushu)
215
+ value: @q.vodafone.ne.jp
216
+ vodafone-jp-okinawa:
217
+ name: Vodafone (Japan - Okinawa)
218
+ value: @q.vodafone.ne.jp
219
+ vodafone-jp-shikoku:
220
+ name: Vodafone (Japan - Shikoku)
221
+ value: @s.vodafone.ne.jp
222
+ vodafone-jp-touhoku:
223
+ name: Vodafone (Japan - Touhoku)
224
+ value: @h.vodafone.ne.jp
225
+ vodafone-jp-niigata:
226
+ name: Vodafone (Japan - Niigata)
227
+ value: @h.vodafone.ne.jp
228
+ vodafone-jp-toukai:
229
+ name: Vodafone (Japan - Toukai)
230
+ value: @h.vodafone.ne.jp
231
+ vodafone-spain:
232
+ name: Vodafone (Japan - Spain)
233
+ value: @vodafone.es
@@ -0,0 +1,22 @@
1
+ require File.dirname(__FILE__) + '/test_helper'
2
+
3
+ class SmsFuTest < Test::Unit::TestCase
4
+ include SMSFu
5
+
6
+ def test_validity_of_number
7
+ assert_raise(SMSFuException) { deliver_sms("456789011","AT&T","Message") }
8
+ assert_equal("5555555555@txt.att.net", get_sms_address("1-555-555-5555","AT&T"))
9
+ end
10
+
11
+ def test_international_number
12
+ assert_equal("+445555555555@txt.att.net", get_sms_address("+44-555-555-5555","AT&T"))
13
+ end
14
+
15
+ def test_handling_of_blank_message
16
+ assert_raise(SMSFuException) { deliver_sms("1234567890","AT&T","") }
17
+ end
18
+
19
+ def test_get_sms_address
20
+ assert_equal("1234567890@txt.att.net", get_sms_address("1234567890","AT&T"))
21
+ end
22
+ end
metadata ADDED
@@ -0,0 +1,110 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: sms_fu
3
+ version: !ruby/object:Gem::Version
4
+ hash: 17
5
+ prerelease: false
6
+ segments:
7
+ - 1
8
+ - 1
9
+ - 1
10
+ version: 1.1.1
11
+ platform: ruby
12
+ authors:
13
+ - Brendan G. Lim
14
+ autorequire:
15
+ bindir: bin
16
+ cert_chain: []
17
+
18
+ date: 2010-08-23 00:00:00 -05:00
19
+ default_executable:
20
+ dependencies:
21
+ - !ruby/object:Gem::Dependency
22
+ name: action_mailer
23
+ prerelease: false
24
+ requirement: &id001 !ruby/object:Gem::Requirement
25
+ none: false
26
+ requirements:
27
+ - - ">="
28
+ - !ruby/object:Gem::Version
29
+ hash: 977940607
30
+ segments:
31
+ - 3
32
+ - 0
33
+ - 0
34
+ - rc2
35
+ version: 3.0.0.rc2
36
+ type: :development
37
+ version_requirements: *id001
38
+ - !ruby/object:Gem::Dependency
39
+ name: pony
40
+ prerelease: false
41
+ requirement: &id002 !ruby/object:Gem::Requirement
42
+ none: false
43
+ requirements:
44
+ - - ">="
45
+ - !ruby/object:Gem::Version
46
+ hash: 15
47
+ segments:
48
+ - 1
49
+ - 0
50
+ version: "1.0"
51
+ type: :development
52
+ version_requirements: *id002
53
+ description: SMS Fu allows you to send text messages to a mobile recipient for free. It leverages ActionMailer or Pony for delivery of text messages through e-mail.
54
+ email: brendangl@gmail.com
55
+ executables: []
56
+
57
+ extensions: []
58
+
59
+ extra_rdoc_files:
60
+ - README.rdoc
61
+ files:
62
+ - CHANGELOG
63
+ - MIT-LICENSE
64
+ - README.rdoc
65
+ - Rakefile
66
+ - install.rb
67
+ - lib/sms_fu.rb
68
+ - lib/sms_fu/sms_fu.rb
69
+ - lib/sms_fu/sms_fu_helper.rb
70
+ - lib/sms_fu/sms_notifier.rb
71
+ - sms_fu.gemspec
72
+ - tasks/sms_fu_tasks.rake
73
+ - templates/sms_fu.yml
74
+ - test/sms_fu_test.rb
75
+ has_rdoc: true
76
+ homepage: http://github.com/brendanlim/sms-fu
77
+ licenses: []
78
+
79
+ post_install_message:
80
+ rdoc_options:
81
+ - --charset=UTF-8
82
+ require_paths:
83
+ - lib
84
+ required_ruby_version: !ruby/object:Gem::Requirement
85
+ none: false
86
+ requirements:
87
+ - - ">="
88
+ - !ruby/object:Gem::Version
89
+ hash: 3
90
+ segments:
91
+ - 0
92
+ version: "0"
93
+ required_rubygems_version: !ruby/object:Gem::Requirement
94
+ none: false
95
+ requirements:
96
+ - - ">="
97
+ - !ruby/object:Gem::Version
98
+ hash: 3
99
+ segments:
100
+ - 0
101
+ version: "0"
102
+ requirements: []
103
+
104
+ rubyforge_project:
105
+ rubygems_version: 1.3.7
106
+ signing_key:
107
+ specification_version: 3
108
+ summary: sms_fu allows you to send free text messages to a mobile recipient.
109
+ test_files:
110
+ - test/sms_fu_test.rb