Class: Skuby::Gateway

Inherits:
Object
  • Object
show all
Includes:
HTTParty
Defined in:
lib/skuby/gateway.rb

Class Method Summary collapse

Class Method Details

.build_params(text, recipients, custom_params) ⇒ Object



11
12
13
14
15
16
17
# File 'lib/skuby/gateway.rb', line 11

def self.build_params(text, recipients, custom_params)
  if custom_params && custom_params.is_a?(Hash)
    custom_params.merge('text' => text, 'recipients[]' => recipients)
  else
    Skuby.config.to_hash.merge('text' => text, 'recipients[]' => recipients)
  end
end

.send_sms(text = '', recipients = '', custom_params = nil) ⇒ Object



6
7
8
9
# File 'lib/skuby/gateway.rb', line 6

def self.send_sms(text = '', recipients = '', custom_params = nil)
  params = build_params(text, recipients, custom_params)
  SMSResponse.new(post('', body: params, verify: false), text, recipients)
end