class Rest
Public Class Methods
new(username, password)
click to toggle source
# File lib/rest.rb, line 6 def initialize(username, password) @username = username @password = password end
Public Instance Methods
get_base_price()
click to toggle source
# File lib/rest.rb, line 67 def get_base_price url = sprintf @@path,"GetBasePrice" request(url,get_data) end
get_credit()
click to toggle source
# File lib/rest.rb, line 62 def get_credit url = sprintf @@path,"GetCredit" request(url,get_data) end
get_data()
click to toggle source
# File lib/rest.rb, line 11 def get_data { :username => @username, :password => @password } end
get_messages(location, index, count, from="")
click to toggle source
# File lib/rest.rb, line 51 def get_messages(location, index, count, from="") url = sprintf @@path,"GetMessages" data = { :location=>location, :index=> index, :count=> count, :from=> from } request(url,data.merge(get_data)) end
get_numbers()
click to toggle source
# File lib/rest.rb, line 72 def get_numbers url = sprintf @@path,"GetUserNumbers" request(url,get_data) end
is_delivered(recId)
click to toggle source
# File lib/rest.rb, line 43 def is_delivered(recId) url = sprintf @@path,"GetDeliveries2" data = { :recId=>recId, } request(url,data.merge(get_data)) end
request(url,params)
click to toggle source
# File lib/rest.rb, line 18 def request(url,params) HTTP.post(url, :form => params).parse end
send(to,from,text,isFlash=false)
click to toggle source
# File lib/rest.rb, line 22 def send(to,from,text,isFlash=false) url = sprintf @@path,"SendSMS" data = { :to=>to, :from=>from, :text=>text, :isFlash=>isFlash } request(url,data.merge(get_data)) end
send_by_base_number(text, to, bodyId)
click to toggle source
# File lib/rest.rb, line 33 def send_by_base_number(text, to, bodyId) url = sprintf @@path,"BaseServiceNumber" data = { :text=>text, :to=>to, :bodyId=>bodyId } request(url,data.merge(get_data)) end