Class: NewStoreApi::TokenOperationsController

Inherits:
BaseController show all
Defined in:
lib/new_store_api/controllers/token_operations_controller.rb

Overview

TokenOperationsController

Constant Summary

Constants inherited from BaseController

BaseController::GLOBAL_ERRORS

Instance Attribute Summary

Attributes inherited from BaseController

#config, #http_call_back

Instance Method Summary collapse

Methods inherited from BaseController

#initialize, #new_parameter, #new_request_builder, #new_response_handler, user_agent

Constructor Details

This class inherits a constructor from NewStoreApi::BaseController

Instance Method Details

#create_tokens_operations(body, operation: Operation1Enum::TOKENIZE) ⇒ TokensResponse

🚧 BETA: This endpoint is in beta and may change.
See API Lifecycle Documentation for details.
There are two possible operations: - **tokenize** - Tokenizes PII data that is not related to a profile, tokens are only valid for 30 days. - **detokenize** - Detokenizes a list of tokens for profiles, addresses, or data entries. payload containing the data to tokenize or detokenize that will be performed. By default it's **tokenize**.

Parameters:

  • body (TokensRequest)

    Required parameter: Token operation request

  • operation (Operation1Enum) (defaults to: Operation1Enum::TOKENIZE)

    Optional parameter: The token operation

Returns:



29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
# File 'lib/new_store_api/controllers/token_operations_controller.rb', line 29

def create_tokens_operations(body,
                             operation: Operation1Enum::TOKENIZE)
  @api_call
    .request(new_request_builder(HttpMethodEnum::POST,
                                 '/customer/tokens',
                                 Server::API)
               .header_param(new_parameter('application/json', key: 'Content-Type'))
               .body_param(new_parameter(body))
               .query_param(new_parameter(operation, key: 'operation'))
               .header_param(new_parameter('application/json', key: 'accept'))
               .body_serializer(proc do |param| param.to_json unless param.nil? end)
               .auth(Single.new('oauth')))
    .response(new_response_handler
                .deserializer(APIHelper.method(:custom_type_deserializer))
                .deserialize_into(TokensResponse.method(:from_hash)))
    .execute
end