ruby-bulksms 0.4 → 0.4.1
Sign up to get free protection for your applications and to get access to all the features.
- data/{README → README.rdoc} +73 -57
- data/lib/net/sms/bulksms.rb +91 -91
- data/lib/net/sms/bulksms/account.rb +46 -46
- data/lib/net/sms/bulksms/message.rb +54 -54
- data/lib/net/sms/bulksms/response.rb +28 -28
- data/lib/ruby-bulksms.rb +3 -3
- data/ruby-bulksms.gemspec +19 -19
- metadata +25 -39
data/{README → README.rdoc}
RENAMED
@@ -1,57 +1,73 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
Net::SMS::BulkSMS is a Ruby library that allows you to easily integrate SMS services into your Ruby or RubyOnRails applications.
|
4
|
-
|
5
|
-
It has support for all BulkSMS international sites, including the UK, USA, South Africa, Spain and Europe.
|
6
|
-
|
7
|
-
To use the library, you will need an account from www.bulksms.com and some credits.
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
Creating a new service and sending a message is simple.
|
12
|
-
|
13
|
-
s = Service.new('myusername', 'mypassword')
|
14
|
-
s.
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
The Service class also has a <tt>send</tt> instance method that accepts a Message object. This allows you to construct your own Message objects and set additional parameters.
|
19
|
-
|
20
|
-
s = Service.new('myusername', 'mypassword')
|
21
|
-
m = Message.new('Hello, look at my funky message', '44799123456')
|
22
|
-
m.routing_group = 1
|
23
|
-
m.want_report = 1
|
24
|
-
s.
|
25
|
-
|
26
|
-
Both <tt>send</tt> and <tt>send_message</tt> return a Response object.
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
If you already have an existing Service object, you can easily check your account balance.
|
31
|
-
|
32
|
-
s = Service.new('myusername', 'mypassword')
|
33
|
-
s.account.credits
|
34
|
-
|
35
|
-
Alternatively, you can create an Account object directly.
|
36
|
-
|
37
|
-
a = Account.new('myusername', 'mypassword')
|
38
|
-
a.credits
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
1
|
+
= Introduction
|
2
|
+
|
3
|
+
Net::SMS::BulkSMS is a Ruby library that allows you to easily integrate SMS services into your Ruby or RubyOnRails applications.
|
4
|
+
|
5
|
+
It has support for all BulkSMS international sites, including the UK, USA, South Africa, Spain and Europe.
|
6
|
+
|
7
|
+
To use the library, you will need an account from www.bulksms.com and some credits.
|
8
|
+
|
9
|
+
= Examples
|
10
|
+
|
11
|
+
Creating a new service and sending a message is simple.
|
12
|
+
|
13
|
+
s = Service.new('myusername', 'mypassword')
|
14
|
+
s.send('Hello, I hope you like my message!', '44799123456')
|
15
|
+
|
16
|
+
= Additional message options
|
17
|
+
|
18
|
+
The Service class also has a <tt>send</tt> instance method that accepts a Message object. This allows you to construct your own Message objects and set additional parameters.
|
19
|
+
|
20
|
+
s = Service.new('myusername', 'mypassword')
|
21
|
+
m = Message.new('Hello, look at my funky message', '44799123456')
|
22
|
+
m.routing_group = 1
|
23
|
+
m.want_report = 1
|
24
|
+
s.send_message(m)
|
25
|
+
|
26
|
+
Both <tt>send</tt> and <tt>send_message</tt> return a Response object.
|
27
|
+
|
28
|
+
= Checking your account balance
|
29
|
+
|
30
|
+
If you already have an existing Service object, you can easily check your account balance.
|
31
|
+
|
32
|
+
s = Service.new('myusername', 'mypassword')
|
33
|
+
s.account.credits
|
34
|
+
|
35
|
+
Alternatively, you can create an Account object directly.
|
36
|
+
|
37
|
+
a = Account.new('myusername', 'mypassword')
|
38
|
+
a.credits
|
39
|
+
|
40
|
+
= Sending multiple messages with a single http connection
|
41
|
+
|
42
|
+
Also you can use a single http connection & send multiple messages using <tt>send_multiple</tt> method that accepts an array of Message object and return an array of Response object
|
43
|
+
s = Service.new('myusername', 'mypassword')
|
44
|
+
messages = []
|
45
|
+
responses = []
|
46
|
+
m1 = Message.new('Hello1, look at my funky message', '44799123456')
|
47
|
+
m2 = Message.new('Hello2, look at my funky message', '44799123666')
|
48
|
+
messages << m1
|
49
|
+
messages << m2
|
50
|
+
responses = s.send_multiple(messages)
|
51
|
+
|
52
|
+
For a further example, see the simple command line client provided.
|
53
|
+
|
54
|
+
= Limitations
|
55
|
+
|
56
|
+
This library currently only implements a small portion of the API, allowing you to send messages and check your account balance. Further parts of the BulkSMS API may be implemented in the future such as the ability to receive messages and status reports and manage the address book provided by BulkSMS.
|
57
|
+
|
58
|
+
= A note about testing
|
59
|
+
|
60
|
+
I tried to cover the library with unit tests where possible however I'm not very experienced with unit testing network services and all tests require a valid account to run. If anybody could share some advice here it would be much appreciated.
|
61
|
+
|
62
|
+
= Authors
|
63
|
+
|
64
|
+
The Original work is made by Luke Redpath (email:contact@lukeredpath.co.uk)
|
65
|
+
|
66
|
+
Modifications have been added by Basayel Said (email:eng.basayel.said@gmail.com)
|
67
|
+
|
68
|
+
Modifications include:
|
69
|
+
|
70
|
+
* fixing a bug related to getting the host of bulksms service.
|
71
|
+
* Adding method named (send_multiple) in order to use a single http connection in sending multiple message objects.
|
72
|
+
* adding gem spec file to the library.
|
73
|
+
* packaging the library as a gem.
|
data/lib/net/sms/bulksms.rb
CHANGED
@@ -1,91 +1,91 @@
|
|
1
|
-
# Author:: Luke Redpath (mailto:contact@lukeredpath.co.uk)
|
2
|
-
# License:: MIT
|
3
|
-
|
4
|
-
require File.dirname(__FILE__) + '/bulksms/account'
|
5
|
-
require File.dirname(__FILE__) + '/bulksms/message'
|
6
|
-
require File.dirname(__FILE__) + '/bulksms/response'
|
7
|
-
|
8
|
-
module Net
|
9
|
-
module SMS
|
10
|
-
|
11
|
-
# The main BulkSMS module contains some constants
|
12
|
-
# for the different countries that are supported
|
13
|
-
# and a helper method to return the correct URL
|
14
|
-
# for the chosen country
|
15
|
-
#
|
16
|
-
# The countries/areas supported are:
|
17
|
-
# * UK
|
18
|
-
# * USA
|
19
|
-
# * Spain
|
20
|
-
# * South Africa
|
21
|
-
# * International/Europe
|
22
|
-
|
23
|
-
module BulkSMS
|
24
|
-
|
25
|
-
UK = 'uk'
|
26
|
-
USA = 'usa'
|
27
|
-
SPAIN = 'spain'
|
28
|
-
SAFRICA = 'safrica'
|
29
|
-
INTER = 'international'
|
30
|
-
|
31
|
-
class Service
|
32
|
-
# The port the message service rus on
|
33
|
-
MESSAGE_SERVICE_PORT = 80 #5567
|
34
|
-
|
35
|
-
# Path to the message service gateway
|
36
|
-
MESSAGE_SERVICE_PATH = '/eapi/submission/send_sms/2/2.0'
|
37
|
-
|
38
|
-
# returns an Account object for the credentials supplied to the service
|
39
|
-
attr_reader :account
|
40
|
-
|
41
|
-
def initialize(username, password, country =
|
42
|
-
@account = Account.new(username, password, country)
|
43
|
-
@country=country
|
44
|
-
end
|
45
|
-
|
46
|
-
# Sends the given Message object to the gateway for delivery
|
47
|
-
def send_message(msg)
|
48
|
-
payload = [@account.to_http_query, msg.to_http_query].join('&')
|
49
|
-
Net::HTTP.start(host(@country), MESSAGE_SERVICE_PORT) do |http|
|
50
|
-
resp = http.post(MESSAGE_SERVICE_PATH, payload)
|
51
|
-
Response.parse(resp.body)
|
52
|
-
end
|
53
|
-
end
|
54
|
-
#Openning single connection & sending an array of message objects
|
55
|
-
def send_multiple(messages)
|
56
|
-
responses=[]
|
57
|
-
Net::HTTP.start(host(@country), MESSAGE_SERVICE_PORT) do |http|
|
58
|
-
messages.each do |msg|
|
59
|
-
payload = [@account.to_http_query, msg.to_http_query].join('&')
|
60
|
-
resp = http.post(MESSAGE_SERVICE_PATH, payload)
|
61
|
-
responses << Response.parse(resp.body)
|
62
|
-
end
|
63
|
-
end
|
64
|
-
responses
|
65
|
-
end
|
66
|
-
# Creates a new Message object from the message text and recipient
|
67
|
-
# given and sends to the gateway using send_message()
|
68
|
-
def send(message, recipient)
|
69
|
-
msg = Message.new(message, recipient)
|
70
|
-
self.send_message(msg)
|
71
|
-
end
|
72
|
-
end
|
73
|
-
|
74
|
-
# Returns the gateway URL for the chosen country
|
75
|
-
def host(country)
|
76
|
-
case country
|
77
|
-
when 'uk'
|
78
|
-
'www.bulksms.co.uk'
|
79
|
-
when 'usa'
|
80
|
-
'usa.bulksms.com'
|
81
|
-
when 'international'
|
82
|
-
'bulksms.vsms.net'
|
83
|
-
when 'safrica'
|
84
|
-
'bulksms.2way.co.za'
|
85
|
-
when 'spain'
|
86
|
-
'bulksms.com.es'
|
87
|
-
end
|
88
|
-
end
|
89
|
-
end
|
90
|
-
end
|
91
|
-
end
|
1
|
+
# Author:: Luke Redpath (mailto:contact@lukeredpath.co.uk)
|
2
|
+
# License:: MIT
|
3
|
+
|
4
|
+
require File.dirname(__FILE__) + '/bulksms/account'
|
5
|
+
require File.dirname(__FILE__) + '/bulksms/message'
|
6
|
+
require File.dirname(__FILE__) + '/bulksms/response'
|
7
|
+
|
8
|
+
module Net
|
9
|
+
module SMS
|
10
|
+
|
11
|
+
# The main BulkSMS module contains some constants
|
12
|
+
# for the different countries that are supported
|
13
|
+
# and a helper method to return the correct URL
|
14
|
+
# for the chosen country
|
15
|
+
#
|
16
|
+
# The countries/areas supported are:
|
17
|
+
# * UK
|
18
|
+
# * USA
|
19
|
+
# * Spain
|
20
|
+
# * South Africa
|
21
|
+
# * International/Europe
|
22
|
+
|
23
|
+
module BulkSMS
|
24
|
+
|
25
|
+
UK = 'uk'
|
26
|
+
USA = 'usa'
|
27
|
+
SPAIN = 'spain'
|
28
|
+
SAFRICA = 'safrica'
|
29
|
+
INTER = 'international'
|
30
|
+
|
31
|
+
class Service
|
32
|
+
# The port the message service rus on
|
33
|
+
MESSAGE_SERVICE_PORT = 80 #5567
|
34
|
+
|
35
|
+
# Path to the message service gateway
|
36
|
+
MESSAGE_SERVICE_PATH = '/eapi/submission/send_sms/2/2.0'
|
37
|
+
|
38
|
+
# returns an Account object for the credentials supplied to the service
|
39
|
+
attr_reader :account
|
40
|
+
|
41
|
+
def initialize(username, password, country = INTER)
|
42
|
+
@account = Account.new(username, password, country)
|
43
|
+
@country=country
|
44
|
+
end
|
45
|
+
|
46
|
+
# Sends the given Message object to the gateway for delivery
|
47
|
+
def send_message(msg)
|
48
|
+
payload = [@account.to_http_query, msg.to_http_query].join('&')
|
49
|
+
Net::HTTP.start(host(@country), MESSAGE_SERVICE_PORT) do |http|
|
50
|
+
resp = http.post(MESSAGE_SERVICE_PATH, payload)
|
51
|
+
Response.parse(resp.body)
|
52
|
+
end
|
53
|
+
end
|
54
|
+
#Openning single connection & sending an array of message objects
|
55
|
+
def send_multiple(messages)
|
56
|
+
responses=[]
|
57
|
+
Net::HTTP.start(host(@country), MESSAGE_SERVICE_PORT) do |http|
|
58
|
+
messages.each do |msg|
|
59
|
+
payload = [@account.to_http_query, msg.to_http_query].join('&')
|
60
|
+
resp = http.post(MESSAGE_SERVICE_PATH, payload)
|
61
|
+
responses << Response.parse(resp.body)
|
62
|
+
end
|
63
|
+
end
|
64
|
+
responses
|
65
|
+
end
|
66
|
+
# Creates a new Message object from the message text and recipient
|
67
|
+
# given and sends to the gateway using send_message()
|
68
|
+
def send(message, recipient)
|
69
|
+
msg = Message.new(message, recipient)
|
70
|
+
self.send_message(msg)
|
71
|
+
end
|
72
|
+
end
|
73
|
+
|
74
|
+
# Returns the gateway URL for the chosen country
|
75
|
+
def host(country)
|
76
|
+
case country
|
77
|
+
when 'uk'
|
78
|
+
'www.bulksms.co.uk'
|
79
|
+
when 'usa'
|
80
|
+
'usa.bulksms.com'
|
81
|
+
when 'international'
|
82
|
+
'bulksms.vsms.net'
|
83
|
+
when 'safrica'
|
84
|
+
'bulksms.2way.co.za'
|
85
|
+
when 'spain'
|
86
|
+
'bulksms.com.es'
|
87
|
+
end
|
88
|
+
end
|
89
|
+
end
|
90
|
+
end
|
91
|
+
end
|
@@ -1,46 +1,46 @@
|
|
1
|
-
require 'net/http'
|
2
|
-
require 'uri'
|
3
|
-
|
4
|
-
module Net
|
5
|
-
module SMS
|
6
|
-
module BulkSMS
|
7
|
-
|
8
|
-
# Wraps up the functionality for a user account on the system
|
9
|
-
class Account
|
10
|
-
|
11
|
-
# The port the account service runs on
|
12
|
-
SERVICE_PORT = 7512
|
13
|
-
|
14
|
-
# Path to the account service gateway
|
15
|
-
SERVICE_PATH = '/eapi/1.0/get_credits.mc'
|
16
|
-
|
17
|
-
def initialize(username, password, country = 'uk')
|
18
|
-
@username, @password = username, password
|
19
|
-
@country = country
|
20
|
-
end
|
21
|
-
|
22
|
-
# Returns the number of credits left on a users account as a
|
23
|
-
# float to 2 decimal places. Will raise an AccountError
|
24
|
-
# if the credentials are wrong
|
25
|
-
def credits
|
26
|
-
Net::HTTP.start(host(@country), SERVICE_PORT) do |http|
|
27
|
-
response = http.post SERVICE_PATH, self.to_http_query
|
28
|
-
if response.body.include?('|')
|
29
|
-
rsp = Response.parse(response.body)
|
30
|
-
raise AccountError, rsp.description, caller
|
31
|
-
end
|
32
|
-
response.body.to_f
|
33
|
-
end
|
34
|
-
end
|
35
|
-
|
36
|
-
# Returns the account credentials in the form of a http
|
37
|
-
# query string for use by other gateway services
|
38
|
-
def to_http_query
|
39
|
-
URI.encode("username=#{@username}&password=#{@password}")
|
40
|
-
end
|
41
|
-
end
|
42
|
-
|
43
|
-
class AccountError < Exception; end
|
44
|
-
end
|
45
|
-
end
|
46
|
-
end
|
1
|
+
require 'net/http'
|
2
|
+
require 'uri'
|
3
|
+
|
4
|
+
module Net
|
5
|
+
module SMS
|
6
|
+
module BulkSMS
|
7
|
+
|
8
|
+
# Wraps up the functionality for a user account on the system
|
9
|
+
class Account
|
10
|
+
|
11
|
+
# The port the account service runs on
|
12
|
+
SERVICE_PORT = 7512
|
13
|
+
|
14
|
+
# Path to the account service gateway
|
15
|
+
SERVICE_PATH = '/eapi/1.0/get_credits.mc'
|
16
|
+
|
17
|
+
def initialize(username, password, country = 'uk')
|
18
|
+
@username, @password = username, password
|
19
|
+
@country = country
|
20
|
+
end
|
21
|
+
|
22
|
+
# Returns the number of credits left on a users account as a
|
23
|
+
# float to 2 decimal places. Will raise an AccountError
|
24
|
+
# if the credentials are wrong
|
25
|
+
def credits
|
26
|
+
Net::HTTP.start(host(@country), SERVICE_PORT) do |http|
|
27
|
+
response = http.post SERVICE_PATH, self.to_http_query
|
28
|
+
if response.body.include?('|')
|
29
|
+
rsp = Response.parse(response.body)
|
30
|
+
raise AccountError, rsp.description, caller
|
31
|
+
end
|
32
|
+
response.body.to_f
|
33
|
+
end
|
34
|
+
end
|
35
|
+
|
36
|
+
# Returns the account credentials in the form of a http
|
37
|
+
# query string for use by other gateway services
|
38
|
+
def to_http_query
|
39
|
+
URI.encode("username=#{@username}&password=#{@password}")
|
40
|
+
end
|
41
|
+
end
|
42
|
+
|
43
|
+
class AccountError < Exception; end
|
44
|
+
end
|
45
|
+
end
|
46
|
+
end
|
@@ -1,54 +1,54 @@
|
|
1
|
-
module Net
|
2
|
-
module SMS
|
3
|
-
module BulkSMS
|
4
|
-
|
5
|
-
# Encapsulates a message to be sent by the gateway
|
6
|
-
class Message
|
7
|
-
FLASH_SMS = 0
|
8
|
-
NORMAL_SMS = 2
|
9
|
-
|
10
|
-
# The various attributes for a message as defined
|
11
|
-
# by the BulkSMS HTTP API. For full details on the
|
12
|
-
# different attributes see:
|
13
|
-
# http://www.bulksms.co.uk/docs/eapi/submission/send_sms/
|
14
|
-
attr_accessor :message, :recipient, :msg_class,
|
15
|
-
:want_report, :routing_group, :source_id,
|
16
|
-
:test_always_succeed, :test_always_fail,
|
17
|
-
:concat_text_sms, :concat_max_parts
|
18
|
-
|
19
|
-
def initialize(message, recipient)
|
20
|
-
@message = message
|
21
|
-
@recipient = recipient
|
22
|
-
@msg_class = NORMAL_SMS
|
23
|
-
@want_report = 0
|
24
|
-
@routing_group = 2
|
25
|
-
@source_id = ''
|
26
|
-
@test_always_succeed = 0
|
27
|
-
@test_always_fail = 0
|
28
|
-
@concat_text_sms = 0
|
29
|
-
@concat_max_parts = 2
|
30
|
-
end
|
31
|
-
|
32
|
-
# Returns a message as a http query string for use
|
33
|
-
# by other gateway services
|
34
|
-
def to_http_query
|
35
|
-
params = {
|
36
|
-
'message' => @message,
|
37
|
-
'msisdn' => @recipient,
|
38
|
-
'msg_class' => @msg_class,
|
39
|
-
'want_report' => @want_report,
|
40
|
-
'routing_group' => @routing_group,
|
41
|
-
'source_id' => @source_id,
|
42
|
-
'test_always_succeed' => @test_always_succeed,
|
43
|
-
'test_always_fail' => @test_always_fail,
|
44
|
-
'allow_concat_text_sms' => @concat_text_sms,
|
45
|
-
'concat_text_sms_max_parts' => @concat_max_parts
|
46
|
-
}
|
47
|
-
query_string = params.collect { |x, y| "#{x}=#{y}" }.join('&')
|
48
|
-
URI.encode(query_string)
|
49
|
-
end
|
50
|
-
end
|
51
|
-
|
52
|
-
end
|
53
|
-
end
|
54
|
-
end
|
1
|
+
module Net
|
2
|
+
module SMS
|
3
|
+
module BulkSMS
|
4
|
+
|
5
|
+
# Encapsulates a message to be sent by the gateway
|
6
|
+
class Message
|
7
|
+
FLASH_SMS = 0
|
8
|
+
NORMAL_SMS = 2
|
9
|
+
|
10
|
+
# The various attributes for a message as defined
|
11
|
+
# by the BulkSMS HTTP API. For full details on the
|
12
|
+
# different attributes see:
|
13
|
+
# http://www.bulksms.co.uk/docs/eapi/submission/send_sms/
|
14
|
+
attr_accessor :message, :recipient, :msg_class,
|
15
|
+
:want_report, :routing_group, :source_id,
|
16
|
+
:test_always_succeed, :test_always_fail,
|
17
|
+
:concat_text_sms, :concat_max_parts
|
18
|
+
|
19
|
+
def initialize(message, recipient)
|
20
|
+
@message = message
|
21
|
+
@recipient = recipient
|
22
|
+
@msg_class = NORMAL_SMS
|
23
|
+
@want_report = 0
|
24
|
+
@routing_group = 2
|
25
|
+
@source_id = ''
|
26
|
+
@test_always_succeed = 0
|
27
|
+
@test_always_fail = 0
|
28
|
+
@concat_text_sms = 0
|
29
|
+
@concat_max_parts = 2
|
30
|
+
end
|
31
|
+
|
32
|
+
# Returns a message as a http query string for use
|
33
|
+
# by other gateway services
|
34
|
+
def to_http_query
|
35
|
+
params = {
|
36
|
+
'message' => @message,
|
37
|
+
'msisdn' => @recipient,
|
38
|
+
'msg_class' => @msg_class,
|
39
|
+
'want_report' => @want_report,
|
40
|
+
'routing_group' => @routing_group,
|
41
|
+
'source_id' => @source_id,
|
42
|
+
'test_always_succeed' => @test_always_succeed,
|
43
|
+
'test_always_fail' => @test_always_fail,
|
44
|
+
'allow_concat_text_sms' => @concat_text_sms,
|
45
|
+
'concat_text_sms_max_parts' => @concat_max_parts
|
46
|
+
}
|
47
|
+
query_string = params.collect { |x, y| "#{x}=#{y}" }.join('&')
|
48
|
+
URI.encode(query_string)
|
49
|
+
end
|
50
|
+
end
|
51
|
+
|
52
|
+
end
|
53
|
+
end
|
54
|
+
end
|
@@ -1,28 +1,28 @@
|
|
1
|
-
module Net
|
2
|
-
module SMS
|
3
|
-
module BulkSMS
|
4
|
-
|
5
|
-
# A response sent by the BulkSMS gateway
|
6
|
-
class Response
|
7
|
-
attr_reader :code, :description, :batch_id
|
8
|
-
|
9
|
-
def initialize(code, description, batch_id)
|
10
|
-
@code = code
|
11
|
-
@description = description
|
12
|
-
@batch_id = batch_id
|
13
|
-
end
|
14
|
-
|
15
|
-
def self.parse(response_text)
|
16
|
-
tokens = response_text.split('|')
|
17
|
-
self.new tokens[0].to_i, tokens[1], tokens[2].to_i
|
18
|
-
end
|
19
|
-
|
20
|
-
# Was the original request successful?
|
21
|
-
def successful?
|
22
|
-
(@code == 0) ? true : false
|
23
|
-
end
|
24
|
-
end
|
25
|
-
|
26
|
-
end
|
27
|
-
end
|
28
|
-
end
|
1
|
+
module Net
|
2
|
+
module SMS
|
3
|
+
module BulkSMS
|
4
|
+
|
5
|
+
# A response sent by the BulkSMS gateway
|
6
|
+
class Response
|
7
|
+
attr_reader :code, :description, :batch_id
|
8
|
+
|
9
|
+
def initialize(code, description, batch_id)
|
10
|
+
@code = code
|
11
|
+
@description = description
|
12
|
+
@batch_id = batch_id
|
13
|
+
end
|
14
|
+
|
15
|
+
def self.parse(response_text)
|
16
|
+
tokens = response_text.split('|')
|
17
|
+
self.new tokens[0].to_i, tokens[1], tokens[2].to_i
|
18
|
+
end
|
19
|
+
|
20
|
+
# Was the original request successful?
|
21
|
+
def successful?
|
22
|
+
(@code == 0) ? true : false
|
23
|
+
end
|
24
|
+
end
|
25
|
+
|
26
|
+
end
|
27
|
+
end
|
28
|
+
end
|
data/lib/ruby-bulksms.rb
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
$:.unshift File.expand_path(File.dirname(__FILE__))
|
2
|
-
|
3
|
-
require 'net/sms/bulksms.rb'
|
1
|
+
$:.unshift File.expand_path(File.dirname(__FILE__))
|
2
|
+
|
3
|
+
require 'net/sms/bulksms.rb'
|
4
4
|
include Net::SMS::BulkSMS
|
data/ruby-bulksms.gemspec
CHANGED
@@ -1,20 +1,20 @@
|
|
1
|
-
Gem::Specification.new do |s|
|
2
|
-
s.name = "ruby-bulksms"
|
3
|
-
s.version = "0.4"
|
4
|
-
s.date = "
|
5
|
-
s.summary = "Sending SMS using bulksms services"
|
6
|
-
s.email = "eng.basayel.said@gmail.com"
|
7
|
-
s.homepage = "http://github.com/basayel/ruby-bulksms"
|
8
|
-
s.description = "Integrating SMS services into RubyOnRails applications using BulkSMS gateway"
|
9
|
-
s.has_rdoc = true
|
10
|
-
s.authors = ["Basayel Said"]
|
11
|
-
s.files = [
|
12
|
-
"ruby-bulksms.gemspec",
|
13
|
-
"README",
|
14
|
-
"lib/ruby-bulksms.rb",
|
15
|
-
"lib/net/sms/bulksms/account.rb",
|
16
|
-
"lib/net/sms/bulksms/message.rb",
|
17
|
-
"lib/net/sms/bulksms/response.rb",
|
18
|
-
"lib/net/sms/bulksms.rb"
|
19
|
-
]
|
1
|
+
Gem::Specification.new do |s|
|
2
|
+
s.name = "ruby-bulksms"
|
3
|
+
s.version = "0.4.1"
|
4
|
+
s.date = "2015-06-15"
|
5
|
+
s.summary = "Sending SMS using bulksms services"
|
6
|
+
s.email = "eng.basayel.said@gmail.com"
|
7
|
+
s.homepage = "http://github.com/basayel/ruby-bulksms"
|
8
|
+
s.description = "Integrating SMS services into RubyOnRails applications using BulkSMS gateway"
|
9
|
+
s.has_rdoc = true
|
10
|
+
s.authors = ["Basayel Said"]
|
11
|
+
s.files = [
|
12
|
+
"ruby-bulksms.gemspec",
|
13
|
+
"README.rdoc",
|
14
|
+
"lib/ruby-bulksms.rb",
|
15
|
+
"lib/net/sms/bulksms/account.rb",
|
16
|
+
"lib/net/sms/bulksms/message.rb",
|
17
|
+
"lib/net/sms/bulksms/response.rb",
|
18
|
+
"lib/net/sms/bulksms.rb"
|
19
|
+
]
|
20
20
|
end
|
metadata
CHANGED
@@ -1,67 +1,53 @@
|
|
1
|
-
--- !ruby/object:Gem::Specification
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
2
|
name: ruby-bulksms
|
3
|
-
version: !ruby/object:Gem::Version
|
4
|
-
|
5
|
-
|
6
|
-
- 0
|
7
|
-
- 4
|
8
|
-
version: "0.4"
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.4.1
|
5
|
+
prerelease:
|
9
6
|
platform: ruby
|
10
|
-
authors:
|
7
|
+
authors:
|
11
8
|
- Basayel Said
|
12
9
|
autorequire:
|
13
10
|
bindir: bin
|
14
11
|
cert_chain: []
|
15
|
-
|
16
|
-
date: 2010-03-31 00:00:00 +02:00
|
17
|
-
default_executable:
|
12
|
+
date: 2015-06-15 00:00:00.000000000 Z
|
18
13
|
dependencies: []
|
19
|
-
|
20
|
-
|
14
|
+
description: Integrating SMS services into RubyOnRails applications using BulkSMS
|
15
|
+
gateway
|
21
16
|
email: eng.basayel.said@gmail.com
|
22
17
|
executables: []
|
23
|
-
|
24
18
|
extensions: []
|
25
|
-
|
26
19
|
extra_rdoc_files: []
|
27
|
-
|
28
|
-
files:
|
20
|
+
files:
|
29
21
|
- ruby-bulksms.gemspec
|
30
|
-
- README
|
22
|
+
- README.rdoc
|
31
23
|
- lib/ruby-bulksms.rb
|
32
24
|
- lib/net/sms/bulksms/account.rb
|
33
25
|
- lib/net/sms/bulksms/message.rb
|
34
26
|
- lib/net/sms/bulksms/response.rb
|
35
27
|
- lib/net/sms/bulksms.rb
|
36
|
-
has_rdoc: true
|
37
28
|
homepage: http://github.com/basayel/ruby-bulksms
|
38
29
|
licenses: []
|
39
|
-
|
40
30
|
post_install_message:
|
41
31
|
rdoc_options: []
|
42
|
-
|
43
|
-
require_paths:
|
32
|
+
require_paths:
|
44
33
|
- lib
|
45
|
-
required_ruby_version: !ruby/object:Gem::Requirement
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
requirements:
|
54
|
-
- -
|
55
|
-
- !ruby/object:Gem::Version
|
56
|
-
|
57
|
-
- 0
|
58
|
-
version: "0"
|
34
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
35
|
+
none: false
|
36
|
+
requirements:
|
37
|
+
- - ! '>='
|
38
|
+
- !ruby/object:Gem::Version
|
39
|
+
version: '0'
|
40
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
41
|
+
none: false
|
42
|
+
requirements:
|
43
|
+
- - ! '>='
|
44
|
+
- !ruby/object:Gem::Version
|
45
|
+
version: '0'
|
59
46
|
requirements: []
|
60
|
-
|
61
47
|
rubyforge_project:
|
62
|
-
rubygems_version: 1.
|
48
|
+
rubygems_version: 1.8.25
|
63
49
|
signing_key:
|
64
50
|
specification_version: 3
|
65
51
|
summary: Sending SMS using bulksms services
|
66
52
|
test_files: []
|
67
|
-
|
53
|
+
has_rdoc: true
|