Class: CheckoutSdk::Tokens::TokensClient

Inherits:
Client
  • Object
show all
Defined in:
lib/checkout_sdk/tokens/tokens_client.rb

Instance Attribute Summary

Attributes inherited from Client

#api_client, #authorization_type, #configuration

Instance Method Summary collapse

Constructor Details

#initialize(api_client, configuration) ⇒ TokensClient

Returns a new instance of TokensClient.

Parameters:



11
12
13
# File 'lib/checkout_sdk/tokens/tokens_client.rb', line 11

def initialize(api_client, configuration)
  super(api_client, configuration, CheckoutSdk::AuthorizationType::PUBLIC_KEY)
end

Instance Method Details

#get_token_metadata(token_id) ⇒ Object

Returns the details for an active token without consuming it. The token remains usable after this call. Requires SecretKey or OAuth (not PublicKey).

Parameters:

  • token_id (String)

    Pattern: ^(tok)_(w26)$



24
25
26
27
28
29
# File 'lib/checkout_sdk/tokens/tokens_client.rb', line 24

def (token_id)
  api_client.invoke_get(
    build_path(TOKENS, token_id, 'metadata'),
    sdk_authorization(CheckoutSdk::AuthorizationType::SECRET_KEY_OR_OAUTH)
  )
end

#request_token(token_request) ⇒ Object

Parameters:



16
17
18
# File 'lib/checkout_sdk/tokens/tokens_client.rb', line 16

def request_token(token_request)
  api_client.invoke_post(TOKENS, sdk_authorization, token_request)
end