loyalty-sdk 0.0.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (104) hide show
  1. checksums.yaml +7 -0
  2. data/LICENSE +28 -0
  3. data/README.md +187 -0
  4. data/bin/console +15 -0
  5. data/lib/loyalty_ap_is/api_helper.rb +10 -0
  6. data/lib/loyalty_ap_is/apis/authorization_api.rb +116 -0
  7. data/lib/loyalty_ap_is/apis/balances_api.rb +96 -0
  8. data/lib/loyalty_ap_is/apis/base_api.rb +67 -0
  9. data/lib/loyalty_ap_is/apis/oauth_authorization_api.rb +44 -0
  10. data/lib/loyalty_ap_is/apis/offer_api.rb +164 -0
  11. data/lib/loyalty_ap_is/apis/profile_management_api.rb +44 -0
  12. data/lib/loyalty_ap_is/apis/redemption_api.rb +107 -0
  13. data/lib/loyalty_ap_is/apis/transaction_api.rb +143 -0
  14. data/lib/loyalty_ap_is/client.rb +137 -0
  15. data/lib/loyalty_ap_is/configuration.rb +238 -0
  16. data/lib/loyalty_ap_is/exceptions/api_exception.rb +21 -0
  17. data/lib/loyalty_ap_is/exceptions/common_error_exception.rb +98 -0
  18. data/lib/loyalty_ap_is/exceptions/consumers_balances400_error_exception.rb +57 -0
  19. data/lib/loyalty_ap_is/exceptions/consumers_balances401_error_exception.rb +57 -0
  20. data/lib/loyalty_ap_is/exceptions/consumers_balances404_error_exception.rb +57 -0
  21. data/lib/loyalty_ap_is/exceptions/consumers_balances422_error_exception.rb +57 -0
  22. data/lib/loyalty_ap_is/exceptions/error_response_exception.rb +57 -0
  23. data/lib/loyalty_ap_is/exceptions/json_api_error_exception.rb +60 -0
  24. data/lib/loyalty_ap_is/exceptions/oauth_provider_exception.rb +64 -0
  25. data/lib/loyalty_ap_is/exceptions/resource_not_found_error_exception.rb +57 -0
  26. data/lib/loyalty_ap_is/http/api_response.rb +19 -0
  27. data/lib/loyalty_ap_is/http/auth/client_authorization_token.rb +148 -0
  28. data/lib/loyalty_ap_is/http/auth/customer_header.rb +52 -0
  29. data/lib/loyalty_ap_is/http/auth/private_basic_token.rb +52 -0
  30. data/lib/loyalty_ap_is/http/auth/public_basic_token.rb +52 -0
  31. data/lib/loyalty_ap_is/http/auth/public_bearer_token.rb +53 -0
  32. data/lib/loyalty_ap_is/http/http_call_back.rb +10 -0
  33. data/lib/loyalty_ap_is/http/http_method_enum.rb +10 -0
  34. data/lib/loyalty_ap_is/http/http_request.rb +10 -0
  35. data/lib/loyalty_ap_is/http/http_response.rb +10 -0
  36. data/lib/loyalty_ap_is/http/proxy_settings.rb +22 -0
  37. data/lib/loyalty_ap_is/logging/configuration/api_logging_configuration.rb +186 -0
  38. data/lib/loyalty_ap_is/logging/sdk_logger.rb +17 -0
  39. data/lib/loyalty_ap_is/models/access_code_response.rb +87 -0
  40. data/lib/loyalty_ap_is/models/assign_offer_channel.rb +26 -0
  41. data/lib/loyalty_ap_is/models/auth_token_request.rb +75 -0
  42. data/lib/loyalty_ap_is/models/auth_token_response.rb +106 -0
  43. data/lib/loyalty_ap_is/models/bad_request_error.rb +63 -0
  44. data/lib/loyalty_ap_is/models/balance_amount.rb +84 -0
  45. data/lib/loyalty_ap_is/models/balance_amount_detail.rb +141 -0
  46. data/lib/loyalty_ap_is/models/balance_currency_amount.rb +93 -0
  47. data/lib/loyalty_ap_is/models/balance_currency_type.rb +60 -0
  48. data/lib/loyalty_ap_is/models/balance_state.rb +72 -0
  49. data/lib/loyalty_ap_is/models/base_model.rb +110 -0
  50. data/lib/loyalty_ap_is/models/client_auth_token_request.rb +78 -0
  51. data/lib/loyalty_ap_is/models/currency_data.rb +101 -0
  52. data/lib/loyalty_ap_is/models/customer_balances.rb +84 -0
  53. data/lib/loyalty_ap_is/models/error_base_container.rb +82 -0
  54. data/lib/loyalty_ap_is/models/error_info.rb +84 -0
  55. data/lib/loyalty_ap_is/models/error_item.rb +105 -0
  56. data/lib/loyalty_ap_is/models/error_presenter.rb +150 -0
  57. data/lib/loyalty_ap_is/models/error_source.rb +75 -0
  58. data/lib/loyalty_ap_is/models/ev_charging_details.rb +151 -0
  59. data/lib/loyalty_ap_is/models/exchange_access_code_request.rb +77 -0
  60. data/lib/loyalty_ap_is/models/fault.rb +85 -0
  61. data/lib/loyalty_ap_is/models/fault_detail.rb +76 -0
  62. data/lib/loyalty_ap_is/models/json_api_version.rb +75 -0
  63. data/lib/loyalty_ap_is/models/loyalty_card_info.rb +76 -0
  64. data/lib/loyalty_ap_is/models/m200_user_partners.rb +109 -0
  65. data/lib/loyalty_ap_is/models/method_not_allowed_error.rb +62 -0
  66. data/lib/loyalty_ap_is/models/not_found_error.rb +62 -0
  67. data/lib/loyalty_ap_is/models/not_found_error_response.rb +90 -0
  68. data/lib/loyalty_ap_is/models/oauth_provider_error.rb +62 -0
  69. data/lib/loyalty_ap_is/models/oauth_token.rb +96 -0
  70. data/lib/loyalty_ap_is/models/offer.rb +155 -0
  71. data/lib/loyalty_ap_is/models/offer_assignment.rb +172 -0
  72. data/lib/loyalty_ap_is/models/offer_base.rb +101 -0
  73. data/lib/loyalty_ap_is/models/offer_info.rb +156 -0
  74. data/lib/loyalty_ap_is/models/offer_language.rb +100 -0
  75. data/lib/loyalty_ap_is/models/points_to_cash.rb +99 -0
  76. data/lib/loyalty_ap_is/models/product_type.rb +53 -0
  77. data/lib/loyalty_ap_is/models/redeemed_item.rb +221 -0
  78. data/lib/loyalty_ap_is/models/redeemed_item_product.rb +131 -0
  79. data/lib/loyalty_ap_is/models/redemption_item.rb +109 -0
  80. data/lib/loyalty_ap_is/models/redemption_request.rb +107 -0
  81. data/lib/loyalty_ap_is/models/redemption_response.rb +118 -0
  82. data/lib/loyalty_ap_is/models/redemption_response_item.rb +111 -0
  83. data/lib/loyalty_ap_is/models/refresh_token_request.rb +75 -0
  84. data/lib/loyalty_ap_is/models/refresh_token_response.rb +93 -0
  85. data/lib/loyalty_ap_is/models/sale_item.rb +262 -0
  86. data/lib/loyalty_ap_is/models/sale_item_product.rb +135 -0
  87. data/lib/loyalty_ap_is/models/site_data.rb +121 -0
  88. data/lib/loyalty_ap_is/models/transaction.rb +351 -0
  89. data/lib/loyalty_ap_is/models/transaction_balance.rb +91 -0
  90. data/lib/loyalty_ap_is/models/transaction_balance_amount.rb +82 -0
  91. data/lib/loyalty_ap_is/models/transaction_balance_state.rb +64 -0
  92. data/lib/loyalty_ap_is/models/transaction_currency_type.rb +56 -0
  93. data/lib/loyalty_ap_is/models/transaction_detail_type.rb +53 -0
  94. data/lib/loyalty_ap_is/models/transaction_type_filter.rb +40 -0
  95. data/lib/loyalty_ap_is/models/transaction_voucher.rb +109 -0
  96. data/lib/loyalty_ap_is/models/transactions_response.rb +118 -0
  97. data/lib/loyalty_ap_is/models/unauthorized_error.rb +62 -0
  98. data/lib/loyalty_ap_is/models/unit_measure.rb +40 -0
  99. data/lib/loyalty_ap_is/models/unprocessable_entity_error_response.rb +90 -0
  100. data/lib/loyalty_ap_is/models/voucher_item.rb +99 -0
  101. data/lib/loyalty_ap_is/utilities/date_time_helper.rb +11 -0
  102. data/lib/loyalty_ap_is/utilities/file_wrapper.rb +28 -0
  103. data/lib/loyalty_ap_is.rb +128 -0
  104. metadata +189 -0
@@ -0,0 +1,164 @@
1
+ # loyalty_ap_is
2
+ #
3
+ # This file was automatically generated by APIMATIC v3.0 (
4
+ # https://www.apimatic.io ).
5
+
6
+ module LoyaltyApIs
7
+ # OfferApi
8
+ class OfferApi < BaseApi
9
+ # Assigning a partner based offer to a customer by the partner
10
+ # @param [String] language_code Required parameter: This is a concatenation
11
+ # of language in lower case as per ISO 639-1 , “-” and country code as per
12
+ # ISO 3166-1 alpha-2.
13
+ # @param [String] user_authorization_token Required parameter: The value of
14
+ # the `accessToken` retrieved from the `/auth/exchangeAccessCode` endpoint.
15
+ # This is referred to as user-authorization-token where the access is
16
+ # provided by the end user.
17
+ # @param [String] country_code Required parameter: Two character ISO 3166-1
18
+ # alpha-2 country code.
19
+ # @param [String] x_correlation_id Optional parameter: An unique ID in GUID
20
+ # format in order to track the request.
21
+ # @param [AssignOfferChannel] channel Optional parameter: Channel.
22
+ # @param [String] application Optional parameter: String
23
+ # @param [OfferAssignment] body Optional parameter: assign offer to
24
+ # customer
25
+ # @return [ApiResponse] Complete http response with raw body and status code.
26
+ def assign_partner_offer(language_code,
27
+ user_authorization_token,
28
+ country_code,
29
+ x_correlation_id: nil,
30
+ channel: nil,
31
+ application: nil,
32
+ body: nil)
33
+ @api_call
34
+ .request(new_request_builder(HttpMethodEnum::POST,
35
+ '/consumers/offers',
36
+ Server::SHELL1)
37
+ .query_param(new_parameter(language_code, key: 'language_code')
38
+ .is_required(true))
39
+ .header_param(new_parameter(user_authorization_token, key: 'user-authorization-token')
40
+ .is_required(true))
41
+ .header_param(new_parameter(country_code, key: 'country-code')
42
+ .is_required(true))
43
+ .header_param(new_parameter('application/json', key: 'Content-Type'))
44
+ .header_param(new_parameter(x_correlation_id, key: 'x-correlation-id'))
45
+ .header_param(new_parameter(channel, key: 'channel'))
46
+ .header_param(new_parameter(application, key: 'application'))
47
+ .body_param(new_parameter(body))
48
+ .header_param(new_parameter('application/json', key: 'accept'))
49
+ .body_serializer(proc do |param| param.to_json unless param.nil? end)
50
+ .auth(Single.new('client-authorization-token')))
51
+ .response(new_response_handler
52
+ .deserializer(APIHelper.method(:custom_type_deserializer))
53
+ .deserialize_into(Offer.method(:from_hash))
54
+ .is_api_response(true)
55
+ .local_error('400',
56
+ 'Bad request as certain mandatory parameters were not provided'\
57
+ ' by the client in the request.',
58
+ CommonErrorException)
59
+ .local_error('401',
60
+ 'Unauthorized request, Missing Authorization header, or expired'\
61
+ ' authorization token.',
62
+ CommonErrorException)
63
+ .local_error('404',
64
+ 'Offer/Customer does not exist.',
65
+ CommonErrorException)
66
+ .local_error('422',
67
+ 'All offer assignment based error what it caused by the'\
68
+ ' "Offer"',
69
+ CommonErrorException)
70
+ .local_error('429',
71
+ "Rate limit hit. See Retry-After header for a minimum amount of'\
72
+ ' delay, but note that there is no guarantee\nthat subsequent'\
73
+ ' request won't be limited.\n",
74
+ APIException)
75
+ .local_error('500',
76
+ 'Internal server error',
77
+ APIException))
78
+ .execute
79
+ end
80
+
81
+ # Revoking a partner based offer from customer by Partner.
82
+ # @param [String] language_code Required parameter: This is a concatenation
83
+ # of language in lower case as per ISO 639-1 , “-” and country code as per
84
+ # ISO 3166-1 alpha-2.
85
+ # @param [String] user_authorization_token Required parameter: The value of
86
+ # the `accessToken` retrieved from the `/auth/exchangeAccessCode` endpoint.
87
+ # This is referred to as user-authorization-token where the access is
88
+ # provided by the end user.
89
+ # @param [String] client_authorization_token Required parameter: The value
90
+ # of the `accessToken` retrieved from the `/oauth/token` endpoint. This is
91
+ # client authorization between Shell and Partner system.
92
+ # @param [String] country_code Required parameter: Two character ISO 3166-1
93
+ # alpha-2 country code.
94
+ # @param [UUID | String] consumer_uuid Required parameter: SSO uuid of the
95
+ # user signed in with Shell credentials.
96
+ # @param [UUID | String] partner_reference_id Required parameter: Unique
97
+ # Reference ID for the transaction which was used when assigning the offer
98
+ # from the partner in Assign Offer API
99
+ # @param [String] x_correlation_id Optional parameter: An unique ID in GUID
100
+ # format in order to track the request.
101
+ # @param [AssignOfferChannel] channel Optional parameter: Channel.
102
+ # @param [String] application Optional parameter: String
103
+ # @return [ApiResponse] Complete http response with raw body and status code.
104
+ def revoke_partner_offer(language_code,
105
+ user_authorization_token,
106
+ client_authorization_token,
107
+ country_code,
108
+ consumer_uuid,
109
+ partner_reference_id,
110
+ x_correlation_id: nil,
111
+ channel: nil,
112
+ application: nil)
113
+ @api_call
114
+ .request(new_request_builder(HttpMethodEnum::DELETE,
115
+ '/consumers/offers',
116
+ Server::SHELL1)
117
+ .query_param(new_parameter(language_code, key: 'language_code')
118
+ .is_required(true))
119
+ .header_param(new_parameter(user_authorization_token, key: 'user-authorization-token')
120
+ .is_required(true))
121
+ .header_param(new_parameter(client_authorization_token, key: 'client-authorization-token')
122
+ .is_required(true))
123
+ .header_param(new_parameter(country_code, key: 'country-code')
124
+ .is_required(true))
125
+ .header_param(new_parameter(consumer_uuid, key: 'consumerUUID')
126
+ .is_required(true))
127
+ .header_param(new_parameter(partner_reference_id, key: 'partnerReferenceId')
128
+ .is_required(true))
129
+ .header_param(new_parameter(x_correlation_id, key: 'x-correlation-id'))
130
+ .header_param(new_parameter(channel, key: 'channel'))
131
+ .header_param(new_parameter(application, key: 'application'))
132
+ .header_param(new_parameter('application/json', key: 'accept'))
133
+ .auth(Single.new('client-authorization-token')))
134
+ .response(new_response_handler
135
+ .deserializer(APIHelper.method(:custom_type_deserializer))
136
+ .deserialize_into(Offer.method(:from_hash))
137
+ .is_api_response(true)
138
+ .local_error('400',
139
+ 'Bad request as certain mandatory parameters were not provided'\
140
+ ' by the client in the request.',
141
+ CommonErrorException)
142
+ .local_error('401',
143
+ 'Unauthorized request, Missing Authorization header, or expired'\
144
+ ' authorization token.',
145
+ CommonErrorException)
146
+ .local_error('404',
147
+ 'Offer/Customer does not exist.',
148
+ CommonErrorException)
149
+ .local_error('422',
150
+ 'All offer assignment based error what it caused by the'\
151
+ ' "Offer"',
152
+ CommonErrorException)
153
+ .local_error('429',
154
+ "Rate limit hit. See Retry-After header for a minimum amount of'\
155
+ ' delay, but note that there is no guarantee\nthat subsequent'\
156
+ ' request won't be limited.\n",
157
+ APIException)
158
+ .local_error('500',
159
+ 'Internal server error',
160
+ APIException))
161
+ .execute
162
+ end
163
+ end
164
+ end
@@ -0,0 +1,44 @@
1
+ # loyalty_ap_is
2
+ #
3
+ # This file was automatically generated by APIMATIC v3.0 (
4
+ # https://www.apimatic.io ).
5
+
6
+ module LoyaltyApIs
7
+ # ProfileManagementApi
8
+ class ProfileManagementApi < BaseApi
9
+ # This endpoint allows get the Access Code from */api/v2/auth/accessCode*
10
+ # endpoint. Use the *accessToken* obtained using
11
+ # */api/v2/auth/exchangeAccessCode* as Bearer in the Authorization header.
12
+ # @param [String] x_sso_market Required parameter: A combination of
13
+ # [language code](https://www.iso.org/standard/22109.html) (lower case) and
14
+ # [country code](https://www.iso.org/iso-3166-country-codes.html) (upper
15
+ # case), separated by a hyphen. For example: **en-TH**.
16
+ # @param [Object] authorization Required parameter: The input value is
17
+ # **Bearer {{accessToken}}**. The value of *accessToken* is retrieved from
18
+ # the */auth/exchangeAccessCode* endpoint.
19
+ # @return [ApiResponse] Complete http response with raw body and status code.
20
+ def access_code(x_sso_market,
21
+ authorization)
22
+ @api_call
23
+ .request(new_request_builder(HttpMethodEnum::POST,
24
+ '/api/v2/auth/accessCode',
25
+ Server::SHELL)
26
+ .header_param(new_parameter(x_sso_market, key: 'x-sso-market')
27
+ .is_required(true))
28
+ .header_param(new_parameter(authorization, key: 'Authorization')
29
+ .is_required(true))
30
+ .header_param(new_parameter('application/json', key: 'accept')))
31
+ .response(new_response_handler
32
+ .deserializer(APIHelper.method(:custom_type_deserializer))
33
+ .deserialize_into(AccessCodeResponse.method(:from_hash))
34
+ .is_api_response(true)
35
+ .local_error('401',
36
+ 'Unauthorized',
37
+ APIException)
38
+ .local_error('500',
39
+ 'Any unexpected error',
40
+ JsonApiErrorException))
41
+ .execute
42
+ end
43
+ end
44
+ end
@@ -0,0 +1,107 @@
1
+ # loyalty_ap_is
2
+ #
3
+ # This file was automatically generated by APIMATIC v3.0 (
4
+ # https://www.apimatic.io ).
5
+
6
+ module LoyaltyApIs
7
+ # RedemptionApi
8
+ class RedemptionApi < BaseApi
9
+ # Point redemption API for customers to redeem loyalty points via the
10
+ # partner channel
11
+ # @param [String] language_code Required parameter: A combination of
12
+ # [language code](https://www.iso.org/standard/22109.html) (lower case) and
13
+ # [country code](https://www.iso.org/iso-3166-country-codes.html) (upper
14
+ # case), separated by a hyphen.
15
+ # @param [String] user_authorization_token Required parameter: The value of
16
+ # the accessToken retrieved from the /auth/exchangeAccessCode endpoint. This
17
+ # is referred to as user-authorization-token where the access is provided by
18
+ # the end user.
19
+ # @param [String] consumer_uuid Required parameter: SSO uuid of the user
20
+ # signed in with Shell credentials Format: 32 hexadecimal digits grouped the
21
+ # following way: xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx
22
+ # @param [String] country_code Required parameter: The two character ISO
23
+ # 3166-1 alpha-2 [country
24
+ # code](https://www.iso.org/iso-3166-country-codes.html).
25
+ # @param [UUID | String] x_correlation_id Optional parameter: An unique ID
26
+ # in GUID format in order to track the request.
27
+ # @param [AssignOfferChannel] channel Optional parameter: Channel.
28
+ # @param [String] application Optional parameter: String
29
+ # @param [Integer] retry_after Optional parameter: Retry the operation after
30
+ # a specified number of seconds have elapsed.
31
+ # @param [RedemptionRequest] body Optional parameter: Redeem a customer's
32
+ # loyalty points
33
+ # @return [ApiResponse] Complete http response with raw body and status code.
34
+ def point_redemption(language_code,
35
+ user_authorization_token,
36
+ consumer_uuid,
37
+ country_code,
38
+ x_correlation_id: nil,
39
+ channel: nil,
40
+ application: nil,
41
+ retry_after: nil,
42
+ body: nil)
43
+ @api_call
44
+ .request(new_request_builder(HttpMethodEnum::POST,
45
+ '/consumers/redemption',
46
+ Server::SHELL1)
47
+ .query_param(new_parameter(language_code, key: 'language_code')
48
+ .is_required(true))
49
+ .header_param(new_parameter(user_authorization_token, key: 'user-authorization-token')
50
+ .is_required(true))
51
+ .header_param(new_parameter(consumer_uuid, key: 'consumerUUID')
52
+ .is_required(true))
53
+ .header_param(new_parameter(country_code, key: 'country-code')
54
+ .is_required(true))
55
+ .header_param(new_parameter('application/json', key: 'Content-Type'))
56
+ .header_param(new_parameter(x_correlation_id, key: 'x-correlation-id'))
57
+ .header_param(new_parameter(channel, key: 'channel'))
58
+ .header_param(new_parameter(application, key: 'application'))
59
+ .header_param(new_parameter(retry_after, key: 'Retry-After'))
60
+ .body_param(new_parameter(body))
61
+ .header_param(new_parameter('application/json', key: 'accept'))
62
+ .body_serializer(proc do |param| param.to_json unless param.nil? end)
63
+ .auth(Single.new('client-authorization-token')))
64
+ .response(new_response_handler
65
+ .deserializer(APIHelper.method(:custom_type_deserializer))
66
+ .deserialize_into(RedemptionResponse.method(:from_hash))
67
+ .is_api_response(true)
68
+ .local_error('400',
69
+ 'Bad request - The request was not valid. This code is returned'\
70
+ ' when the server has attempted to process the request, but some'\
71
+ ' aspect of the request is not valid, for example an incorrectly'\
72
+ ' formatted resource or an attempt to deploy an invalid event'\
73
+ ' project to the event runtime. Information about the request is'\
74
+ ' provided in the response body, and includes an error code and'\
75
+ ' error message.',
76
+ ConsumersBalances400ErrorException)
77
+ .local_error('401',
78
+ "Unauthorized request, Missing Authorization header, or expired'\
79
+ ' authorization token etc. It is returned from the application'\
80
+ ' server \nwhen application security is enabled, and'\
81
+ ' authorization information was missing from the request.\n",
82
+ ConsumersBalances400ErrorException)
83
+ .local_error('404',
84
+ 'Not found - the server can not find the requested resource.',
85
+ ConsumersBalances400ErrorException)
86
+ .local_error('422',
87
+ "Unprocessable Entity (WebDAV). If you are receiving an HTTP'\
88
+ ' 422 - Unprocessable Entity error, \nthere are several'\
89
+ ' possibilities for why it might be occurring-<br>\n - You are'\
90
+ ' sending in a payload that is not valid JSON. <br> \n - You are'\
91
+ ' sending HTTP headers, such as Content-Type or Accept, which'\
92
+ ' specify a value other than application/json. <br>\n - The'\
93
+ ' request may be valid JSON, but there is something wrong with'\
94
+ ' the content. \n",
95
+ ConsumersBalances400ErrorException)
96
+ .local_error('429',
97
+ 'Rate limit hit. See the Retry-After header to specify a delay,'\
98
+ ' but note that there is no guarantee that subsequent requests'\
99
+ ' won\'t be limited.',
100
+ APIException)
101
+ .local_error('500',
102
+ 'Internal server error',
103
+ APIException))
104
+ .execute
105
+ end
106
+ end
107
+ end
@@ -0,0 +1,143 @@
1
+ # loyalty_ap_is
2
+ #
3
+ # This file was automatically generated by APIMATIC v3.0 (
4
+ # https://www.apimatic.io ).
5
+
6
+ module LoyaltyApIs
7
+ # TransactionApi
8
+ class TransactionApi < BaseApi
9
+ # This API is used to fetch and retrieve the list of transactions of a
10
+ # customer.
11
+ # Example cURL request:
12
+ # curl --location
13
+ # 'https://api-test.shell.com/loyalty/v1/consumers/transactionsL?language_co
14
+ # de=pl-PL' \
15
+ # --header 'country-code: PL' \
16
+ # --header 'user-authorization-token: Bearer clk6qsn0z000o1rpactbsyu93' \
17
+ # --header 'client-authorization-token: Bearer fmVQg8M2F2NGeI3RE18G8R8luKTk'
18
+ # \
19
+ # --header 'language: en' \
20
+ # --header 'application: PARTNER' \
21
+ # --header 'channel: PARTNER' \
22
+ # --header 'consumerUUID: bd68f27f-80f7-440a-b096-f65155161345'
23
+ # @param [String] country_code Required parameter: This represents the ISO
24
+ # 3166-1 standard Alpha-2 code of the Country, which is the first two
25
+ # characters of the country code.
26
+ # @param [String] consumer_uuid Required parameter: This is the consumer's
27
+ # or customer's unique SSO UUID.
28
+ # @param [String] user_authorization_token Required parameter: This is the
29
+ # consumer's SSO access, which you retrieved from */auth/exchangeAccessCode*
30
+ # endpoint prefixed by Bearer.
31
+ # @param [String] application Required parameter: This is the calling
32
+ # application.
33
+ # @param [String] language_code Required parameter: This is a concatenation
34
+ # of language in lower case as per ISO 639-1 , “-” and country code as per
35
+ # ISO 3166-1 alpha-2. For example: en-GB.
36
+ # @param [String] language Optional parameter: This is the language in ISO
37
+ # 639-1 2 letter code format.
38
+ # @param [Object] channel Optional parameter: Channel.
39
+ # @param [Integer] page Optional parameter: The page number, which needs to
40
+ # be retrieved.
41
+ # @param [Integer] limit Optional parameter: The maximum number of resources
42
+ # to be sent across all pages.
43
+ # @param [Integer] offset Optional parameter: This is used to skip a certain
44
+ # number of resources at the start of each page.
45
+ # @param [Integer] page_size Optional parameter: This is the maximum number
46
+ # of resources to be sent in each page of the response.
47
+ # @param [TransactionTypeFilter] transaction_type Optional parameter: This
48
+ # is the type of the transaction. If the parameter is empty, it means that
49
+ # “ALL” queries.
50
+ # @param [String] from_date_time Optional parameter: This is the datetime
51
+ # from which the transaction details are required.
52
+ # @param [String] to_date_time Optional parameter: This is the datetime
53
+ # until which the transaction details are required.
54
+ # @param [TrueClass | FalseClass] filter_by_partner_code Optional parameter:
55
+ # This is used to filter the transactions based on partnerCode. If true,
56
+ # return the transactions related to partnerCode. If false, return all
57
+ # transactions.
58
+ # @return [ApiResponse] Complete http response with raw body and status code.
59
+ def get_transactions_l(country_code,
60
+ consumer_uuid,
61
+ user_authorization_token,
62
+ application,
63
+ language_code,
64
+ language: 'en',
65
+ channel: PARTNER,
66
+ page: nil,
67
+ limit: nil,
68
+ offset: nil,
69
+ page_size: nil,
70
+ transaction_type: nil,
71
+ from_date_time: nil,
72
+ to_date_time: nil,
73
+ filter_by_partner_code: nil)
74
+ @api_call
75
+ .request(new_request_builder(HttpMethodEnum::GET,
76
+ '/v1/consumers/transactionsL',
77
+ Server::SHELL2)
78
+ .header_param(new_parameter(country_code, key: 'country-code')
79
+ .is_required(true))
80
+ .header_param(new_parameter(consumer_uuid, key: 'consumerUUID')
81
+ .is_required(true))
82
+ .header_param(new_parameter(user_authorization_token, key: 'user-authorization-token')
83
+ .is_required(true))
84
+ .header_param(new_parameter(application, key: 'application')
85
+ .is_required(true))
86
+ .query_param(new_parameter(language_code, key: 'language_code')
87
+ .is_required(true))
88
+ .header_param(new_parameter(language, key: 'language'))
89
+ .header_param(new_parameter(channel, key: 'channel'))
90
+ .query_param(new_parameter(page, key: 'page'))
91
+ .query_param(new_parameter(limit, key: 'limit'))
92
+ .query_param(new_parameter(offset, key: 'offset'))
93
+ .query_param(new_parameter(page_size, key: 'pageSize'))
94
+ .query_param(new_parameter(transaction_type, key: 'transactionType'))
95
+ .query_param(new_parameter(from_date_time, key: 'fromDateTime'))
96
+ .query_param(new_parameter(to_date_time, key: 'toDateTime'))
97
+ .query_param(new_parameter(filter_by_partner_code, key: 'filterByPartnerCode'))
98
+ .header_param(new_parameter('application/json', key: 'accept'))
99
+ .auth(Single.new('client-authorization-token')))
100
+ .response(new_response_handler
101
+ .deserializer(APIHelper.method(:custom_type_deserializer))
102
+ .deserialize_into(TransactionsResponse.method(:from_hash))
103
+ .is_api_response(true)
104
+ .local_error('400',
105
+ 'Bad request - The request was not valid. This code is returned'\
106
+ ' when the server has attempted to process the request, but some'\
107
+ ' aspect of the request is not valid, for example an incorrectly'\
108
+ ' formatted resource or an attempt to deploy an invalid event'\
109
+ ' project to the event runtime. Information about the request is'\
110
+ ' provided in the response body and includes an error code and'\
111
+ ' error message.',
112
+ ErrorResponseException)
113
+ .local_error('401',
114
+ "Unauthorized request, Missing Authorization header, or expired'\
115
+ ' authorization token etc. It is returned from the application'\
116
+ ' server\nwhen application security is enabled, and'\
117
+ ' authorization information was missing from the request.\n",
118
+ ErrorResponseException)
119
+ .local_error('404',
120
+ 'Not Found.',
121
+ ResourceNotFoundErrorException)
122
+ .local_error('422',
123
+ "'Unprocessable Entity (WebDAV). If you are receiving an HTTP'\
124
+ ' 422 - Unprocessable Entity error, there are several'\
125
+ ' possibilities for why it might be occurring: <br><br> -You are'\
126
+ ' sending in a payload that is not valid JSON <br><br> -You are'\
127
+ ' sending HTTP headers, such as Content-Type or Accept, which'\
128
+ ' specify a value other than application/json <br><br> -The'\
129
+ ' request may be valid JSON, but there is something wrong with'\
130
+ ' the content.\n",
131
+ APIException)
132
+ .local_error('429',
133
+ "Rate limit hit. See Retry-After header for a minimum amount of'\
134
+ ' delay, but note that there is no guarantee\nthat subsequent'\
135
+ ' request won't be limited.\n",
136
+ APIException)
137
+ .local_error('500',
138
+ 'Internal server error.',
139
+ APIException))
140
+ .execute
141
+ end
142
+ end
143
+ end
@@ -0,0 +1,137 @@
1
+ # loyalty_ap_is
2
+ #
3
+ # This file was automatically generated by APIMATIC v3.0 (
4
+ # https://www.apimatic.io ).
5
+
6
+ module LoyaltyApIs
7
+ # loyalty_ap_is client class.
8
+ class Client
9
+ include CoreLibrary
10
+ attr_reader :config, :auth_managers
11
+
12
+ def user_agent_detail
13
+ config.user_agent_detail
14
+ end
15
+
16
+ # Returns the configured authentication client-authorization-token instance.
17
+ def client_authorization_token
18
+ @auth_managers['client-authorization-token']
19
+ end
20
+
21
+ # Access to authorization controller.
22
+ # @return [AuthorizationApi] Returns the controller instance.
23
+ def authorization
24
+ @authorization ||= AuthorizationApi.new @global_configuration
25
+ end
26
+
27
+ # Access to profile_management controller.
28
+ # @return [ProfileManagementApi] Returns the controller instance.
29
+ def profile_management
30
+ @profile_management ||= ProfileManagementApi.new @global_configuration
31
+ end
32
+
33
+ # Access to offer controller.
34
+ # @return [OfferApi] Returns the controller instance.
35
+ def offer
36
+ @offer ||= OfferApi.new @global_configuration
37
+ end
38
+
39
+ # Access to balances controller.
40
+ # @return [BalancesApi] Returns the controller instance.
41
+ def balances
42
+ @balances ||= BalancesApi.new @global_configuration
43
+ end
44
+
45
+ # Access to redemption controller.
46
+ # @return [RedemptionApi] Returns the controller instance.
47
+ def redemption
48
+ @redemption ||= RedemptionApi.new @global_configuration
49
+ end
50
+
51
+ # Access to transaction controller.
52
+ # @return [TransactionApi] Returns the controller instance.
53
+ def transaction
54
+ @transaction ||= TransactionApi.new @global_configuration
55
+ end
56
+
57
+ # Access to oauth_authorization controller.
58
+ # @return [OauthAuthorizationApi] Returns the controller instance.
59
+ def oauth_authorization
60
+ @oauth_authorization ||= OauthAuthorizationApi.new @global_configuration
61
+ end
62
+
63
+ def initialize(
64
+ connection: nil, adapter: :net_http_persistent, timeout: 30,
65
+ max_retries: 0, retry_interval: 1, backoff_factor: 2,
66
+ retry_statuses: [408, 413, 429, 500, 502, 503, 504, 521, 522, 524],
67
+ retry_methods: %i[get put], http_callback: nil, proxy_settings: nil,
68
+ logging_configuration: nil, environment: Environment::SIT,
69
+ public_bearer_token_credentials: nil, public_basic_token_credentials: nil,
70
+ private_basic_token_credentials: nil,
71
+ client_authorization_token_credentials: nil,
72
+ customer_header_credentials: nil, config: nil
73
+ )
74
+ @config = if config.nil?
75
+ Configuration.new(
76
+ connection: connection, adapter: adapter, timeout: timeout,
77
+ max_retries: max_retries, retry_interval: retry_interval,
78
+ backoff_factor: backoff_factor,
79
+ retry_statuses: retry_statuses,
80
+ retry_methods: retry_methods, http_callback: http_callback,
81
+ proxy_settings: proxy_settings,
82
+ logging_configuration: logging_configuration,
83
+ environment: environment,
84
+ public_bearer_token_credentials: public_bearer_token_credentials,
85
+ public_basic_token_credentials: public_basic_token_credentials,
86
+ private_basic_token_credentials: private_basic_token_credentials,
87
+ client_authorization_token_credentials: client_authorization_token_credentials,
88
+ customer_header_credentials: customer_header_credentials
89
+ )
90
+ else
91
+ config
92
+ end
93
+ user_agent_params = BaseApi.user_agent_parameters
94
+
95
+ @global_configuration = GlobalConfiguration.new(client_configuration: @config)
96
+ .base_uri_executor(@config.method(:get_base_uri))
97
+ .global_errors(BaseApi::GLOBAL_ERRORS)
98
+ .user_agent(BaseApi.user_agent,
99
+ agent_parameters: user_agent_params)
100
+
101
+ initialize_auth_managers(@global_configuration)
102
+ @global_configuration = @global_configuration.auth_managers(@auth_managers)
103
+ end
104
+
105
+ # Initializes the auth managers hash used for authenticating API calls.
106
+ # @param [GlobalConfiguration] global_config The global configuration of the SDK)
107
+ def initialize_auth_managers(global_config)
108
+ @auth_managers = {}
109
+ http_client_config = global_config.client_configuration
110
+ %w[PublicBearerToken PublicBasicToken PrivateBasicToken client-authorization-token customerHeader].each do |auth|
111
+ @auth_managers[auth] = nil
112
+ end
113
+ @auth_managers['PublicBearerToken'] = PublicBearerToken.new(
114
+ http_client_config.public_bearer_token_credentials
115
+ )
116
+ @auth_managers['PublicBasicToken'] = PublicBasicToken.new(
117
+ http_client_config.public_basic_token_credentials
118
+ )
119
+ @auth_managers['PrivateBasicToken'] = PrivateBasicToken.new(
120
+ http_client_config.private_basic_token_credentials
121
+ )
122
+ @auth_managers['client-authorization-token'] = ClientAuthorizationToken.new(
123
+ http_client_config.client_authorization_token_credentials, global_config
124
+ )
125
+ @auth_managers['customerHeader'] = CustomerHeader.new(
126
+ http_client_config.customer_header_credentials
127
+ )
128
+ end
129
+
130
+ # Creates a client directly from environment variables.
131
+ def self.from_env(**overrides)
132
+ default_config = Configuration.build_default_config_from_env
133
+ new_config = default_config.clone_with(**overrides)
134
+ new(config: new_config)
135
+ end
136
+ end
137
+ end