Class: ZenviaS4m::SendSms

Inherits:
Object
  • Object
show all
Defined in:
lib/zenvia_s4m/send_sms.rb

Instance Method Summary collapse

Constructor Details

#initialize(params) ⇒ SendSms

Returns a new instance of SendSms.



6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
# 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., 
     	code: ZenviaS4m.config.code, 
     	from: ZenviaS4m.config.from,
     	dispatch: 'send', 
     	to: @params[:phone], 
     	msg: @params[:message], 
     	id: @params[:sms_id], 
     	callbackOption: 1 
    }
end

Instance Method Details

#add_schedule(date) ⇒ Object



22
23
24
25
# 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_codeSMSObject



33
34
35
# File 'lib/zenvia_s4m/send_sms.rb', line 33

def return_codeSMS
	@res
end

#sendObject



27
28
29
30
31
# 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