aql_sms_api 0.1.0 → 0.2.0
Sign up to get free protection for your applications and to get access to all the features.
- data/README.md +4 -2
- data/VERSION +1 -1
- data/aql_sms_api.gemspec +2 -2
- data/lib/aql_sms_api.rb +23 -6
- metadata +3 -3
data/README.md
CHANGED
@@ -6,9 +6,11 @@ A ruby wrapper for the AQL SMS API. I am building this for use in a specific pro
|
|
6
6
|
|
7
7
|
#### Authentication
|
8
8
|
|
9
|
-
# @params
|
9
|
+
# @params hash default_params
|
10
|
+
# must include :username and :password but can also contain
|
11
|
+
# other default params such as :originator
|
10
12
|
#
|
11
|
-
AQL::SMS.authenticate "username", "password"
|
13
|
+
AQL::SMS.authenticate :username => "username", :password => "password"
|
12
14
|
|
13
15
|
#### Check credit
|
14
16
|
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.
|
1
|
+
0.2.0
|
data/aql_sms_api.gemspec
CHANGED
@@ -5,11 +5,11 @@
|
|
5
5
|
|
6
6
|
Gem::Specification.new do |s|
|
7
7
|
s.name = %q{aql_sms_api}
|
8
|
-
s.version = "0.
|
8
|
+
s.version = "0.2.0"
|
9
9
|
|
10
10
|
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
11
11
|
s.authors = ["Aaron Russell"]
|
12
|
-
s.date = %q{2010-05-
|
12
|
+
s.date = %q{2010-05-29}
|
13
13
|
s.description = %q{A ruby wrapper for the AQL SMS API.}
|
14
14
|
s.email = %q{aaron@gc4.co.uk}
|
15
15
|
s.extra_rdoc_files = [
|
data/lib/aql_sms_api.rb
CHANGED
@@ -7,20 +7,18 @@ module AQL
|
|
7
7
|
include HTTParty
|
8
8
|
base_uri "https://gw.aql.com/sms/"
|
9
9
|
|
10
|
-
def self.authenticate(
|
11
|
-
|
10
|
+
def self.authenticate(opts)
|
11
|
+
default_params opts
|
12
12
|
end
|
13
|
-
|
14
|
-
authenticate
|
15
13
|
|
16
14
|
def self.check_credit
|
17
|
-
res = get "/postmsg.php", :query =>
|
15
|
+
res = get "/postmsg.php", :query => {:cmd => "credit"}
|
18
16
|
valid?(res) ? (res == "AQSMS-AUTHERROR" ? false : res.match(/\=(\d+)/)[1]).to_i : res
|
19
17
|
end
|
20
18
|
|
21
19
|
def self.send_message(dests = [], msg = "", opts = {})
|
22
20
|
numbers = dests.collect{|n| format_number(n)}.join(",")
|
23
|
-
res = get "/sms_gw.php", :query =>
|
21
|
+
res = get "/sms_gw.php", :query => opts.merge(:destination => numbers, :message => msg)
|
24
22
|
valid?(res) ? SMSResponse.new(res) : res
|
25
23
|
end
|
26
24
|
|
@@ -49,6 +47,25 @@ module AQL
|
|
49
47
|
|
50
48
|
end
|
51
49
|
|
50
|
+
class SMSDeliveryReport
|
51
|
+
|
52
|
+
attr_reader :code, :message, :destination
|
53
|
+
|
54
|
+
def initialize(params)
|
55
|
+
@code = params[:reportcode].to_s
|
56
|
+
@destination = params[:destinationnumber].to_s
|
57
|
+
@message = case @code
|
58
|
+
when "1" then "Delivered to Handset"
|
59
|
+
when "2" then "Rejected from Handset"
|
60
|
+
when "4" then "Buffered in transit (phone probably off / out of reception)"
|
61
|
+
when "8" then "Accepted by SMSC"
|
62
|
+
when "16" then "Rejected by SMSC"
|
63
|
+
else "Unknown response code"
|
64
|
+
end
|
65
|
+
end
|
66
|
+
|
67
|
+
end
|
68
|
+
|
52
69
|
module NumberFormat
|
53
70
|
|
54
71
|
def self.uk(number)
|
metadata
CHANGED
@@ -4,9 +4,9 @@ version: !ruby/object:Gem::Version
|
|
4
4
|
prerelease: false
|
5
5
|
segments:
|
6
6
|
- 0
|
7
|
-
-
|
7
|
+
- 2
|
8
8
|
- 0
|
9
|
-
version: 0.
|
9
|
+
version: 0.2.0
|
10
10
|
platform: ruby
|
11
11
|
authors:
|
12
12
|
- Aaron Russell
|
@@ -14,7 +14,7 @@ autorequire:
|
|
14
14
|
bindir: bin
|
15
15
|
cert_chain: []
|
16
16
|
|
17
|
-
date: 2010-05-
|
17
|
+
date: 2010-05-29 00:00:00 +01:00
|
18
18
|
default_executable:
|
19
19
|
dependencies:
|
20
20
|
- !ruby/object:Gem::Dependency
|