Class: LoyaltyApIs::BalancesApi
- Defined in:
- lib/loyalty_ap_is/apis/balances_api.rb
Overview
BalancesApi
Constant Summary
Constants inherited from BaseApi
LoyaltyApIs::BaseApi::GLOBAL_ERRORS
Instance Attribute Summary
Attributes inherited from BaseApi
Instance Method Summary collapse
-
#get_balance_by_uuid(language_code, user_authorization_token, consumer_uuid, country_code, x_correlation_id: nil, channel: nil, application: nil) ⇒ ApiResponse
Retrieve the customer's loyalty point balance of language in lower case as per ISO 639-1 , “-” and country code as per ISO 3166-1 alpha-2.
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
#get_balance_by_uuid(language_code, user_authorization_token, consumer_uuid, country_code, x_correlation_id: nil, channel: nil, application: nil) ⇒ ApiResponse
Retrieve the customer's loyalty point balance of language in lower case as per ISO 639-1 , “-” and country code as per ISO 3166-1 alpha-2. the accessToken retrieved from the /auth/exchangeAccessCode endpoint. This is referred to as user-authorization-token where the access is provided by the end user. signed in with Shell credentials Format: 32 hexadecimal digits grouped the following way: xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx 3166-1 alpha-2 country code. in GUID format in order to track the request.
28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 |
# File 'lib/loyalty_ap_is/apis/balances_api.rb', line 28 def get_balance_by_uuid(language_code, , consumer_uuid, country_code, x_correlation_id: nil, channel: nil, application: nil) @api_call .request(new_request_builder(HttpMethodEnum::GET, '/consumers/balances', Server::SHELL1) .query_param(new_parameter(language_code, key: 'language_code') .is_required(true)) .header_param(new_parameter(, key: 'user-authorization-token') .is_required(true)) .header_param(new_parameter(consumer_uuid, key: 'consumerUUID') .is_required(true)) .header_param(new_parameter(country_code, key: 'country-code') .is_required(true)) .header_param(new_parameter(x_correlation_id, key: 'x-correlation-id')) .header_param(new_parameter(channel, key: 'channel')) .header_param(new_parameter(application, key: 'application')) .header_param(new_parameter('application/json', key: 'accept')) .auth(And.new('customerHeader', 'client-authorization-token'))) .response(new_response_handler .deserializer(APIHelper.method(:custom_type_deserializer)) .deserialize_into(CustomerBalances.method(:from_hash)) .is_api_response(true) .local_error('400', 'Bad request - The request was not valid. This code is returned'\ ' when the server has attempted to process the request, but some'\ ' aspect of the request is not valid, for example an incorrectly'\ ' formatted resource or an attempt to deploy an invalid event'\ ' project to the event runtime. Information about the request is'\ ' provided in the response body, and includes an error code and'\ ' error message.', ConsumersBalances400ErrorException) .local_error('401', "Unauthorized request, Missing Authorization header, or expired'\ ' authorization token etc. It is returned from the application'\ ' server \nwhen application security is enabled, and'\ ' authorization information was missing from the request.\n", ConsumersBalances401ErrorException) .local_error('404', 'Not found - the server can not find the requested resource.', ConsumersBalances404ErrorException) .local_error('422', "Unprocessable Entity (WebDAV). If you are receiving an HTTP'\ ' 422 - Unprocessable Entity error, \nthere are several'\ ' possibilities for why it might be occurring-<br>\n - You are'\ ' sending in a payload that is not valid JSON. <br> \n - You are'\ ' sending HTTP headers, such as Content-Type or Accept, which'\ ' specify a value other than application/json. <br>\n - The'\ ' request may be valid JSON, but there is something wrong with'\ ' the content. \n", ConsumersBalances422ErrorException) .local_error('429', 'Rate limit hit. See the Retry-After header to specify a delay,'\ ' but note that there is no guarantee that subsequent requests'\ ' won\'t be limited.', APIException) .local_error('500', 'Internal error - the server encountered an unexpected'\ ' condition that prevented it from fulfilling the request.', APIException)) .execute end |