Method: Auth::TwoFactorOtp#send_transactional_sms

Defined in:
lib/auth/two_factor_otp.rb

#send_transactional_sms(args) ⇒ Object

to_number : string, indian telephone number, without the preceeding 91 template : the two_factor_otp template example request should look like this “2factor.in/API/R1/?module=TRANS_SMS&apikey=#:two_factor_sms_api_key&to=#to_number&from=#template_sender_id&templatename=TemplateName&var1=VAR1_VALUE&var2=VAR2_VALUE” @return session_id



31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
# File 'lib/auth/two_factor_otp.rb', line 31

def send_transactional_sms(args)
	to_number = args[:to_number]
	template_name = args[:template_name]
	var_hash = args[:var_hash]
	template_sender_id = args[:template_sender_id]
	
	url = "https://2factor.in/API/R1/?module=TRANS_SMS"
	
	params = {
		apikey: Auth.configuration.third_party_api_keys[:two_factor_sms_api_key],
		to: to_number,
		from: template_sender_id,
		templatename: template_name,
	}.merge(var_hash)
	
	request = Typhoeus::Request.new(
	  url,
	  params: params,
	  timeout: typhoeus_timeout
	)

	response = request.run

	response.body
end