class Msg91ruby::API
Constants
- URL
Attributes
auth_key[RW]
senderid[RW]
Public Class Methods
new(auth_key, senderid)
click to toggle source
# File lib/msg91ruby/api.rb, line 5 def initialize(auth_key, senderid) @auth_key = auth_key @senderid = senderid @url = URL end
Public Instance Methods
balance()
click to toggle source
# File lib/msg91ruby/api.rb, line 24 def balance params = {:authkey => auth_key, :type => 1, :response => "json"} uri = full_path('/api/balance.php', params) response = Net::HTTP.get(uri) end
change_password(passwd, newpasswd)
click to toggle source
# File lib/msg91ruby/api.rb, line 18 def change_password(passwd, newpasswd) params = {:authkey => auth_key, :password => passwd, :newpass => newpasswd, :response => "json"} uri = full_path('/api/password.php', params) response = Net::HTTP.get(uri) end
full_path(path, params)
click to toggle source
# File lib/msg91ruby/api.rb, line 30 def full_path(path, params) encoded_params = URI.encode_www_form(params) params_string = [path, encoded_params].join("?") URI.parse(@url + params_string) end
send(mobilenos,msg,route)
click to toggle source
# File lib/msg91ruby/api.rb, line 11 def send(mobilenos,msg,route) mobile_nos = mobilenos.is_a?(Array) ? mobilenos.join(',') : mobilenos params = {:authkey => auth_key, :mobiles => mobile_nos, :message => msg , :sender => senderid ,:route => route, :response => "json"} uri = full_path('/api/sendhttp.php', params) response = Net::HTTP.get(uri) end