class Base::Endpoints::Sessions

This endpoint contains a method for authenticating a user.

Public Class Methods

new(access_token:, url:) click to toggle source

Initializes this endpoint.

Calls superclass method Base::Endpoint::new
# File lib/base/endpoints/sessions.rb, line 8
def initialize(access_token:, url:)
  @path = 'sessions'
  super
end

Public Instance Methods

authenticate(email:, password:) click to toggle source

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.

# 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