Class: School21::AuthApi

Inherits:
BaseApi show all
Defined in:
lib/school21/api/auth_api.rb

Constant Summary

Constants inherited from BaseApi

BaseApi::SINGLE_AUTH_PARTICIPANT

Instance Method Summary collapse

Methods inherited from BaseApi

#authenticated_request, base_uri, #execute_request, #initialize, #new_api_call_builder, #new_parameter, #new_request_builder, #new_response_handler, response_convertor

Constructor Details

This class inherits a constructor from School21::BaseApi

Instance Method Details

#token(login:, password:) ⇒ Object



5
6
7
8
9
10
11
12
13
# File 'lib/school21/api/auth_api.rb', line 5

def token(login:, password:)
  new_request = new_request_builder(HttpMethod::POST, '/token', :auth)
                .form_param(new_parameter(, key: :username))
                .form_param(new_parameter(password, key: :password))
                .form_param(new_parameter('password', key: :grant_type))
                .form_param(new_parameter('s21-open-api', key: :client_id))

  execute_request(new_request)
end