Module: GogoKit::Client::OAuth

Includes:
Utils
Included in:
GogoKit::Client
Defined in:
lib/gogokit/client/oauth.rb

Overview

OAuth authentication methods for GogoKit::Client

Instance Method Summary collapse

Methods included from Utils

#object_from_response

Instance Method Details

#get_access_token(grant_type, options = {}) ⇒ GogoKit::OAuthToken

Get an OAuth access token

Parameters:

  • grant_type (String)

    The grant type to use to get the token

  • options (Hash) (defaults to: {})

    Token request information

Returns:

See Also:



17
18
19
20
21
22
23
24
# File 'lib/gogokit/client/oauth.rb', line 17

def get_access_token(grant_type, options = {})
  object_from_response(GogoKit::OAuthToken,
                       GogoKit::OAuthTokenRepresenter,
                       :post,
                       oauth_token_endpoint,
                       body: token_request_body(grant_type, options),
                       headers: token_request_headers)
end

#get_client_access_token(options = {}) ⇒ GogoKit::OAuthToken

Get an OAuth access token for an application.

viagogo.github.io/developer.viagogo.net/#client-credentials-grant

Parameters:

  • options (Hash) (defaults to: {})

    Token request information

Returns:

See Also:



32
33
34
# File 'lib/gogokit/client/oauth.rb', line 32

def get_client_access_token(options = {})
  get_access_token('client_credentials', options)
end