Class: AQL::SMS
Class Method Summary collapse
- .authenticate(opts) ⇒ Object
- .check_credit ⇒ Object
- .format_number(number, format = :uk) ⇒ Object
- .send_message(dests = [], msg = "", opts = {}) ⇒ Object
Class Method Details
.authenticate(opts) ⇒ Object
10 11 12 |
# File 'lib/aql_sms_api.rb', line 10 def self.authenticate(opts) default_params opts end |
.check_credit ⇒ Object
14 15 16 17 |
# File 'lib/aql_sms_api.rb', line 14 def self.check_credit res = get "/postmsg.php", :query => {:cmd => "credit"} valid?(res) ? (res == "AQSMS-AUTHERROR" ? false : res.match(/\=(\d+)/)[1]).to_i : res end |
.format_number(number, format = :uk) ⇒ Object
25 26 27 |
# File 'lib/aql_sms_api.rb', line 25 def self.format_number(number, format = :uk) NumberFormat.send(format, number) end |
.send_message(dests = [], msg = "", opts = {}) ⇒ Object
19 20 21 22 23 |
# File 'lib/aql_sms_api.rb', line 19 def self.(dests = [], msg = "", opts = {}) numbers = dests.collect{|n| format_number(n)}.join(",") res = get "/sms_gw.php", :query => opts.merge(:destination => numbers, :message => msg) valid?(res) ? SMSResponse.new(res) : res end |