Sha256: 9015e80f48cfc4b487862ca45340ae62a88ebc53026b68dde802400cda62aca7
Contents?: true
Size: 1.25 KB
Versions: 1
Compression:
Stored size: 1.25 KB
Contents
require 'chutki/version' require 'httparty' class Chutki include HTTParty base_uri "http://prosms.easy2approach.com" attr_reader :options def initialize(options = {}) @options = options @username = options[:user] @password = options[:password] @sender_id = options[:sender] end def settings!(options) @options.merge!(options) end def send_sms(message,to,opts = {}) opts ||= {} opts[:mobiles] = to opts[:message] = message makesend("/sendhttp.php",opts) end def deliver(mail) send_sms(mail.body,mail.to[0]) end def deliver!(mail) deliver(mail) end def check_dnd_balance balance("dnd") end def voice_balance balance("voice") end def balance(type = nil) opts = {} if type && (["dnd","voice"].include?(type)) opts[:type] = type end makesend("/api/balance.php",opts) end def change_password(new_password) makesend("/api/change_password.php",{:newpass => new_password}) end def validation makesend("/api/validate.php") end def check_delivery_report(msgid) makesend("/api/check_delivery.php",:msgid => msgid) end private def makesend(endpoint,opts = {}) self.class.post(endpoint,{:query => opts.merge(@options)}) end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
chutki-1.1.0 | lib/chutki.rb |