Class: OTP

Inherits:
Base show all
Defined in:
lib/flutterwave_sdk/flutterwave_objects/otp.rb

Instance Attribute Summary

Attributes inherited from Base

#flutterwave_object

Instance Method Summary collapse

Methods inherited from Base

#check_passed_parameters, #delete_request, #get_request, #initialize, #post_request, #put_request

Constructor Details

This class inherits a constructor from Base

Instance Method Details

#create_otp(data) ⇒ Object



5
6
7
8
9
10
11
12
# File 'lib/flutterwave_sdk/flutterwave_objects/otp.rb', line 5

def create_otp(data)
    base_url = flutterwave_object.base_url 
    required_parameters = ["length", "customer", "sender", "send", "medium"]
    check_passed_parameters(required_parameters, data)
    payload = data.to_json
    response = post_request("#{base_url}/otps", payload) 
    return response
end

#validate_otp(reference, data) ⇒ Object



14
15
16
17
18
19
20
21
# File 'lib/flutterwave_sdk/flutterwave_objects/otp.rb', line 14

def validate_otp(reference, data)
    base_url = flutterwave_object.base_url 
    required_parameters = ["otp"]
    check_passed_parameters(required_parameters, data)
    payload = data.to_json
    response = post_request("#{base_url}/otps/#{reference}/validate", payload) 
    return response
end