Class: LoyaltyApIs::TransactionApi
- Defined in:
- lib/loyalty_ap_is/apis/transaction_api.rb
Overview
TransactionApi
Constant Summary
Constants inherited from BaseApi
Instance Attribute Summary
Attributes inherited from BaseApi
Instance Method Summary collapse
-
#get_transactions_l(country_code, consumer_uuid, user_authorization_token, application, language_code, language: 'en', channel: PARTNER, page: nil, limit: nil, offset: nil, page_size: nil, transaction_type: nil, from_date_time: nil, to_date_time: nil, filter_by_partner_code: nil) ⇒ ApiResponse
This API is used to fetch and retrieve the list of transactions of a customer.
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_transactions_l(country_code, consumer_uuid, user_authorization_token, application, language_code, language: 'en', channel: PARTNER, page: nil, limit: nil, offset: nil, page_size: nil, transaction_type: nil, from_date_time: nil, to_date_time: nil, filter_by_partner_code: nil) ⇒ ApiResponse
This API is used to fetch and retrieve the list of transactions of a
customer.
Example cURL request:
curl --location
'https://api-test.shell.com/loyalty/v1/consumers/transactionsL?language_co
de=pl-PL'
--header 'country-code: PL'
--header 'user-authorization-token: Bearer clk6qsn0z000o1rpactbsyu93'
--header 'client-authorization-token: Bearer fmVQg8M2F2NGeI3RE18G8R8luKTk'
--header 'language: en'
--header 'application: PARTNER'
--header 'channel: PARTNER'
--header 'consumerUUID: bd68f27f-80f7-440a-b096-f65155161345'
3166-1 standard Alpha-2 code of the Country, which is the first two
characters of the country code.
or customer's unique SSO UUID.
consumer's SSO access, which you retrieved from /auth/exchangeAccessCode
endpoint prefixed by Bearer.
application.
of language in lower case as per ISO 639-1 , β-β and country code as per
ISO 3166-1 alpha-2. For example: en-GB.
639-1 2 letter code format.
be retrieved.
to be sent across all pages.
number of resources at the start of each page.
of resources to be sent in each page of the response.
is the type of the transaction. If the parameter is empty, it means that
βALLβ queries.
from which the transaction details are required.
until which the transaction details are required.
This is used to filter the transactions based on partnerCode. If true,
return the transactions related to partnerCode. If false, return all
transactions.
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 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 |
# File 'lib/loyalty_ap_is/apis/transaction_api.rb', line 59 def get_transactions_l(country_code, consumer_uuid, , application, language_code, language: 'en', channel: PARTNER, page: nil, limit: nil, offset: nil, page_size: nil, transaction_type: nil, from_date_time: nil, to_date_time: nil, filter_by_partner_code: nil) @api_call .request(new_request_builder(HttpMethodEnum::GET, '/v1/consumers/transactionsL', Server::SHELL2) .header_param(new_parameter(country_code, key: 'country-code') .is_required(true)) .header_param(new_parameter(consumer_uuid, key: 'consumerUUID') .is_required(true)) .header_param(new_parameter(, key: 'user-authorization-token') .is_required(true)) .header_param(new_parameter(application, key: 'application') .is_required(true)) .query_param(new_parameter(language_code, key: 'language_code') .is_required(true)) .header_param(new_parameter(language, key: 'language')) .header_param(new_parameter(channel, key: 'channel')) .query_param(new_parameter(page, key: 'page')) .query_param(new_parameter(limit, key: 'limit')) .query_param(new_parameter(offset, key: 'offset')) .query_param(new_parameter(page_size, key: 'pageSize')) .query_param(new_parameter(transaction_type, key: 'transactionType')) .query_param(new_parameter(from_date_time, key: 'fromDateTime')) .query_param(new_parameter(to_date_time, key: 'toDateTime')) .query_param(new_parameter(filter_by_partner_code, key: 'filterByPartnerCode')) .header_param(new_parameter('application/json', key: 'accept')) .auth(Single.new('client-authorization-token'))) .response(new_response_handler .deserializer(APIHelper.method(:custom_type_deserializer)) .deserialize_into(TransactionsResponse.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.', ErrorResponseException) .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", ErrorResponseException) .local_error('404', 'Not Found.', ResourceNotFoundErrorException) .local_error('422', "'Unprocessable Entity (WebDAV). If you are receiving an HTTP'\ ' 422 - Unprocessable Entity error, there are several'\ ' possibilities for why it might be occurring: <br><br> -You are'\ ' sending in a payload that is not valid JSON <br><br> -You are'\ ' sending HTTP headers, such as Content-Type or Accept, which'\ ' specify a value other than application/json <br><br> -The'\ ' request may be valid JSON, but there is something wrong with'\ ' the content.\n", APIException) .local_error('429', "Rate limit hit. See Retry-After header for a minimum amount of'\ ' delay, but note that there is no guarantee\nthat subsequent'\ ' request won't be limited.\n", APIException) .local_error('500', 'Internal server error.', APIException)) .execute end |