lib/smshelper/api/webtext.rb in smshelper-0.2.2 vs lib/smshelper/api/webtext.rb in smshelper-0.2.3
- old
+ new
@@ -10,20 +10,22 @@
add_query_options! :api_id => config.webtext[:uname], :api_pwd => config.webtext[:passwd]
super
end
def send_message(message)
+ uuid = @uuid.generate
+
if message.utf_8
message.to_hex_be
q = {:unicode => '1', :hex => message.text}
else
q = {:txt => message.text}
end
- options = {:dest => message.recipient, :tag => message.sender}
+ options = {:dest => message.recipient, :tag => message.sender, :msgid => uuid}
options = options.merge(@extra_options) unless @extra_options.nil?
resp = (post "send_text.html", :extra_query => options.merge(q))
- process_response_code(resp.to_s) ? (@response_code.webtext(resp.to_s)) : (raise ErrorDuringSend, @response_code.webtext(resp))
+ process_response_code(resp.to_s) ? (@sent_message_ids << uuid; uuid) : (raise ErrorDuringSend, @response_code.webtext(resp))
# :validity => '2'
end
def get_balance
{'EUR' => (post "get_balance.html").to_s.split(':').last.strip}