Class: FinchAPI::Resources::AccessTokens

Inherits:
Object
  • Object
show all
Defined in:
lib/finch_api/resources/access_tokens.rb

Instance Method Summary collapse

Constructor Details

#initialize(client:) ⇒ AccessTokens

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 AccessTokens.

Parameters:



37
38
39
# File 'lib/finch_api/resources/access_tokens.rb', line 37

def initialize(client:)
  @client = client
end

Instance Method Details

#create(code: , client_id: nil, client_secret: nil, redirect_uri: nil, request_options: {}) ⇒ FinchAPI::Models::CreateAccessTokenResponse

Exchange the authorization code for an access token

Parameters:

  • code (String)

    The authorization code received from the authorization server

  • client_id (String)

    The client ID for your application

  • client_secret (String)

    The client secret for your application

  • redirect_uri (String)

    The redirect URI used in the authorization request (optional)

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

Returns:

See Also:



23
24
25
26
27
28
29
30
31
32
# File 'lib/finch_api/resources/access_tokens.rb', line 23

def create(params)
  parsed, options = FinchAPI::AccessTokenCreateParams.dump_request(params)
  @client.request(
    method: :post,
    path: "auth/token",
    body: parsed,
    model: FinchAPI::CreateAccessTokenResponse,
    options: options
  )
end