class WavecellOtpAndSms::SendSms

Attributes

destination[RW]
encoding[RW]
source[RW]
text[RW]

Public Class Methods

new(options = {}) click to toggle source

Initialize SMS parameters to send message to api

# File lib/wavecell_otp_and_sms/send_sms.rb, line 9
def initialize(options = {})
  @source = options[:source]
  @destination = options[:destination]
  @text = options[:text]
  @encoding = options[:encoding]
end

Public Instance Methods

send() click to toggle source

Call this to generate url for the api calls

# File lib/wavecell_otp_and_sms/send_sms.rb, line 17
def send
  generate_url
end

Private Instance Methods

generate_url() click to toggle source

Construct API using the parameters and initial configuration

# File lib/wavecell_otp_and_sms/send_sms.rb, line 23
def generate_url
  api_key = WavecellOtpAndSms.configuration.api_key
  sub_account = WavecellOtpAndSms.configuration.sub_account
  puts `curl -X POST https://api.wavecell.com/sms/v1/#{sub_account}/single -H "Authorization: Bearer #{api_key}" -H "Content-Type:  application/json" -d $'{ "source": "#{source}", "destination": "+63#{destination}", "text": "#{text}", "encoding": "#{encoding}" }'`
end