class ZenviaS4m::SendSms

Public Class Methods

new(params) click to toggle source
# File lib/zenvia_s4m/send_sms.rb, line 6
          def initialize(params)
                  @params = params
                  @res = nil
                  puts @params if ZenviaS4m.config.log
@info_SMS =  { 
  account: ZenviaS4m.config.account, 
  code: ZenviaS4m.config.code, 
  from: ZenviaS4m.config.from,
  dispatch: 'send', 
  to: @params[:phone], 
  msg: @params[:message], 
  id: @params[:sms_id], 
  callbackOption: 1 
}
          end

Public Instance Methods

add_schedule(date) click to toggle source
# File lib/zenvia_s4m/send_sms.rb, line 22
def add_schedule(date)
        #dd/mm/aaaa hh:mm:ss
        @info_SMS[:schedule] = date unless date.nil?
end
return_codeSMS() click to toggle source
# File lib/zenvia_s4m/send_sms.rb, line 33
def return_codeSMS
        @res
end
send() click to toggle source
# File lib/zenvia_s4m/send_sms.rb, line 27
def send
        puts @info_SMS if ZenviaS4m.config.log
        puts  ZenviaS4m.config.url if  ZenviaS4m.config.log
        @res = RestClient.post ZenviaS4m.config.url, @info_SMS
end