Class: Base::Endpoints::Passwords
- Inherits:
-
Base::Endpoint
- Object
- Base::Endpoint
- Base::Endpoints::Passwords
- Defined in:
- lib/base/endpoints/passwords.rb
Overview
This endpoint contains methods for handling the forgot password flow.
Instance Attribute Summary
Attributes inherited from Base::Endpoint
Instance Method Summary collapse
-
#forgot_password(email:) ⇒ Object
Generates a forgot password token for the user with the given email.
-
#initialize(access_token:, url:) ⇒ Passwords
constructor
Initializes this endpoint.
-
#set_password(forgot_password_token:, confirmation:, password:) ⇒ Object
Sets the password of a user with the given forgot password token.
Methods inherited from Base::Endpoint
Constructor Details
#initialize(access_token:, url:) ⇒ Passwords
Initializes this endpoint.
8 9 10 11 |
# File 'lib/base/endpoints/passwords.rb', line 8 def initialize(access_token:, url:) @path = 'password' super end |
Instance Method Details
#forgot_password(email:) ⇒ Object
Generates a forgot password token for the user with the given email.
14 15 16 17 18 19 20 21 22 |
# File 'lib/base/endpoints/passwords.rb', line 14 def forgot_password(email:) request do response = connection.post('', 'email' => email) parse(response.body) end end |
#set_password(forgot_password_token:, confirmation:, password:) ⇒ Object
Sets the password of a user with the given forgot password token.
25 26 27 28 29 30 31 32 33 34 35 36 37 |
# File 'lib/base/endpoints/passwords.rb', line 25 def set_password(forgot_password_token:, confirmation:, password:) request do response = connection.put('', 'forgot_password_token' => forgot_password_token, 'confirmation' => confirmation, 'password' => password) parse(response.body) end end |