Class: GlobusClient::Authenticator

Inherits:
Object
  • Object
show all
Defined in:
lib/globus_client/authenticator.rb

Overview

The namespace for the “login” command

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(client_id, client_secret, auth_url) ⇒ Authenticator

Returns a new instance of Authenticator.



10
11
12
13
14
# File 'lib/globus_client/authenticator.rb', line 10

def initialize(client_id, client_secret, auth_url)
  @client_id = client_id
  @client_secret = client_secret
  @auth_url = auth_url
end

Class Method Details

.token(client_id, client_secret, auth_url) ⇒ Object



6
7
8
# File 'lib/globus_client/authenticator.rb', line 6

def self.token(client_id, client_secret, auth_url)
  new(client_id, client_secret, auth_url).token
end

Instance Method Details

#tokenObject

Request an access_token



17
18
19
20
21
22
23
# File 'lib/globus_client/authenticator.rb', line 17

def token
  response = connection.post('/v2/oauth2/token', form_data)

  UnexpectedResponse.call(response) unless response.success?

  JSON.parse(response.body)['access_token']
end