Class: SdrClient::RedesignedClient::Authenticator
- Inherits:
-
Object
- Object
- SdrClient::RedesignedClient::Authenticator
- Defined in:
- lib/sdr_client/redesigned_client/authenticator.rb
Overview
Fetch a token from the SDR API using user credentials
Class Method Summary collapse
Instance Method Summary collapse
-
#token ⇒ Object
Request an access_token.
Class Method Details
.token ⇒ Object
7 8 9 |
# File 'lib/sdr_client/redesigned_client/authenticator.rb', line 7 def self.token new.token end |
Instance Method Details
#token ⇒ Object
Request an access_token
12 13 14 15 16 17 18 |
# File 'lib/sdr_client/redesigned_client/authenticator.rb', line 12 def token response = connection.post(path, request_body, content_type: 'application/json') UnexpectedResponse.call(response) unless response.success? JSON.parse(response.body)['token'] end |