Class: LoyaltyApIs::ProfileManagementApi

Inherits:
BaseApi
  • Object
show all
Defined in:
lib/loyalty_ap_is/apis/profile_management_api.rb

Overview

ProfileManagementApi

Constant Summary

Constants inherited from BaseApi

BaseApi::GLOBAL_ERRORS

Instance Attribute Summary

Attributes inherited from BaseApi

#config, #http_call_back

Instance Method Summary collapse

Methods inherited from BaseApi

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

Constructor Details

This class inherits a constructor from LoyaltyApIs::BaseApi

Instance Method Details

#access_code(x_sso_market, authorization) ⇒ ApiResponse

This endpoint allows get the Access Code from /api/v2/auth/accessCode endpoint. Use the accessToken obtained using /api/v2/auth/exchangeAccessCode as Bearer in the Authorization header. language code (lower case) and country code (upper case), separated by a hyphen. For example: en-TH. Bearer {accessToken}. The value of accessToken is retrieved from the /auth/exchangeAccessCode endpoint.

Parameters:

  • x_sso_market (String)

    Required parameter: A combination of

  • authorization (Object)

    Required parameter: The input value is

Returns:

  • (ApiResponse)

    Complete http response with raw body and status code.



20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
# File 'lib/loyalty_ap_is/apis/profile_management_api.rb', line 20

def access_code(x_sso_market,
                authorization)
  @api_call
    .request(new_request_builder(HttpMethodEnum::POST,
                                 '/api/v2/auth/accessCode',
                                 Server::SHELL)
               .header_param(new_parameter(x_sso_market, key: 'x-sso-market')
                              .is_required(true))
               .header_param(new_parameter(authorization, key: 'Authorization')
                              .is_required(true))
               .header_param(new_parameter('application/json', key: 'accept')))
    .response(new_response_handler
                .deserializer(APIHelper.method(:custom_type_deserializer))
                .deserialize_into(AccessCodeResponse.method(:from_hash))
                .is_api_response(true)
                .local_error('401',
                             'Unauthorized',
                             APIException)
                .local_error('500',
                             'Any unexpected error',
                             JsonApiErrorException))
    .execute
end