class Every8d::Client
Attributes
account[RW]
password[RW]
Public Class Methods
new(options = {})
click to toggle source
# File lib/every8d/client.rb, line 7 def initialize(options = {}) @uid = options.fetch(:UID) { ENV.fetch('EVERY8d_ACCOUNT') } @pwd = options.fetch(:PWD) { ENV.fetch('EVERY8d_PASSWORD') } @host = options.fetch(:host) { 'http://api.every8d.com/API21/HTTP' } end
Public Instance Methods
get_balance()
click to toggle source
# File lib/every8d/client.rb, line 19 def get_balance http_post('getCredit.ashx') end
get_message(options = {})
click to toggle source
# File lib/every8d/client.rb, line 15 def get_message(options = {}) http_post('getDeliveryStatus.ashx', options) end
http_post(url, data = {})
click to toggle source
# File lib/every8d/client.rb, line 27 def http_post(url, data = {}) Net::HTTP.post_form(URI.parse("#{@host}/#{url}"), data.merge(UID: @uid, PWD: @pwd)).body end
send_sms(options = {})
click to toggle source
# File lib/every8d/client.rb, line 23 def send_sms(options = {}) http_post('sendSMS.ashx', options) end