Class: Base::Endpoints::Sessions
- Inherits:
-
Base::Endpoint
- Object
- Base::Endpoint
- Base::Endpoints::Sessions
- Defined in:
- lib/base/endpoints/sessions.rb
Overview
This endpoint contains a method for authenticating a user.
Instance Attribute Summary
Attributes inherited from Base::Endpoint
Instance Method Summary collapse
-
#authenticate(email:, password:) ⇒ Object
Tries to authenticate (log in) the user with email and password.
-
#initialize(access_token:, url:) ⇒ Sessions
constructor
Initializes this endpoint.
Methods inherited from Base::Endpoint
Constructor Details
#initialize(access_token:, url:) ⇒ Sessions
Initializes this endpoint.
8 9 10 11 |
# File 'lib/base/endpoints/sessions.rb', line 8 def initialize(access_token:, url:) @path = 'sessions' super end |
Instance Method Details
#authenticate(email:, password:) ⇒ Object
Tries to authenticate (log in) the user with email and password.
For security reasons if the email address is not registered or the password is incorrect, “INVALID_CREDENTIALS” error will be returned.
17 18 19 20 21 22 23 24 25 26 |
# File 'lib/base/endpoints/sessions.rb', line 17 def authenticate(email:, password:) request do response = connection.post('', 'password' => password, 'email' => email) parse(response.body) end end |