Class: Posthubify::OtpResource
- Inherits:
-
Object
- Object
- Posthubify::OtpResource
- Defined in:
- lib/posthubify/resources/telecom.rb
Overview
OTP generation + verification (Node sdk .otp).
Instance Method Summary collapse
-
#initialize(http) ⇒ OtpResource
constructor
A new instance of OtpResource.
-
#send(input, idempotency_key: nil) ⇒ Object
Generate an OTP code + send it via SMS ({ ‘senderId’ => …, ‘to’ => …, ‘appName’ => …, ‘locale’ => … }); the code is not returned in the response.
-
#verify(input) ⇒ Object
Verify the code the user entered ({ ‘senderId’ => …, ‘to’ => …, ‘code’ => … }).
Constructor Details
#initialize(http) ⇒ OtpResource
Returns a new instance of OtpResource.
72 73 74 |
# File 'lib/posthubify/resources/telecom.rb', line 72 def initialize(http) @http = http end |
Instance Method Details
#send(input, idempotency_key: nil) ⇒ Object
Generate an OTP code + send it via SMS ({ ‘senderId’ => …, ‘to’ => …, ‘appName’ => …, ‘locale’ => … }); the code is not returned in the response.
77 78 79 |
# File 'lib/posthubify/resources/telecom.rb', line 77 def send(input, idempotency_key: nil) @http.data('POST', '/otp/send', body: input, idempotency_key: idempotency_key) end |
#verify(input) ⇒ Object
Verify the code the user entered ({ ‘senderId’ => …, ‘to’ => …, ‘code’ => … }).
82 83 84 |
# File 'lib/posthubify/resources/telecom.rb', line 82 def verify(input) @http.data('POST', '/otp/verify', body: input) end |