Class: SmsGateway::Adapters::SmsGlobal

Inherits:
Object
  • Object
show all
Includes:
HTTParty
Defined in:
lib/sms_gateway/adapters/sms_global.rb

Instance Method Summary collapse

Constructor Details

#initialize(config = {}) ⇒ SmsGlobal

Returns a new instance of SmsGlobal.



10
11
12
13
14
# File 'lib/sms_gateway/adapters/sms_global.rb', line 10

def initialize(config={})
  @config = {:user => SmsGateway::Base.user, :password => SmsGateway::Base.password,
    :from => SmsGateway::Base.from}
  @config.merge!(config)
end

Instance Method Details

#send_sms(sms) ⇒ Object



16
17
18
19
# File 'lib/sms_gateway/adapters/sms_global.rb', line 16

def send_sms(sms)
  options = @config.merge({:action => "sendsms", :from => sms.from, :to => sms.to, :text => sms.text})
  self.class.post('/http-api.php', :query => options)
end