lib/smshelper/api/traitel.rb in smshelper-0.2.10 vs lib/smshelper/api/traitel.rb in smshelper-0.3.0
- old
+ new
@@ -1,11 +1,10 @@
module Smshelper
module Api
class Traitel < Base
base_uri 'http://api.traitel.com'
# headers 'Accept' => 'text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8', 'Accept-Language' => 'en-us,en;q=0.5', 'Accept-Encoding' => 'gzip, deflate', 'DNT' => '1', 'Connection' => 'keep-alive'
-
def initialize(*args)
config = args.shift
add_query_options! :user => config.traitel[:uname], :pass => config.traitel[:passwd] # "\"#{config.traitel[:passwd]}\""
super
end
@@ -23,10 +22,10 @@
:replyto => message.sender,
:output => :verbose,
:concatenate => true
}
options = options.merge(@extra_options) unless @extra_options.nil?
- resp = (get 'smsgateway.pl', :extra_query => options.merge(q)) #; resp.split(',')[2]
+ resp = (get 'smsgateway.pl', :extra_query => options.merge(q))
process_response_code(resp) ? (@sent_message_ids << resp.split(',')[2]; resp.split(',')[2]) : (raise ErrorDuringSend "Could not deliver")
end
def get_balance
{'AUD' => (get 'selfserve.pl', :extra_query => {:mode => :balance}).split(' ').last.strip}