Class: Yasminaai::OtPs::Client
- Inherits:
-
Object
- Object
- Yasminaai::OtPs::Client
- Defined in:
- lib/yasminaai/ot_ps/client.rb
Instance Method Summary collapse
- #initialize(client:) ⇒ void constructor
-
#request_otp_for_issuing_policy(request_options: {}, **params) ⇒ untyped
This endpoint sends a one-time password (OTP).
-
#request_otp_for_quote_verification(request_options: {}, **params) ⇒ untyped
This endpoint sends a one-time password (OTP) to the provided email and phone number for quote verification.
Constructor Details
#initialize(client:) ⇒ void
9 10 11 |
# File 'lib/yasminaai/ot_ps/client.rb', line 9 def initialize(client:) @client = client end |
Instance Method Details
#request_otp_for_issuing_policy(request_options: {}, **params) ⇒ untyped
This endpoint sends a one-time password (OTP). It should be called before issuing a policy.
57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 |
# File 'lib/yasminaai/ot_ps/client.rb', line 57 def request_otp_for_issuing_policy(request_options: {}, **params) params = Yasminaai::Internal::Types::Utils.normalize_keys(params) request = Yasminaai::Internal::JSON::Request.new( base_url: [:base_url], method: "POST", path: "issue-otp", body: Yasminaai::OtPs::Types::PostIssueOtpRequest.new(params).to_h, request_options: ) begin response = @client.send(request) rescue Net::HTTPRequestTimeout raise Yasminaai::Errors::TimeoutError end code = response.code.to_i return if code.between?(200, 299) error_class = Yasminaai::Errors::ResponseError.subclass_for_code(code) raise error_class.new(response.body, code: code) end |
#request_otp_for_quote_verification(request_options: {}, **params) ⇒ untyped
This endpoint sends a one-time password (OTP) to the provided email and phone number for quote verification. It should be called before creating a quote request.
25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 |
# File 'lib/yasminaai/ot_ps/client.rb', line 25 def request_otp_for_quote_verification(request_options: {}, **params) params = Yasminaai::Internal::Types::Utils.normalize_keys(params) request = Yasminaai::Internal::JSON::Request.new( base_url: [:base_url], method: "POST", path: "quote-otp", body: Yasminaai::OtPs::Types::PostQuoteOtpRequest.new(params).to_h, request_options: ) begin response = @client.send(request) rescue Net::HTTPRequestTimeout raise Yasminaai::Errors::TimeoutError end code = response.code.to_i return if code.between?(200, 299) error_class = Yasminaai::Errors::ResponseError.subclass_for_code(code) raise error_class.new(response.body, code: code) end |