sms-easy 1.2.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.gitignore +17 -0
- data/MIT-LICENSE +22 -0
- data/README.rdoc +102 -0
- data/Rakefile +13 -0
- data/lib/sms-easy.rb +7 -0
- data/lib/sms/easy/easy.rb +73 -0
- data/lib/sms/easy/easy_helper.rb +19 -0
- data/lib/sms/easy/exception.rb +2 -0
- data/lib/sms/easy/notifier.rb +8 -0
- data/lib/sms/easy/version.rb +3 -0
- data/rails/init.rb +2 -0
- data/sms-easy.gemspec +27 -0
- data/templates/sms-easy.yml +233 -0
- data/test/lib/sms-easy/sms-easy_test.rb +26 -0
- data/test/test_helper.rb +5 -0
- metadata +107 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: 98f49ef1e704a1ff5f78d6f6e31870178d2084dc
|
4
|
+
data.tar.gz: 247be2d1b8482939d54a4a4e1504bf718c00456f
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 9e70ccb092f0a0487393d0543d044f7286031f4b013a7d3071f9731b30a7a9cb1538569b5b16eb417d5d72e7e7b53bdc9244314d5f194f574445c43f7454889b
|
7
|
+
data.tar.gz: 81ecdec9642d0bc26c31ba3fb3ead61818a3f92143eaf14e89acd4b683d62cf3b9297c7f6253e2da535ea9f022aadbad975d66463a2a59e6104024e391f5f0a4
|
data/.gitignore
ADDED
data/MIT-LICENSE
ADDED
@@ -0,0 +1,22 @@
|
|
1
|
+
(Modifications to original code 2013 by Preston Lee.)
|
2
|
+
|
3
|
+
Copyright (c) 2008-2010 Brendan G. Lim (brendan@intridea.com)
|
4
|
+
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining
|
6
|
+
a copy of this software and associated documentation files (the
|
7
|
+
"Software"), to deal in the Software without restriction, including
|
8
|
+
without limitation the rights to use, copy, modify, merge, publish,
|
9
|
+
distribute, sublicense, and/or sell copies of the Software, and to
|
10
|
+
permit persons to whom the Software is furnished to do so, subject to
|
11
|
+
the following conditions:
|
12
|
+
|
13
|
+
The above copyright notice and this permission notice shall be
|
14
|
+
included in all copies or substantial portions of the Software.
|
15
|
+
|
16
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
17
|
+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
18
|
+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
19
|
+
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
20
|
+
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
21
|
+
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
22
|
+
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
data/README.rdoc
ADDED
@@ -0,0 +1,102 @@
|
|
1
|
+
= SMSEasy (sms-easy)
|
2
|
+
|
3
|
+
SMSEasy allows you to send SMS messages from your Ruby application for free using email-to-text services provided by many carriers.
|
4
|
+
|
5
|
+
== Supported Carriers (US & International):
|
6
|
+
|
7
|
+
Alltel, Ameritech, AT&T, Bell Atlantic, BellSouth Mobility, Beeline(UA), BlueSkyFrog,
|
8
|
+
Boost Mobile, BPL Mobile, Cellular South, Claro (Brazil, Nicaragua), Comcast, Du,
|
9
|
+
E-Plus, Etisalat, Fido, kajeet, Mobinil, Mobitel, Movistar, Metro PCS, O2, Orange,
|
10
|
+
Powertel, PSC Wireless, Qwest, Rogers, Southern Link, Sprint, Suncom,
|
11
|
+
T-Mobile (US/UK/Germany), Telefonica, Tracfone, Virgin Mobile, Verizon Wireless,
|
12
|
+
Vodafone (UK, Egypt, Italy, Japan, Spain), and many more ...
|
13
|
+
|
14
|
+
Some International carriers require that their users subscribe to an Email to SMS
|
15
|
+
feature before they are able to receive SMS messages this way. If one your users
|
16
|
+
mentions that they are not receiving their messages, chances are it is due to this
|
17
|
+
limitation. Some of these carriers are include, Mobitel, Etisalat, T-Mobile (Netherlands).
|
18
|
+
|
19
|
+
== Requirements
|
20
|
+
|
21
|
+
* SMSEasy requires the use of a recent version of 'action_mailer'. Unlike the older sms-fu gem, *only* action_mailer 4.0.0+ is supported. If you have an older app, please try one of the older variants that supports action_mailer 3 and/or pony email agents.
|
22
|
+
|
23
|
+
|
24
|
+
== Setup Instructions
|
25
|
+
|
26
|
+
* Install sms-easy gem
|
27
|
+
|
28
|
+
gem install sms-easy
|
29
|
+
|
30
|
+
* Add sms-easy.yml to your config folder (Rails only)
|
31
|
+
|
32
|
+
http://github.com/preston/sms-easy/blob/master/templates/sms-easy.yml
|
33
|
+
|
34
|
+
* (Optional) Modify sms-easy.yml in your config folder with your reply-to e-mail address.
|
35
|
+
|
36
|
+
== Numbers and Carriers
|
37
|
+
|
38
|
+
* You have to send in the phone number, without any non-numeric characters. The
|
39
|
+
phone numbers must be 10 digits in length.
|
40
|
+
* The two required parameters are the phone number and the phone carrier.
|
41
|
+
* Here are some of the default carrier values:
|
42
|
+
|
43
|
+
Alltel Wireless => "alltel"
|
44
|
+
AT&T/Cingular => "at&t"
|
45
|
+
Boost Mobile => "boost"
|
46
|
+
Sprint Wireless => "sprint"
|
47
|
+
T-Mobile US => "t-mobile"
|
48
|
+
T-Mobile UK => "t-mobile-uk"
|
49
|
+
Virgin Mobile => "virgin"
|
50
|
+
Verizon Wireless => "verizon"
|
51
|
+
Vodafone Tokyo => "vodafone-jp-tokyo"
|
52
|
+
|
53
|
+
* Check sms-easy.yml for a complete list of supported carriers, including international
|
54
|
+
carriers as well.
|
55
|
+
|
56
|
+
== Usage
|
57
|
+
|
58
|
+
|
59
|
+
* Basic SMS delivery
|
60
|
+
|
61
|
+
sms-easy.deliver("5558675309","at&t","message")
|
62
|
+
|
63
|
+
* If you want to set a custom from e-mail per SMS message, you can do so
|
64
|
+
by doing the following.
|
65
|
+
|
66
|
+
sms-easy.deliver("5558675309","at&t","message", :from => "bob@test.com")
|
67
|
+
|
68
|
+
* You can set the maximum length of the SMS message, which is not set by
|
69
|
+
default. Most phones can only accept 128 characters. To do this just
|
70
|
+
specify the limit option.
|
71
|
+
|
72
|
+
sms-easy.deliver("5558675309","at&t","message", :limit => 128)
|
73
|
+
|
74
|
+
* You can retrieve just the formatted address to use in your own mailer.
|
75
|
+
|
76
|
+
SMSEasy.sms_address("5558675309","at&t") # => "5558675309@txt.att.net"
|
77
|
+
|
78
|
+
== View Helpers (Rails)
|
79
|
+
|
80
|
+
* Retrieve a collection of all carriers
|
81
|
+
|
82
|
+
<%= carrier_collection %>
|
83
|
+
|
84
|
+
* Display a select box with mobile carriers
|
85
|
+
|
86
|
+
<%= carrier_select %>
|
87
|
+
|
88
|
+
* Display a custom select box with mobile carriers
|
89
|
+
|
90
|
+
<%= carrier_select('user[carrier_name]', "Please choose a carrier") %>
|
91
|
+
|
92
|
+
== Special Thanks
|
93
|
+
|
94
|
+
I want to thank the following individuals with their help with adding some patches to SMS Fu:
|
95
|
+
|
96
|
+
* Brent Collier (brentmc79)
|
97
|
+
* Peter Boling (pboling)
|
98
|
+
* Mike (mic)
|
99
|
+
|
100
|
+
Copyright (c) 2010 Brendan G. Lim, Intridea, Inc., released under the MIT license
|
101
|
+
|
102
|
+
Additional modifications and updates by Preston Lee.
|
data/Rakefile
ADDED
data/lib/sms-easy.rb
ADDED
@@ -0,0 +1,73 @@
|
|
1
|
+
module SMSEasy
|
2
|
+
|
3
|
+
class Client
|
4
|
+
|
5
|
+
# Delivers the SMS message in the form of an e-mail
|
6
|
+
# sms-easy.deliver("1234567890","at&t","hello world")
|
7
|
+
def deliver(number, carrier, message, options = {})
|
8
|
+
raise SMSEasyException.new("Can't deliver blank message to #{SMSEasy::Client.format_number(number)}") if message.nil? || message.empty?
|
9
|
+
|
10
|
+
limit = options[:limit] || message.length
|
11
|
+
from = options[:from] || SMSEasy::Client.from_address
|
12
|
+
message = message[0..limit-1]
|
13
|
+
email = SMSEasy::Client.sms_address(number,carrier)
|
14
|
+
|
15
|
+
if @delivery == :pony
|
16
|
+
Pony.mail({:to => email, :body => message, :from => from}.merge!(@pony_config))
|
17
|
+
else
|
18
|
+
SMSEasyNotifier.send_sms(email, message, from).deliver
|
19
|
+
end
|
20
|
+
end
|
21
|
+
|
22
|
+
class << self
|
23
|
+
def config_yaml(opts = nil)
|
24
|
+
@@config_yaml = opts || YAML::load(File.open(File.join(File.dirname(__FILE__), '..', '..', '..', 'templates', 'sms-easy.yml')))
|
25
|
+
# require 'pp'
|
26
|
+
# pp @@config_yaml
|
27
|
+
end
|
28
|
+
|
29
|
+
# Returns back a list of all carriers
|
30
|
+
# SMSEasy.carriers
|
31
|
+
def carriers
|
32
|
+
config_yaml['carriers']
|
33
|
+
end
|
34
|
+
|
35
|
+
def from_address
|
36
|
+
config_yaml['config']['from_address']
|
37
|
+
end
|
38
|
+
|
39
|
+
def carrier_name(key)
|
40
|
+
carrier(key)['name']
|
41
|
+
end
|
42
|
+
|
43
|
+
def carrier_email(key)
|
44
|
+
carrier(key.downcase)['value']
|
45
|
+
end
|
46
|
+
|
47
|
+
def carrier(key)
|
48
|
+
raise SMSEasyException.new("Carrier (#{key}) is not supported") unless SMSEasy::Client.carriers.has_key?(key.downcase)
|
49
|
+
carriers[key]
|
50
|
+
end
|
51
|
+
|
52
|
+
# Returns back a properly formatted SMS e-mail address
|
53
|
+
# SMSEasy.sms_address("1234567890","at&t")
|
54
|
+
def sms_address(number,carrier)
|
55
|
+
raise SMSEasyException.new("Missing number or carrier") if number.nil? || carrier.nil?
|
56
|
+
format_number(number) + carrier_email(carrier.downcase)
|
57
|
+
end
|
58
|
+
|
59
|
+
def format_number(number)
|
60
|
+
stripped = number.gsub("-","").strip
|
61
|
+
formatted = (stripped.length == 11 && stripped[0,1] == "1") ? stripped[1..stripped.length] : stripped
|
62
|
+
raise SMSEasyException.new("Number (#{number}) is not formatted correctly") unless valid_number?(formatted)
|
63
|
+
formatted
|
64
|
+
end
|
65
|
+
|
66
|
+
def valid_number?(number)
|
67
|
+
number.length >= 10 && number[/^.\d+$/]
|
68
|
+
end
|
69
|
+
|
70
|
+
end
|
71
|
+
|
72
|
+
end
|
73
|
+
end
|
@@ -0,0 +1,19 @@
|
|
1
|
+
module SMSEasyHelper
|
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
|
+
SMSEasy::Client.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 SMSEasyNotifier < 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
|
data/rails/init.rb
ADDED
data/sms-easy.gemspec
ADDED
@@ -0,0 +1,27 @@
|
|
1
|
+
# coding: utf-8
|
2
|
+
lib = File.expand_path('../lib', __FILE__)
|
3
|
+
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
4
|
+
require 'sms/easy/version'
|
5
|
+
|
6
|
+
Gem::Specification.new do |spec|
|
7
|
+
spec.name = "sms-easy"
|
8
|
+
spec.version = SMSEasy::VERSION
|
9
|
+
spec.authors = ["Brendan G. Lim", "Raimond Garcia", "Preston Lee"]
|
10
|
+
spec.email = ["conmotto@gmail.com"]
|
11
|
+
spec.description = %q{SMSEasy allows you to send text messages to a mobile recipient for free. It leverages ActionMailer for delivery of text messages through e-mail. Based on the Brendan Lim's sms-easy.}
|
12
|
+
spec.summary = %q{SMSEasy allows you to send text messages to a mobile recipient for free.}
|
13
|
+
spec.homepage = "https://github.com/preston/sms-easy"
|
14
|
+
spec.license = "MIT"
|
15
|
+
|
16
|
+
spec.files = `git ls-files`.split($/)
|
17
|
+
spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
|
18
|
+
spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
|
19
|
+
spec.require_paths = ["lib"]
|
20
|
+
|
21
|
+
spec.add_dependency "actionmailer", '>= 4.0.0' # Already depends on minitest, so we don't need to add it. :)
|
22
|
+
|
23
|
+
spec.add_development_dependency "bundler"
|
24
|
+
spec.add_development_dependency "rake"
|
25
|
+
|
26
|
+
end
|
27
|
+
|
@@ -0,0 +1,233 @@
|
|
1
|
+
config:
|
2
|
+
from_address: noreply@example.com
|
3
|
+
# Loosely based on the Wikipedia page: https://en.wikipedia.org/wiki/List_of_SMS_gateways
|
4
|
+
carriers:
|
5
|
+
alltel:
|
6
|
+
name: Alltel
|
7
|
+
value: '@sms.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,26 @@
|
|
1
|
+
require_relative File.join('..', '..', 'test_helper')
|
2
|
+
|
3
|
+
describe SMSEasy do
|
4
|
+
|
5
|
+
before do
|
6
|
+
@client = SMSEasy::Client.new
|
7
|
+
end
|
8
|
+
|
9
|
+
it 'should validate phone number' do
|
10
|
+
assert_raises(SMSEasyException) { @client.deliver("456789011","AT&T","Message") }
|
11
|
+
assert_equal("5555555555@txt.att.net", SMSEasy::Client.sms_address("1-555-555-5555","AT&T"))
|
12
|
+
end
|
13
|
+
|
14
|
+
it 'should properly format international numbers' do
|
15
|
+
assert_equal("+445555555555@txt.att.net", SMSEasy::Client.sms_address("+44-555-555-5555","AT&T"))
|
16
|
+
end
|
17
|
+
|
18
|
+
it 'should not deliver blank messages' do
|
19
|
+
assert_raises(SMSEasyException) { @client.deliver("1234567890","AT&T","") }
|
20
|
+
end
|
21
|
+
|
22
|
+
it 'should get addresses properly' do
|
23
|
+
assert_equal("1234567890@txt.att.net", SMSEasy::Client.sms_address("1234567890","AT&T"))
|
24
|
+
end
|
25
|
+
|
26
|
+
end
|
data/test/test_helper.rb
ADDED
metadata
ADDED
@@ -0,0 +1,107 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: sms-easy
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 1.2.0
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Brendan G. Lim
|
8
|
+
- Raimond Garcia
|
9
|
+
- Preston Lee
|
10
|
+
autorequire:
|
11
|
+
bindir: bin
|
12
|
+
cert_chain: []
|
13
|
+
date: 2013-08-23 00:00:00.000000000 Z
|
14
|
+
dependencies:
|
15
|
+
- !ruby/object:Gem::Dependency
|
16
|
+
name: actionmailer
|
17
|
+
requirement: !ruby/object:Gem::Requirement
|
18
|
+
requirements:
|
19
|
+
- - '>='
|
20
|
+
- !ruby/object:Gem::Version
|
21
|
+
version: 4.0.0
|
22
|
+
type: :runtime
|
23
|
+
prerelease: false
|
24
|
+
version_requirements: !ruby/object:Gem::Requirement
|
25
|
+
requirements:
|
26
|
+
- - '>='
|
27
|
+
- !ruby/object:Gem::Version
|
28
|
+
version: 4.0.0
|
29
|
+
- !ruby/object:Gem::Dependency
|
30
|
+
name: bundler
|
31
|
+
requirement: !ruby/object:Gem::Requirement
|
32
|
+
requirements:
|
33
|
+
- - '>='
|
34
|
+
- !ruby/object:Gem::Version
|
35
|
+
version: '0'
|
36
|
+
type: :development
|
37
|
+
prerelease: false
|
38
|
+
version_requirements: !ruby/object:Gem::Requirement
|
39
|
+
requirements:
|
40
|
+
- - '>='
|
41
|
+
- !ruby/object:Gem::Version
|
42
|
+
version: '0'
|
43
|
+
- !ruby/object:Gem::Dependency
|
44
|
+
name: rake
|
45
|
+
requirement: !ruby/object:Gem::Requirement
|
46
|
+
requirements:
|
47
|
+
- - '>='
|
48
|
+
- !ruby/object:Gem::Version
|
49
|
+
version: '0'
|
50
|
+
type: :development
|
51
|
+
prerelease: false
|
52
|
+
version_requirements: !ruby/object:Gem::Requirement
|
53
|
+
requirements:
|
54
|
+
- - '>='
|
55
|
+
- !ruby/object:Gem::Version
|
56
|
+
version: '0'
|
57
|
+
description: SMSEasy allows you to send text messages to a mobile recipient for free. It
|
58
|
+
leverages ActionMailer for delivery of text messages through e-mail. Based on the
|
59
|
+
Brendan Lim's sms-easy.
|
60
|
+
email:
|
61
|
+
- conmotto@gmail.com
|
62
|
+
executables: []
|
63
|
+
extensions: []
|
64
|
+
extra_rdoc_files: []
|
65
|
+
files:
|
66
|
+
- .gitignore
|
67
|
+
- MIT-LICENSE
|
68
|
+
- README.rdoc
|
69
|
+
- Rakefile
|
70
|
+
- lib/sms-easy.rb
|
71
|
+
- lib/sms/easy/easy.rb
|
72
|
+
- lib/sms/easy/easy_helper.rb
|
73
|
+
- lib/sms/easy/exception.rb
|
74
|
+
- lib/sms/easy/notifier.rb
|
75
|
+
- lib/sms/easy/version.rb
|
76
|
+
- rails/init.rb
|
77
|
+
- sms-easy.gemspec
|
78
|
+
- templates/sms-easy.yml
|
79
|
+
- test/lib/sms-easy/sms-easy_test.rb
|
80
|
+
- test/test_helper.rb
|
81
|
+
homepage: https://github.com/preston/sms-easy
|
82
|
+
licenses:
|
83
|
+
- MIT
|
84
|
+
metadata: {}
|
85
|
+
post_install_message:
|
86
|
+
rdoc_options: []
|
87
|
+
require_paths:
|
88
|
+
- lib
|
89
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
90
|
+
requirements:
|
91
|
+
- - '>='
|
92
|
+
- !ruby/object:Gem::Version
|
93
|
+
version: '0'
|
94
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
95
|
+
requirements:
|
96
|
+
- - '>='
|
97
|
+
- !ruby/object:Gem::Version
|
98
|
+
version: '0'
|
99
|
+
requirements: []
|
100
|
+
rubyforge_project:
|
101
|
+
rubygems_version: 2.0.3
|
102
|
+
signing_key:
|
103
|
+
specification_version: 4
|
104
|
+
summary: SMSEasy allows you to send text messages to a mobile recipient for free.
|
105
|
+
test_files:
|
106
|
+
- test/lib/sms-easy/sms-easy_test.rb
|
107
|
+
- test/test_helper.rb
|