Class: Fakturoid::Oauth::Flow::ClientCredentials

Inherits:
Object
  • Object
show all
Includes:
Base
Defined in:
lib/fakturoid/oauth/flow/client_credentials.rb

Constant Summary collapse

GRANT_TYPE =
"client_credentials"

Instance Attribute Summary

Attributes included from Base

#client

Instance Method Summary collapse

Methods included from Base

#authorization_uri, #authorize, #initialize, #revoke_access

Instance Method Details

#authorized?Boolean

Returns:

  • (Boolean)


21
22
23
# File 'lib/fakturoid/oauth/flow/client_credentials.rb', line 21

def authorized?
  true
end

#fetch_access_tokenObject



11
12
13
14
15
16
17
18
19
# File 'lib/fakturoid/oauth/flow/client_credentials.rb', line 11

def fetch_access_token
  payload = {
    grant_type: GRANT_TYPE
  }

  response = perform_request(HTTP_POST, "token.json", payload: payload)
  client.config.credentials.update(response.body)
  response
end