Class: Increase::Resources::OAuthTokens

Inherits:
Object
  • Object
show all
Defined in:
lib/increase/resources/oauth_tokens.rb,
sig/increase/resources/oauth_tokens.rbs

Instance Method Summary collapse

Constructor Details

#initialize(client:) ⇒ OAuthTokens

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Returns a new instance of OAuthTokens.

Parameters:



49
50
51
# File 'lib/increase/resources/oauth_tokens.rb', line 49

def initialize(client:)
  @client = client
end

Instance Method Details

#create(grant_type:, client_id: nil, client_secret: nil, code: nil, production_token: nil, request_options: {}) ⇒ Increase::Models::OAuthToken

Create an OAuth Token

Parameters:

  • grant_type (Symbol, Increase::Models::OAuthTokenCreateParams::GrantType)

    The credential you request in exchange for the code. In Production, this is always authorization_code. In Sandbox, you can pass either enum value.

  • client_id (String)

    The public identifier for your application.

  • client_secret (String)

    The secret that confirms you own the application. This is redundant given that the request is made with your API key but it's a required component of OAuth 2.0.

  • code (String)

    The authorization code generated by the user and given to you as a query parameter.

  • production_token (String)

    The production token you want to exchange for a sandbox token. This is only available in Sandbox. Set grant_type to production_token to use this parameter.

  • request_options (Increase::RequestOptions, Hash{Symbol=>Object}, nil)

Returns:

See Also:



35
36
37
38
39
40
41
42
43
44
# File 'lib/increase/resources/oauth_tokens.rb', line 35

def create(params)
  parsed, options = Increase::OAuthTokenCreateParams.dump_request(params)
  @client.request(
    method: :post,
    path: "oauth/tokens",
    body: parsed,
    model: Increase::OAuthToken,
    options: options
  )
end