clickatell 0.2.0 → 0.3.0
Sign up to get free protection for your applications and to get access to all the features.
- data/History.txt +10 -4
- data/Manifest.txt +2 -0
- data/README.txt +5 -1
- data/Rakefile +1 -1
- data/bin/sms +32 -24
- data/lib/clickatell.rb +1 -0
- data/lib/clickatell/api.rb +28 -3
- data/lib/clickatell/connection.rb +4 -2
- data/lib/clickatell/utility/options.rb +75 -54
- data/lib/clickatell/version.rb +1 -1
- data/lib/core-ext/hash.rb +15 -0
- data/spec/api_spec.rb +37 -8
- data/spec/connection_spec.rb +11 -3
- data/spec/hash_ext_spec.rb +14 -0
- data/spec/response_spec.rb +5 -6
- data/website/index.html +22 -2
- data/website/index.txt +16 -0
- metadata +4 -2
data/History.txt
CHANGED
@@ -1,13 +1,19 @@
|
|
1
|
+
== 0.3.0
|
2
|
+
|
3
|
+
* Display proper message status, not just the code
|
4
|
+
* Make it possible to specify custom :from number/name using SMS utility
|
5
|
+
* Added support for custom :from number/name when sending a message.
|
6
|
+
* Added support for checking message status to sms utility
|
7
|
+
* sms utility now returns the id of a successfully sent message.
|
8
|
+
* Capture API KEY errors.
|
9
|
+
* Make sure errors are handled when using sms utility to check balance.
|
10
|
+
|
1
11
|
== 0.2.0
|
2
12
|
|
3
13
|
* Added Clickatell API error handling to API and sms utility.
|
4
|
-
|
5
14
|
* Handle required/optional arguments for sms utility correctly
|
6
|
-
|
7
15
|
* Added further sms utility usage information to website
|
8
|
-
|
9
16
|
* Make sure sms utility gracefully handles missing recipient/message
|
10
|
-
|
11
17
|
* Added balance query support to API and SMS utility (--check-balance).
|
12
18
|
|
13
19
|
== 0.1.0 2007-08-17
|
data/Manifest.txt
CHANGED
@@ -11,10 +11,12 @@ lib/clickatell/response.rb
|
|
11
11
|
lib/clickatell/utility.rb
|
12
12
|
lib/clickatell/utility/options.rb
|
13
13
|
lib/clickatell/version.rb
|
14
|
+
lib/core-ext/hash.rb
|
14
15
|
scripts/txt2html
|
15
16
|
setup.rb
|
16
17
|
spec/api_spec.rb
|
17
18
|
spec/connection_spec.rb
|
19
|
+
spec/hash_ext_spec.rb
|
18
20
|
spec/response_spec.rb
|
19
21
|
spec/spec.opts
|
20
22
|
spec/spec_helper.rb
|
data/README.txt
CHANGED
@@ -33,4 +33,8 @@ file called .clickatell that resembles the following:
|
|
33
33
|
|
34
34
|
You can then use the sms utility to send a message to a single recipient:
|
35
35
|
|
36
|
-
sms 447771234567 'Hello from clickatell'
|
36
|
+
sms 447771234567 'Hello from clickatell'
|
37
|
+
|
38
|
+
Run +sms+ without any arguments for a full list of options.
|
39
|
+
|
40
|
+
See http://clickatell.rubyforge.org for further instructions.
|
data/Rakefile
CHANGED
@@ -129,7 +129,7 @@ end
|
|
129
129
|
|
130
130
|
Rake::RDocTask.new('docs') do |rd|
|
131
131
|
rd.main = 'README.txt'
|
132
|
-
rd.rdoc_files.include('README.txt', 'License.txt', 'lib/**/*.rb')
|
132
|
+
rd.rdoc_files.include('README.txt', 'History.txt', 'License.txt', 'lib/**/*.rb')
|
133
133
|
rd.rdoc_dir = 'doc'
|
134
134
|
rd.options << '--style=http://clickatell.rubyforge.org/stylesheets/rdoc.css'
|
135
135
|
rd.options << '--tab-width=2'
|
data/bin/sms
CHANGED
@@ -16,31 +16,39 @@ end
|
|
16
16
|
options = Clickatell::Utility::Options.parse(ARGV)
|
17
17
|
connection = Clickatell::Connection.new(options.api_key, options.username, options.password)
|
18
18
|
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
19
|
+
begin
|
20
|
+
if options.show_balance
|
21
|
+
puts "Retrieving account balance..."
|
22
|
+
puts "You have #{connection.account_balance} credits remaining."
|
23
|
+
exit 0
|
24
|
+
elsif options.show_status
|
25
|
+
puts "Getting status of message ##{options.message_id}."
|
26
|
+
status = connection.message_status(options.message_id)
|
27
|
+
puts "Status: #{Clickatell::API::MessageStatus[status]} (##{status})."
|
28
|
+
exit 0
|
29
|
+
else
|
25
30
|
puts "Sending '#{options.message}' to #{options.recipient}..."
|
26
|
-
|
27
|
-
|
31
|
+
additional_opts = {}
|
32
|
+
additional_opts[:from] = options.from if options.from
|
33
|
+
msg_id = connection.send_message(options.recipient, options.message, additional_opts)
|
34
|
+
puts "Message sent successfully (message id: #{msg_id})."
|
28
35
|
exit 0
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
36
|
+
end
|
37
|
+
|
38
|
+
rescue Clickatell::API::Error => e
|
39
|
+
case e.code
|
40
|
+
when '001', '002', '003', '005', '108'
|
41
|
+
puts "Authentication failed. Please check your username, password and API key and try again."
|
42
|
+
exit 1
|
43
|
+
when '004'
|
44
|
+
puts "Your account has been frozen. Please contact Clickatell support."
|
45
|
+
exit 1
|
46
|
+
when '007'
|
47
|
+
puts "Requests for this API key are not permitted from this IP address."
|
48
|
+
exit 1
|
49
|
+
else
|
50
|
+
puts "Unexpected error occurred. #{e.message} (error code: #{e.code})."
|
51
|
+
puts "Please contact the author (contact@lukeredpath.co.uk) with the above error."
|
52
|
+
exit 1
|
45
53
|
end
|
46
54
|
end
|
data/lib/clickatell.rb
CHANGED
@@ -1,6 +1,7 @@
|
|
1
1
|
module Clickatell
|
2
2
|
end
|
3
3
|
|
4
|
+
require File.join(File.dirname(__FILE__), *%w[core-ext/hash])
|
4
5
|
require File.join(File.dirname(__FILE__), *%w[clickatell/version])
|
5
6
|
require File.join(File.dirname(__FILE__), *%w[clickatell/api])
|
6
7
|
require File.join(File.dirname(__FILE__), *%w[clickatell/response])
|
data/lib/clickatell/api.rb
CHANGED
@@ -30,16 +30,20 @@ module Clickatell
|
|
30
30
|
# no leading zeros (unless you have set a default prefix
|
31
31
|
# in your clickatell account centre).
|
32
32
|
#
|
33
|
-
#
|
33
|
+
# Takes a hash of auth_options to be used in this
|
34
34
|
# API call. Either api_id/username/password or session_id
|
35
35
|
# for an existing authenticated session.
|
36
36
|
#
|
37
|
+
# Additional options:
|
38
|
+
# :from - the from number/name
|
39
|
+
#
|
37
40
|
# Returns a new message ID if successful.
|
38
|
-
def send_message(recipient, message_text, auth_options)
|
41
|
+
def send_message(recipient, message_text, auth_options, opts={})
|
42
|
+
valid_options = opts.only(:from)
|
39
43
|
response = execute_command('sendmsg', {
|
40
44
|
:to => recipient,
|
41
45
|
:text => message_text
|
42
|
-
}.merge(
|
46
|
+
}.merge(auth_hash(auth_options)).merge(valid_options))
|
43
47
|
parse_response(response)['ID']
|
44
48
|
end
|
45
49
|
|
@@ -131,5 +135,26 @@ module Clickatell
|
|
131
135
|
end
|
132
136
|
end
|
133
137
|
|
138
|
+
class MessageStatus
|
139
|
+
STATUS_MAP = {
|
140
|
+
1 => 'Message unknown',
|
141
|
+
2 => 'Message queued',
|
142
|
+
3 => 'Delivered to gateway',
|
143
|
+
4 => 'Received by recipient',
|
144
|
+
5 => 'Error with message',
|
145
|
+
6 => 'User cancelled messaged delivery',
|
146
|
+
7 => 'Error delivering message',
|
147
|
+
8 => 'OK',
|
148
|
+
9 => 'Routing error',
|
149
|
+
10 => 'Message expired',
|
150
|
+
11 => 'Message queued for later delivery',
|
151
|
+
12 => 'Out of credit'
|
152
|
+
}
|
153
|
+
|
154
|
+
def self.[](code)
|
155
|
+
STATUS_MAP[code]
|
156
|
+
end
|
157
|
+
end
|
158
|
+
|
134
159
|
end
|
135
160
|
end
|
@@ -36,8 +36,9 @@ module Clickatell
|
|
36
36
|
protected
|
37
37
|
# Executes the given +api_method+ by delegating to the API
|
38
38
|
# module, using the current session_id for authentication.
|
39
|
-
def execute_api_call(api_method, params)
|
39
|
+
def execute_api_call(api_method, params, additional_options)
|
40
40
|
params << {:session_id => current_session_id}
|
41
|
+
params << additional_options if additional_options
|
41
42
|
API.send(api_method, *params)
|
42
43
|
end
|
43
44
|
|
@@ -50,7 +51,8 @@ module Clickatell
|
|
50
51
|
# Dispatch any API methods to the API module.
|
51
52
|
def method_missing(method, *args, &block)
|
52
53
|
if API.respond_to?(method)
|
53
|
-
|
54
|
+
additional_options = args.pop if args.last.is_a?(Hash)
|
55
|
+
execute_api_call(method, args, additional_options)
|
54
56
|
else
|
55
57
|
super(method, args, &block)
|
56
58
|
end
|
@@ -4,73 +4,94 @@ require 'ostruct'
|
|
4
4
|
module Clickatell
|
5
5
|
module Utility
|
6
6
|
class Options #:nodoc:
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
7
|
+
class << self
|
8
|
+
|
9
|
+
def parse(args)
|
10
|
+
@options = self.default_options
|
11
|
+
parser = OptionParser.new do |opts|
|
12
|
+
opts.banner = "Usage: sms [options] recipient message"
|
13
|
+
opts.separator ""
|
14
|
+
opts.separator "Specific options:"
|
13
15
|
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
16
|
+
opts.on('-u', '--username USERNAME',
|
17
|
+
"Specify the clickatell username (overrides ~/.clickatell setting)") do |username|
|
18
|
+
@options.username = username
|
19
|
+
end
|
18
20
|
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
21
|
+
opts.on('-p', '--password PASSWORD',
|
22
|
+
"Specify the clickatell password (overrides ~/.clickatell setting)") do |password|
|
23
|
+
@options.password = password
|
24
|
+
end
|
23
25
|
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
26
|
+
opts.on('-k', '--apikey API_KEY',
|
27
|
+
"Specify the clickatell API key (overrides ~/.clickatell setting)") do |key|
|
28
|
+
@options.api_key = key
|
29
|
+
end
|
30
|
+
|
31
|
+
opts.on('-f', '--from NAME_OR_NUMBER',
|
32
|
+
"Specify the name or number that the SMS will appear from") do |from|
|
33
|
+
@options.from = from
|
34
|
+
end
|
28
35
|
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
36
|
+
opts.on('-b', '--show-balance',
|
37
|
+
"Shows the total number of credits remaining on your account") do
|
38
|
+
@options.show_balance = true
|
39
|
+
end
|
33
40
|
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
41
|
+
opts.on('-s', '--status MESSAGE_ID',
|
42
|
+
"Displays the status of the specified message.") do |message_id|
|
43
|
+
@options.message_id = message_id
|
44
|
+
@options.show_status = true
|
45
|
+
end
|
38
46
|
|
39
|
-
|
40
|
-
|
41
|
-
|
47
|
+
opts.on_tail('-h', '--help', "Show this message") do
|
48
|
+
puts opts
|
49
|
+
exit
|
50
|
+
end
|
51
|
+
|
52
|
+
opts.on_tail('-v', '--version') do
|
53
|
+
puts "Ruby Clickatell SMS Utility #{Clickatell::VERSION}"
|
54
|
+
exit
|
55
|
+
end
|
42
56
|
end
|
43
|
-
end
|
44
57
|
|
45
|
-
|
46
|
-
|
47
|
-
|
58
|
+
parser.parse!(args)
|
59
|
+
@options.recipient = ARGV[-2]
|
60
|
+
@options.message = ARGV[-1]
|
48
61
|
|
49
|
-
|
50
|
-
|
62
|
+
if (@options.message.nil? || @options.recipient.nil?) && send_message?
|
63
|
+
puts "You must specify a recipient and message!"
|
64
|
+
puts parser
|
65
|
+
exit
|
66
|
+
end
|
67
|
+
|
68
|
+
return @options
|
69
|
+
|
70
|
+
rescue OptionParser::MissingArgument => e
|
71
|
+
switch_given = e.message.split(':').last.strip
|
72
|
+
puts "The #{switch_given} option requires an argument."
|
51
73
|
puts parser
|
52
74
|
exit
|
53
75
|
end
|
54
|
-
|
55
|
-
return options
|
56
|
-
|
57
|
-
rescue OptionParser::MissingArgument => e
|
58
|
-
switch_given = e.message.split(':').last.strip
|
59
|
-
puts "The #{switch_given} option requires an argument."
|
60
|
-
puts parser
|
61
|
-
exit
|
62
|
-
end
|
63
76
|
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
|
70
|
-
|
71
|
-
|
72
|
-
|
73
|
-
|
77
|
+
def default_options
|
78
|
+
options = OpenStruct.new
|
79
|
+
config_file = File.open(File.join(ENV['HOME'], '.clickatell'))
|
80
|
+
config = YAML.load(config_file)
|
81
|
+
options.username = config['username']
|
82
|
+
options.password = config['password']
|
83
|
+
options.api_key = config['api_key']
|
84
|
+
options.from = config['from']
|
85
|
+
return options
|
86
|
+
rescue Errno::ENOENT
|
87
|
+
return options
|
88
|
+
end
|
89
|
+
|
90
|
+
def send_message?
|
91
|
+
(@options.show_status.nil? &&
|
92
|
+
@options.show_balance.nil?)
|
93
|
+
end
|
94
|
+
|
74
95
|
end
|
75
96
|
end
|
76
97
|
end
|
data/lib/clickatell/version.rb
CHANGED
@@ -0,0 +1,15 @@
|
|
1
|
+
class Hash
|
2
|
+
# Returns a new hash containing only the keys specified
|
3
|
+
# that exist in the current hash.
|
4
|
+
#
|
5
|
+
# {:a => '1', :b => '2', :c => '3'}.only(:a, :c)
|
6
|
+
# # => {:a => '1', :c => '3'}
|
7
|
+
#
|
8
|
+
# Keys that do not exist in the original hash are ignored.
|
9
|
+
def only(*keys)
|
10
|
+
self.inject({}) do |new_hash, (key, value)|
|
11
|
+
new_hash[key] = value if keys.include?(key)
|
12
|
+
new_hash
|
13
|
+
end
|
14
|
+
end
|
15
|
+
end
|
data/spec/api_spec.rb
CHANGED
@@ -4,21 +4,28 @@ require File.dirname(__FILE__) + '/../lib/clickatell'
|
|
4
4
|
module Clickatell
|
5
5
|
|
6
6
|
describe "API Command" do
|
7
|
+
before do
|
8
|
+
@command = API::Command.new('cmdname')
|
9
|
+
end
|
10
|
+
|
7
11
|
it "should return encoded URL for the specified command and parameters" do
|
8
|
-
|
9
|
-
url = command.with_params(:param_one => 'abc', :param_two => '123')
|
12
|
+
url = @command.with_params(:param_one => 'abc', :param_two => '123')
|
10
13
|
url.should == URI.parse("http://api.clickatell.com/http/cmdname?param_one=abc¶m_two=123")
|
11
14
|
end
|
12
15
|
|
13
16
|
it "should URL encode any special characters in parameters" do
|
14
|
-
|
15
|
-
url = command.with_params(:param_one => 'abc', :param_two => 'hello world')
|
17
|
+
url = @command.with_params(:param_one => 'abc', :param_two => 'hello world')
|
16
18
|
url.should == URI.parse("http://api.clickatell.com/http/cmdname?param_one=abc¶m_two=hello%20world")
|
17
19
|
end
|
20
|
+
end
|
21
|
+
|
22
|
+
describe "Secure API Command" do
|
23
|
+
before do
|
24
|
+
@command = API::Command.new('cmdname', :secure => true)
|
25
|
+
end
|
18
26
|
|
19
|
-
it "should
|
20
|
-
|
21
|
-
url = command.with_params(:param_one => 'abc', :param_two => '123')
|
27
|
+
it "should use HTTPS" do
|
28
|
+
url = @command.with_params(:param_one => 'abc', :param_two => '123')
|
22
29
|
url.should == URI.parse("https://api.clickatell.com/http/cmdname?param_one=abc¶m_two=123")
|
23
30
|
end
|
24
31
|
end
|
@@ -72,6 +79,28 @@ module Clickatell
|
|
72
79
|
API.send_message('4477791234567', 'hello world', :session_id => 'abcde').should == 'message_id'
|
73
80
|
end
|
74
81
|
|
82
|
+
it "should support sending messages with custom from number, returning the message id" do
|
83
|
+
API.should_receive(:execute_command).with('sendmsg',
|
84
|
+
:session_id => 'abcde',
|
85
|
+
:to => '4477791234567',
|
86
|
+
:text => 'hello world',
|
87
|
+
:from => 'LUKE'
|
88
|
+
).and_return(response=mock('response'))
|
89
|
+
Response.should_receive(:parse).with(response).and_return('ID' => 'message_id')
|
90
|
+
API.send_message('4477791234567', 'hello world', {:session_id => 'abcde'}, :from => 'LUKE')
|
91
|
+
end
|
92
|
+
|
93
|
+
it "should ignore any invalid parameters when sending message" do
|
94
|
+
API.should_receive(:execute_command).with('sendmsg',
|
95
|
+
:session_id => 'abcde',
|
96
|
+
:to => '4477791234567',
|
97
|
+
:text => 'hello world',
|
98
|
+
:from => 'LUKE'
|
99
|
+
).and_return(response=mock('response'))
|
100
|
+
Response.stub!(:parse).and_return('ID' => 'foo')
|
101
|
+
API.send_message('4477791234567', 'hello world', {:session_id => 'abcde'}, :from => 'LUKE', :any_old_param => 'test')
|
102
|
+
end
|
103
|
+
|
75
104
|
it "should support message status query with authentication, returning message status" do
|
76
105
|
API.should_receive(:execute_command).with('querymsg',
|
77
106
|
:api_id => '1234',
|
@@ -84,7 +113,7 @@ module Clickatell
|
|
84
113
|
:username => 'joebloggs', :password => 'superpass', :api_key => '1234'
|
85
114
|
).should == 'message_status'
|
86
115
|
end
|
87
|
-
|
116
|
+
|
88
117
|
it "should support message status query with pre-auth" do
|
89
118
|
API.should_receive(:execute_command).with('querymsg',
|
90
119
|
:session_id => 'abcde',
|
data/spec/connection_spec.rb
CHANGED
@@ -13,12 +13,20 @@ module Clickatell
|
|
13
13
|
end
|
14
14
|
|
15
15
|
describe Connection, ' when authenticated' do
|
16
|
+
before do
|
17
|
+
@connection = Connection.new('my_api_key', 'myusername', 'mypassword')
|
18
|
+
@connection.stub!(:session_id).and_return('session_id')
|
19
|
+
end
|
20
|
+
|
16
21
|
it "should send command with session_id without re-authenticating" do
|
17
|
-
connection = Connection.new('my_api_key', 'myusername', 'mypassword')
|
18
|
-
connection.stub!(:session_id).and_return('session_id')
|
19
22
|
API.should_receive(:authenticate).never
|
20
23
|
API.should_receive(:send_message).with('4477791234567', 'hello world', :session_id => 'session_id')
|
21
|
-
connection.send_message('4477791234567', 'hello world')
|
24
|
+
@connection.send_message('4477791234567', 'hello world')
|
25
|
+
end
|
26
|
+
|
27
|
+
it "should support API calls with additional opts, passing them after auth options" do
|
28
|
+
API.should_receive(:send_message).with('4477791234567', 'hello world', {:session_id => 'session_id'}, :from => 'LUKE')
|
29
|
+
@connection.send_message('4477791234567', 'hello world', {:from => 'LUKE'})
|
22
30
|
end
|
23
31
|
end
|
24
32
|
|
@@ -0,0 +1,14 @@
|
|
1
|
+
require File.dirname(__FILE__) + '/spec_helper'
|
2
|
+
require File.dirname(__FILE__) + '/../lib/clickatell'
|
3
|
+
|
4
|
+
describe Hash do
|
5
|
+
it "should return only the keys specified" do
|
6
|
+
hash = {:a => 'foo', :b => 'bar', :c => 'baz'}
|
7
|
+
hash.only(:a, :b).should == {:a => 'foo', :b => 'bar'}
|
8
|
+
end
|
9
|
+
|
10
|
+
it "should return only the keys specified, ignoring keys that do not exist" do
|
11
|
+
hash = {:a => 'foo', :b => 'bar', :c => 'baz'}
|
12
|
+
hash.only(:a, :d).should == {:a => 'foo'}
|
13
|
+
end
|
14
|
+
end
|
data/spec/response_spec.rb
CHANGED
@@ -5,19 +5,18 @@ module Clickatell
|
|
5
5
|
|
6
6
|
describe "Response parser" do
|
7
7
|
before do
|
8
|
+
@raw_response = stub('response')
|
8
9
|
Clickatell::API::Error.stub!(:parse).and_return(Clickatell::API::Error.new('', ''))
|
9
10
|
end
|
10
11
|
|
11
12
|
it "should return hash for one-line success response" do
|
12
|
-
raw_response
|
13
|
-
|
14
|
-
Response.parse(raw_response).should == {'k1' => 'foo', 'k2' => 'bar'}
|
13
|
+
@raw_response.stub!(:body).and_return('k1: foo k2: bar')
|
14
|
+
Response.parse(@raw_response).should == {'k1' => 'foo', 'k2' => 'bar'}
|
15
15
|
end
|
16
16
|
|
17
17
|
it "should raise API::Error if response contains an error message" do
|
18
|
-
raw_response
|
19
|
-
|
20
|
-
proc { Response.parse(raw_response) }.should raise_error(Clickatell::API::Error)
|
18
|
+
@raw_response.stub!(:body).and_return('ERR: 001, Authentication failed')
|
19
|
+
proc { Response.parse(@raw_response) }.should raise_error(Clickatell::API::Error)
|
21
20
|
end
|
22
21
|
end
|
23
22
|
|
data/website/index.html
CHANGED
@@ -16,7 +16,7 @@
|
|
16
16
|
|
17
17
|
<div id="header">
|
18
18
|
|
19
|
-
<h1>Clickatell Ruby API <span class="version">0.
|
19
|
+
<h1>Clickatell Ruby API <span class="version">0.3.0</span>
|
20
20
|
<span class="tagline">gem install clickatell</span></h1>
|
21
21
|
|
22
22
|
</div>
|
@@ -101,6 +101,16 @@ $ sms -u your_username -p your_password -k your_api_key 447771234567 'Hello from
|
|
101
101
|
<p>These values will take presedence over any values in your ~/.clickatell file.</p>
|
102
102
|
|
103
103
|
|
104
|
+
<p>You can also specify the name or number that will appear in the “From” label on the recipients phone. You can either add a “from” key to your .clickatell file or manually using the—from option:</p>
|
105
|
+
|
106
|
+
|
107
|
+
<pre><code>
|
108
|
+
$ sms --from 'Luke Redpath' 447771234567 'Hello from clickatell'
|
109
|
+
</code></pre>
|
110
|
+
|
111
|
+
<p>The “from” option can either be a 16 digit number or an 11 character alpha-numeric string.</p>
|
112
|
+
|
113
|
+
|
104
114
|
<p>You can also use the <ins>sms</ins> utility to check your Clickatell account balance:</p>
|
105
115
|
|
106
116
|
|
@@ -108,6 +118,16 @@ $ sms -u your_username -p your_password -k your_api_key 447771234567 'Hello from
|
|
108
118
|
$ sms --show-balance
|
109
119
|
</code></pre>
|
110
120
|
|
121
|
+
<p>Whenever you send a message with the <ins>sms</ins> utility, it will return an alpha-numeric message ID. You can use this message ID to retrieve the message’s current status using the—status option:</p>
|
122
|
+
|
123
|
+
|
124
|
+
<pre><code>
|
125
|
+
$ sms --status 30b7d15bffb38695ba26e77c9c20f4ec
|
126
|
+
</code></pre>
|
127
|
+
|
128
|
+
<p>This will return a message status and message status code.</p>
|
129
|
+
|
130
|
+
|
111
131
|
<p>Run <ins>sms</ins> without any arguments for a full list of options.</p>
|
112
132
|
|
113
133
|
|
@@ -129,7 +149,7 @@ $ sms --show-balance
|
|
129
149
|
<div id="footer">
|
130
150
|
<p class="copyright">
|
131
151
|
<a href="http://rubyforge.org/projects/clickatell">Rubyforge Project Page</a> |
|
132
|
-
<a href="http://rubyforge.org/frs/?group_id=4295&release_id=13922">Download latest version (0.
|
152
|
+
<a href="http://rubyforge.org/frs/?group_id=4295&release_id=13922">Download latest version (0.3.0)</a> |
|
133
153
|
<a href="rdoc/">RDoc</a>
|
134
154
|
</p>
|
135
155
|
</div>
|
data/website/index.txt
CHANGED
@@ -64,12 +64,28 @@ $ sms -u your_username -p your_password -k your_api_key 447771234567 'Hello from
|
|
64
64
|
|
65
65
|
These values will take presedence over any values in your ~/.clickatell file.
|
66
66
|
|
67
|
+
You can also specify the name or number that will appear in the "From" label on the recipients phone. You can either add a "from" key to your .clickatell file or manually using the --from option:
|
68
|
+
|
69
|
+
<pre><code>
|
70
|
+
$ sms --from 'Luke Redpath' 447771234567 'Hello from clickatell'
|
71
|
+
</code></pre>
|
72
|
+
|
73
|
+
The "from" option can either be a 16 digit number or an 11 character alpha-numeric string.
|
74
|
+
|
67
75
|
You can also use the +sms+ utility to check your Clickatell account balance:
|
68
76
|
|
69
77
|
<pre><code>
|
70
78
|
$ sms --show-balance
|
71
79
|
</code></pre>
|
72
80
|
|
81
|
+
Whenever you send a message with the +sms+ utility, it will return an alpha-numeric message ID. You can use this message ID to retrieve the message's current status using the --status option:
|
82
|
+
|
83
|
+
<pre><code>
|
84
|
+
$ sms --status 30b7d15bffb38695ba26e77c9c20f4ec
|
85
|
+
</code></pre>
|
86
|
+
|
87
|
+
This will return a message status and message status code.
|
88
|
+
|
73
89
|
Run +sms+ without any arguments for a full list of options.
|
74
90
|
|
75
91
|
h3. License
|
metadata
CHANGED
@@ -3,8 +3,8 @@ rubygems_version: 0.9.2
|
|
3
3
|
specification_version: 1
|
4
4
|
name: clickatell
|
5
5
|
version: !ruby/object:Gem::Version
|
6
|
-
version: 0.
|
7
|
-
date: 2007-08-
|
6
|
+
version: 0.3.0
|
7
|
+
date: 2007-08-23 00:00:00 +01:00
|
8
8
|
summary: Ruby interface to the Clickatell SMS gateway service.
|
9
9
|
require_paths:
|
10
10
|
- lib
|
@@ -42,10 +42,12 @@ files:
|
|
42
42
|
- lib/clickatell/utility.rb
|
43
43
|
- lib/clickatell/utility/options.rb
|
44
44
|
- lib/clickatell/version.rb
|
45
|
+
- lib/core-ext/hash.rb
|
45
46
|
- scripts/txt2html
|
46
47
|
- setup.rb
|
47
48
|
- spec/api_spec.rb
|
48
49
|
- spec/connection_spec.rb
|
50
|
+
- spec/hash_ext_spec.rb
|
49
51
|
- spec/response_spec.rb
|
50
52
|
- spec/spec.opts
|
51
53
|
- spec/spec_helper.rb
|