Class: FraudlabsproRuby::Api::SMSVerification
- Inherits:
-
Object
- Object
- FraudlabsproRuby::Api::SMSVerification
- Defined in:
- lib/fraudlabspro_ruby/api/smsverification.rb
Class Method Summary collapse
-
.sendSMS(params = {}) ⇒ Object
Send SMS Verification for authentication.
-
.verifySMS(params = {}) ⇒ Object
Get Verification result.
Class Method Details
.sendSMS(params = {}) ⇒ Object
Send SMS Verification for authentication.
11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 |
# File 'lib/fraudlabspro_ruby/api/smsverification.rb', line 11 def self.sendSMS(params = {}) if params[:tel].index('+') != 0 params[:tel] = '+' + params[:tel] end uri = URI.parse("https://api.fraudlabspro.com/v1/verification/send") http = Net::HTTP.new(uri.host, uri.port) http.use_ssl = true request = Net::HTTP::Post.new(uri.request_uri) request.set_form_data({ 'key' => FraudlabsproRuby::Configuration.api_key, 'format' => params[:format] || 'json', 'tel' => params[:tel], 'mesg' => params[:mesg] || '', 'country_code' => params[:country_code] || '' }) response = http.request(request) if response == nil return false else return response end end |
.verifySMS(params = {}) ⇒ Object
Get Verification result.
38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 |
# File 'lib/fraudlabspro_ruby/api/smsverification.rb', line 38 def self.verifySMS(params = {}) if params[:format] == nil params[:format] = 'json' end uri = URI.parse("https://api.fraudlabspro.com/v1/verification/result?key=" + FraudlabsproRuby::Configuration.api_key + "&format=" + params[:format] + "&tran_id=" + params[:tran_id] + "&otp=" + params[:otp]) http = Net::HTTP.new(uri.host, uri.port) http.use_ssl = true request = Net::HTTP::Get.new(uri.request_uri) response = http.request(request) if response == nil return false else return response end end |