Sha256: fd81b35910400f131991e411fbe84e8c8b9b668927297f806154c23d68ee3d8d
Contents?: true
Size: 990 Bytes
Versions: 2
Compression:
Stored size: 990 Bytes
Contents
require 'httparty' module WavecellOtpAndSms class SendSms include HTTParty attr_accessor :source, :destination, :text, :encoding # Initialize SMS parameters to send message to api def initialize(options = {}) @source = options[:source] @destination = options[:destination] @text = options[:text] @encoding = options[:encoding] end # Call this to generate url for the api calls def send generate_url end private # Construct API using the parameters and initial configuration 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 end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
wavecell_otp_and_sms-1.1.0 | lib/wavecell_otp_and_sms/send_sms.rb |
wavecell_otp_and_sms-1.0.9 | lib/wavecell_otp_and_sms/send_sms.rb |