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
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA256:
3
+ metadata.gz: 346e6a793917166b67bda7bd4018ce13f909cbf2259773cc78f38df546aa4ddd
4
+ data.tar.gz: 99dd50a7713af2b6d8d558f3f1587e71b232f1a29db33e5dfdfa7235f95502fb
5
+ SHA512:
6
+ metadata.gz: bc48d367b5bfc78cb7f80136ac4a51f9e45dc4568190d3406a64d4b445466452d3c072c889594a5ed5a2948a754b9bb7f9c835c3c370d61a728df533f4a327c9
7
+ data.tar.gz: 466a111f8b8379cb00dc366b1bc8f2f3e6748f46b627cc48a618abd4be4b1502b0ff7f6a46197d2d3d03d4d34eb60c69998c6e3e7c04ef0c95d9ba111a17ccfa
data/LICENSE ADDED
@@ -0,0 +1,28 @@
1
+ License:
2
+ ========
3
+ The MIT License (MIT)
4
+ http://opensource.org/licenses/MIT
5
+
6
+ Copyright (c) 2014 - 2026 APIMATIC Limited
7
+
8
+ Permission is hereby granted, free of charge, to any person obtaining a copy
9
+ of this software and associated documentation files (the "Software"), to deal
10
+ in the Software without restriction, including without limitation the rights
11
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
12
+ copies of the Software, and to permit persons to whom the Software is
13
+ furnished to do so, subject to the following conditions:
14
+
15
+ The above copyright notice and this permission notice shall be included in
16
+ all copies or substantial portions of the Software.
17
+
18
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
19
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
20
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
21
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
22
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
23
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
24
+ THE SOFTWARE.
25
+
26
+ Trade Mark:
27
+ ==========
28
+ APIMATIC is a trade mark for APIMATIC Limited
data/README.md ADDED
@@ -0,0 +1,187 @@
1
+
2
+ # Getting Started with Loyalty APIs
3
+
4
+ ## Introduction
5
+
6
+ Loyalty Account Management provides the end points needed in order to generate the user Authorization Tokens which will provide access to the Loyalty APIs and also to update the user profile.
7
+
8
+ ## Install the Package
9
+
10
+ Install the gem from the command line:
11
+
12
+ ```bash
13
+ gem install loyalty-sdk -v 0.0.1
14
+ ```
15
+
16
+ Or add the gem to your Gemfile and run `bundle`:
17
+
18
+ ```ruby
19
+ gem 'loyalty-sdk', '0.0.1'
20
+ ```
21
+
22
+ For additional gem details, see the [RubyGems page for the loyalty-sdk gem](https://rubygems.org/gems/loyalty-sdk/versions/0.0.1).
23
+
24
+ ## IRB Console Usage
25
+
26
+ You can explore the SDK interactively using IRB in two ways
27
+
28
+ ### 1. Use IRB with Installed Gem
29
+
30
+ Open your system terminal (Command Prompt, Git Bash or macOS Terminal) and type the following command to start the irb console.
31
+
32
+ ```bash
33
+ irb
34
+ ```
35
+
36
+ Now you can load the SDK in the IRB
37
+
38
+ ```ruby
39
+ require 'loyalty_ap_is'
40
+ include LoyaltyApIs
41
+ ```
42
+
43
+ ### 2. Use IRB within SDK
44
+
45
+ Open your system terminal (Command Prompt, Git Bash or macOS Terminal) and navigate to the root folder of SDK.
46
+
47
+ ```
48
+ cd path/to/loyalty_ap_is
49
+ ```
50
+
51
+ Now you can start the preconfigured irb console by running the following command
52
+
53
+ ```bash
54
+ ruby bin/console
55
+ ```
56
+
57
+ **_Note:_** This automatically loads the SDK from lib/
58
+
59
+ ## Initialize the API Client
60
+
61
+ **_Note:_** Documentation for the client can be found [here.](https://www.github.com/sdks-io/loyalty-ruby-sdk/tree/0.0.1/doc/client.md)
62
+
63
+ The following parameters are configurable for the API Client:
64
+
65
+ | Parameter | Type | Description |
66
+ | --- | --- | --- |
67
+ | environment | [`Environment`](https://www.github.com/sdks-io/loyalty-ruby-sdk/tree/0.0.1/README.md#environments) | The API environment. <br> **Default: `Environment.SIT`** |
68
+ | connection | `Faraday::Connection` | The Faraday connection object passed by the SDK user for making requests |
69
+ | adapter | `Faraday::Adapter` | The Faraday adapter object passed by the SDK user for performing http requests |
70
+ | timeout | `Float` | The value to use for connection timeout. <br> **Default: 30** |
71
+ | max_retries | `Integer` | The number of times to retry an endpoint call if it fails. <br> **Default: 0** |
72
+ | retry_interval | `Float` | Pause in seconds between retries. <br> **Default: 1** |
73
+ | backoff_factor | `Float` | The amount to multiply each successive retry's interval amount by in order to provide backoff. <br> **Default: 2** |
74
+ | retry_statuses | `Array` | A list of HTTP statuses to retry. <br> **Default: [408, 413, 429, 500, 502, 503, 504, 521, 522, 524]** |
75
+ | retry_methods | `Array` | A list of HTTP methods to retry. <br> **Default: %i[get put]** |
76
+ | http_callback | `HttpCallBack` | The Http CallBack allows defining callables for pre and post API calls. |
77
+ | proxy_settings | [`ProxySettings`](https://www.github.com/sdks-io/loyalty-ruby-sdk/tree/0.0.1/doc/proxy-settings.md) | Optional proxy configuration to route HTTP requests through a proxy server. |
78
+ | logging_configuration | [`LoggingConfiguration`](https://www.github.com/sdks-io/loyalty-ruby-sdk/tree/0.0.1/doc/logging-configuration.md) | The SDK logging configuration for API calls |
79
+ | public_bearer_token_credentials | [`PublicBearerTokenCredentials`](https://www.github.com/sdks-io/loyalty-ruby-sdk/tree/0.0.1/doc/auth/oauth-2-bearer-token.md) | The credential object for OAuth 2 Bearer token |
80
+ | public_basic_token_credentials | [`PublicBasicTokenCredentials`](https://www.github.com/sdks-io/loyalty-ruby-sdk/tree/0.0.1/doc/auth/custom-header-signature.md) | The credential object for Custom Header Signature |
81
+ | private_basic_token_credentials | [`PrivateBasicTokenCredentials`](https://www.github.com/sdks-io/loyalty-ruby-sdk/tree/0.0.1/doc/auth/custom-header-signature-1.md) | The credential object for Custom Header Signature |
82
+ | client_authorization_token_credentials | [`ClientAuthorizationTokenCredentials`](https://www.github.com/sdks-io/loyalty-ruby-sdk/tree/0.0.1/doc/auth/oauth-2-client-credentials-grant.md) | The credential object for OAuth 2 Client Credentials Grant |
83
+ | customer_header_credentials | [`CustomerHeaderCredentials`](https://www.github.com/sdks-io/loyalty-ruby-sdk/tree/0.0.1/doc/auth/custom-header-signature-2.md) | The credential object for Custom Header Signature |
84
+
85
+ The API client can be initialized as follows:
86
+
87
+ ### Code-Based Client Initialization
88
+
89
+ ```ruby
90
+ require 'loyalty_ap_is'
91
+ include LoyaltyApIs
92
+
93
+ client = Client.new(
94
+ public_bearer_token_credentials: PublicBearerTokenCredentials.new(
95
+ access_token: 'AccessToken'
96
+ ),
97
+ public_basic_token_credentials: PublicBasicTokenCredentials.new(
98
+ public_basic_token: 'Public Basic Token'
99
+ ),
100
+ private_basic_token_credentials: PrivateBasicTokenCredentials.new(
101
+ public_basic_token: 'Public Basic Token'
102
+ ),
103
+ client_authorization_token_credentials: ClientAuthorizationTokenCredentials.new(
104
+ oauth_client_id: 'OAuthClientId',
105
+ oauth_client_secret: 'OAuthClientSecret'
106
+ ),
107
+ customer_header_credentials: CustomerHeaderCredentials.new(
108
+ authorization_token: 'Authorization-Token'
109
+ ),
110
+ environment: Environment::SIT,
111
+ logging_configuration: LoggingConfiguration.new(
112
+ log_level: Logger::INFO,
113
+ request_logging_config: RequestLoggingConfiguration.new(
114
+ log_body: true
115
+ ),
116
+ response_logging_config: ResponseLoggingConfiguration.new(
117
+ log_headers: true
118
+ )
119
+ )
120
+ )
121
+ ```
122
+
123
+ ### Environment-Based Client Initialization
124
+
125
+ ```ruby
126
+ require 'loyalty_ap_is'
127
+ include LoyaltyApIs
128
+
129
+ # Create client from environment
130
+ client = Client.from_env
131
+ ```
132
+
133
+ See the [`Environment-Based Client Initialization`](https://www.github.com/sdks-io/loyalty-ruby-sdk/tree/0.0.1/doc/environment-based-client-initialization.md) section for details.
134
+
135
+ ## Environments
136
+
137
+ The SDK can be configured to use a different environment for making API calls. Available environments are:
138
+
139
+ ### Fields
140
+
141
+ | Name | Description |
142
+ | --- | --- |
143
+ | SIT | **Default** |
144
+ | PRODUCTION | - |
145
+ | UAT | - |
146
+
147
+ ## Authorization
148
+
149
+ This API uses the following authentication schemes.
150
+
151
+ * [`PublicBearerToken (OAuth 2 Bearer token)`](https://www.github.com/sdks-io/loyalty-ruby-sdk/tree/0.0.1/doc/auth/oauth-2-bearer-token.md)
152
+ * [`PublicBasicToken (Custom Header Signature)`](https://www.github.com/sdks-io/loyalty-ruby-sdk/tree/0.0.1/doc/auth/custom-header-signature.md)
153
+ * [`PrivateBasicToken (Custom Header Signature)`](https://www.github.com/sdks-io/loyalty-ruby-sdk/tree/0.0.1/doc/auth/custom-header-signature-1.md)
154
+ * [`client-authorization-token (OAuth 2 Client Credentials Grant)`](https://www.github.com/sdks-io/loyalty-ruby-sdk/tree/0.0.1/doc/auth/oauth-2-client-credentials-grant.md)
155
+ * [`customerHeader (Custom Header Signature)`](https://www.github.com/sdks-io/loyalty-ruby-sdk/tree/0.0.1/doc/auth/custom-header-signature-2.md)
156
+
157
+ ## List of APIs
158
+
159
+ * [Profile Management](https://www.github.com/sdks-io/loyalty-ruby-sdk/tree/0.0.1/doc/controllers/profile-management.md)
160
+ * [Authorization](https://www.github.com/sdks-io/loyalty-ruby-sdk/tree/0.0.1/doc/controllers/authorization.md)
161
+ * [Offer](https://www.github.com/sdks-io/loyalty-ruby-sdk/tree/0.0.1/doc/controllers/offer.md)
162
+ * [Balances](https://www.github.com/sdks-io/loyalty-ruby-sdk/tree/0.0.1/doc/controllers/balances.md)
163
+ * [Redemption](https://www.github.com/sdks-io/loyalty-ruby-sdk/tree/0.0.1/doc/controllers/redemption.md)
164
+ * [Transaction](https://www.github.com/sdks-io/loyalty-ruby-sdk/tree/0.0.1/doc/controllers/transaction.md)
165
+
166
+ ## SDK Infrastructure
167
+
168
+ ### Configuration
169
+
170
+ * [ProxySettings](https://www.github.com/sdks-io/loyalty-ruby-sdk/tree/0.0.1/doc/proxy-settings.md)
171
+ * [Environment-Based Client Initialization](https://www.github.com/sdks-io/loyalty-ruby-sdk/tree/0.0.1/doc/environment-based-client-initialization.md)
172
+ * [AbstractLogger](https://www.github.com/sdks-io/loyalty-ruby-sdk/tree/0.0.1/doc/abstract-logger.md)
173
+ * [LoggingConfiguration](https://www.github.com/sdks-io/loyalty-ruby-sdk/tree/0.0.1/doc/logging-configuration.md)
174
+ * [RequestLoggingConfiguration](https://www.github.com/sdks-io/loyalty-ruby-sdk/tree/0.0.1/doc/request-logging-configuration.md)
175
+ * [ResponseLoggingConfiguration](https://www.github.com/sdks-io/loyalty-ruby-sdk/tree/0.0.1/doc/response-logging-configuration.md)
176
+
177
+ ### HTTP
178
+
179
+ * [HttpResponse](https://www.github.com/sdks-io/loyalty-ruby-sdk/tree/0.0.1/doc/http-response.md)
180
+ * [HttpRequest](https://www.github.com/sdks-io/loyalty-ruby-sdk/tree/0.0.1/doc/http-request.md)
181
+
182
+ ### Utilities
183
+
184
+ * [ApiResponse](https://www.github.com/sdks-io/loyalty-ruby-sdk/tree/0.0.1/doc/api-response.md)
185
+ * [ApiHelper](https://www.github.com/sdks-io/loyalty-ruby-sdk/tree/0.0.1/doc/api-helper.md)
186
+ * [DateTimeHelper](https://www.github.com/sdks-io/loyalty-ruby-sdk/tree/0.0.1/doc/date-time-helper.md)
187
+
data/bin/console ADDED
@@ -0,0 +1,15 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ # Load the lib folder into Ruby's load path
4
+ $LOAD_PATH.unshift(File.expand_path('../lib', __dir__))
5
+
6
+ # Require the gem
7
+ require 'loyalty_ap_is'
8
+
9
+ puts 'LoyaltyApIs SDK loaded!'
10
+ puts 'You can now create a client with: client = LoyaltyApIs::Client.new'
11
+ puts 'Or use from_env: client = LoyaltyApIs::Client.from_env'
12
+
13
+ # Start an interactive IRB session
14
+ require 'irb'
15
+ IRB.start
@@ -0,0 +1,10 @@
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
+ # API utility class
8
+ class APIHelper < CoreLibrary::ApiHelper
9
+ end
10
+ end
@@ -0,0 +1,116 @@
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
+ # AuthorizationApi
8
+ class AuthorizationApi < BaseApi
9
+ # When partner wants to get the basic public token, to be authorized to
10
+ # perform any other call inside SSO, needs to call this endpoint
11
+ # @param [AuthTokenRequest] body Required parameter: Digest data generated
12
+ # using sha256(client_id)
13
+ # @return [ApiResponse] Complete http response with raw body and status code.
14
+ def get_authorization_token(body)
15
+ @api_call
16
+ .request(new_request_builder(HttpMethodEnum::POST,
17
+ '/api/v2/auth/token',
18
+ Server::SHELL)
19
+ .header_param(new_parameter('application/json', key: 'Content-Type'))
20
+ .body_param(new_parameter(body)
21
+ .is_required(true))
22
+ .header_param(new_parameter('application/json', key: 'accept'))
23
+ .body_serializer(proc do |param| param.to_json unless param.nil? end))
24
+ .response(new_response_handler
25
+ .deserializer(APIHelper.method(:custom_type_deserializer))
26
+ .deserialize_into(AuthTokenResponse.method(:from_hash))
27
+ .is_api_response(true)
28
+ .local_error('400',
29
+ 'Bad Request. If the request is missing the digest field',
30
+ JsonApiErrorException)
31
+ .local_error('401',
32
+ 'Unauthorized. If the digest provided is not valid',
33
+ JsonApiErrorException)
34
+ .local_error('500',
35
+ 'Any unexpected error',
36
+ JsonApiErrorException))
37
+ .execute
38
+ end
39
+
40
+ # This endpoint allows to given an access code to retrieve an user profile
41
+ # with a pair of valid tokens. In this end point, accessCode can be
42
+ # exchanged for an accessToken which is user-authorization-token.
43
+ # @param [String] authorization Required parameter: Basic Public token which
44
+ # was generated with auth/token end point.
45
+ # @param [ExchangeAccessCodeRequest] body Required parameter: Exchange
46
+ # access code data
47
+ # @return [ApiResponse] Complete http response with raw body and status code.
48
+ def exchange_access_code(authorization,
49
+ body)
50
+ @api_call
51
+ .request(new_request_builder(HttpMethodEnum::POST,
52
+ '/api/v2/auth/exchangeAccessCode',
53
+ Server::SHELL)
54
+ .header_param(new_parameter(authorization, key: 'Authorization')
55
+ .is_required(true))
56
+ .header_param(new_parameter('application/json', key: 'Content-Type'))
57
+ .body_param(new_parameter(body)
58
+ .is_required(true))
59
+ .header_param(new_parameter('application/json', key: 'accept'))
60
+ .body_serializer(proc do |param| param.to_json unless param.nil? end)
61
+ .auth(Single.new('PublicBasicToken')))
62
+ .response(new_response_handler
63
+ .deserializer(APIHelper.method(:custom_type_deserializer))
64
+ .deserialize_into(M200UserPartners.method(:from_hash))
65
+ .is_api_response(true)
66
+ .local_error('401',
67
+ 'Unauthorized. If making the call with an invalid token',
68
+ JsonApiErrorException)
69
+ .local_error('404',
70
+ 'Not found. If the access code is not in the database',
71
+ JsonApiErrorException)
72
+ .local_error('500',
73
+ 'Any unexpected error',
74
+ JsonApiErrorException))
75
+ .execute
76
+ end
77
+
78
+ # When an access token has expired, a partner that wants to get a new pair
79
+ # of valid tokens to go on performing operations against SSO needs to call
80
+ # this endpoint.
81
+ # @param [String] authorization Required parameter: Basic Public token which
82
+ # was generated with auth/token end point.
83
+ # @param [RefreshTokenRequest] body Optional parameter: TODO: type
84
+ # description here
85
+ # @return [ApiResponse] Complete http response with raw body and status code.
86
+ def refresh(authorization,
87
+ body: nil)
88
+ @api_call
89
+ .request(new_request_builder(HttpMethodEnum::POST,
90
+ '/api/v2/auth/token/refresh',
91
+ Server::SHELL)
92
+ .header_param(new_parameter(authorization, key: 'Authorization')
93
+ .is_required(true))
94
+ .header_param(new_parameter('application/json', key: 'Content-Type'))
95
+ .body_param(new_parameter(body))
96
+ .header_param(new_parameter('application/json', key: 'accept'))
97
+ .body_serializer(proc do |param| param.to_json unless param.nil? end))
98
+ .response(new_response_handler
99
+ .deserializer(APIHelper.method(:custom_type_deserializer))
100
+ .deserialize_into(RefreshTokenResponse.method(:from_hash))
101
+ .is_api_response(true)
102
+ .local_error('400',
103
+ 'Bad Request. The request is missing the Refresh Token field.',
104
+ JsonApiErrorException)
105
+ .local_error('401',
106
+ 'Unauthorized. This response is generated when either the Basic'\
107
+ ' Token is invalid or the Refresh Token is invalid (see'\
108
+ ' examples)',
109
+ JsonApiErrorException)
110
+ .local_error('500',
111
+ 'Any unexpected error',
112
+ JsonApiErrorException))
113
+ .execute
114
+ end
115
+ end
116
+ end
@@ -0,0 +1,96 @@
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
+ # BalancesApi
8
+ class BalancesApi < BaseApi
9
+ # Retrieve the customer's loyalty point balance
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. This
15
+ # is referred to as user-authorization-token where the access is provided by
16
+ # the end user.
17
+ # @param [String] consumer_uuid Required parameter: SSO uuid of the user
18
+ # signed in with Shell credentials Format: 32 hexadecimal digits grouped the
19
+ # following way: xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx
20
+ # @param [String] country_code Required parameter: The two character ISO
21
+ # 3166-1 alpha-2 [country
22
+ # code](https://www.iso.org/iso-3166-country-codes.html).
23
+ # @param [UUID | String] x_correlation_id Optional parameter: An unique ID
24
+ # in GUID format in order to track the request.
25
+ # @param [AssignOfferChannel] channel Optional parameter: Channel.
26
+ # @param [String] application Optional parameter: String
27
+ # @return [ApiResponse] Complete http response with raw body and status code.
28
+ def get_balance_by_uuid(language_code,
29
+ user_authorization_token,
30
+ consumer_uuid,
31
+ country_code,
32
+ x_correlation_id: nil,
33
+ channel: nil,
34
+ application: nil)
35
+ @api_call
36
+ .request(new_request_builder(HttpMethodEnum::GET,
37
+ '/consumers/balances',
38
+ Server::SHELL1)
39
+ .query_param(new_parameter(language_code, key: 'language_code')
40
+ .is_required(true))
41
+ .header_param(new_parameter(user_authorization_token, key: 'user-authorization-token')
42
+ .is_required(true))
43
+ .header_param(new_parameter(consumer_uuid, key: 'consumerUUID')
44
+ .is_required(true))
45
+ .header_param(new_parameter(country_code, key: 'country-code')
46
+ .is_required(true))
47
+ .header_param(new_parameter(x_correlation_id, key: 'x-correlation-id'))
48
+ .header_param(new_parameter(channel, key: 'channel'))
49
+ .header_param(new_parameter(application, key: 'application'))
50
+ .header_param(new_parameter('application/json', key: 'accept'))
51
+ .auth(And.new('customerHeader', 'client-authorization-token')))
52
+ .response(new_response_handler
53
+ .deserializer(APIHelper.method(:custom_type_deserializer))
54
+ .deserialize_into(CustomerBalances.method(:from_hash))
55
+ .is_api_response(true)
56
+ .local_error('400',
57
+ 'Bad request - The request was not valid. This code is returned'\
58
+ ' when the server has attempted to process the request, but some'\
59
+ ' aspect of the request is not valid, for example an incorrectly'\
60
+ ' formatted resource or an attempt to deploy an invalid event'\
61
+ ' project to the event runtime. Information about the request is'\
62
+ ' provided in the response body, and includes an error code and'\
63
+ ' error message.',
64
+ ConsumersBalances400ErrorException)
65
+ .local_error('401',
66
+ "Unauthorized request, Missing Authorization header, or expired'\
67
+ ' authorization token etc. It is returned from the application'\
68
+ ' server \nwhen application security is enabled, and'\
69
+ ' authorization information was missing from the request.\n",
70
+ ConsumersBalances401ErrorException)
71
+ .local_error('404',
72
+ 'Not found - the server can not find the requested resource.',
73
+ ConsumersBalances404ErrorException)
74
+ .local_error('422',
75
+ "Unprocessable Entity (WebDAV). If you are receiving an HTTP'\
76
+ ' 422 - Unprocessable Entity error, \nthere are several'\
77
+ ' possibilities for why it might be occurring-<br>\n - You are'\
78
+ ' sending in a payload that is not valid JSON. <br> \n - You are'\
79
+ ' sending HTTP headers, such as Content-Type or Accept, which'\
80
+ ' specify a value other than application/json. <br>\n - The'\
81
+ ' request may be valid JSON, but there is something wrong with'\
82
+ ' the content. \n",
83
+ ConsumersBalances422ErrorException)
84
+ .local_error('429',
85
+ 'Rate limit hit. See the Retry-After header to specify a delay,'\
86
+ ' but note that there is no guarantee that subsequent requests'\
87
+ ' won\'t be limited.',
88
+ APIException)
89
+ .local_error('500',
90
+ 'Internal error - the server encountered an unexpected'\
91
+ ' condition that prevented it from fulfilling the request.',
92
+ APIException))
93
+ .execute
94
+ end
95
+ end
96
+ end
@@ -0,0 +1,67 @@
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
+ # BaseApi.
8
+ class BaseApi
9
+ include CoreLibrary
10
+ attr_accessor :config, :http_call_back
11
+
12
+ def self.user_agent
13
+ 'Ruby-SDK/0.0.1 (OS: {os-info}, Engine: {engine}/{engine-version})'
14
+ end
15
+
16
+ def self.user_agent_parameters
17
+ {
18
+ '{engine}' => { 'value' => RUBY_ENGINE, 'encode' => false },
19
+ '{engine-version}' => { 'value' => RUBY_ENGINE_VERSION, 'encode' => false },
20
+ '{os-info}' => { 'value' => RUBY_PLATFORM, 'encode' => false }
21
+ }
22
+ end
23
+
24
+ GLOBAL_ERRORS = {
25
+ 'default' => ErrorCase.new
26
+ .error_message('HTTP response not OK.')
27
+ .exception_type(APIException)
28
+ }.freeze
29
+
30
+ # Initialization constructor.
31
+ # @param [GlobalConfiguration] global_configuration The instance of GlobalConfiguration.
32
+ def initialize(global_configuration)
33
+ @global_configuration = global_configuration
34
+ @config = @global_configuration.client_configuration
35
+ @http_call_back = @config.http_callback
36
+ @api_call = ApiCall.new(@global_configuration)
37
+ end
38
+
39
+ # Creates a new instance of the request builder.
40
+ # @param [String] http_method The HTTP method to use in the request.
41
+ # @param [String] path The endpoint path to use in the request.
42
+ # @param [String] server The server to extract the base uri for the request.
43
+ # @return [RequestBuilder] The instance of RequestBuilder.
44
+ def new_request_builder(http_method, path, server)
45
+ RequestBuilder.new
46
+ .http_method(http_method)
47
+ .path(path)
48
+ .server(server)
49
+ end
50
+
51
+ # Creates a new instance of the response handler.
52
+ # @return [ResponseHandler] The instance of ResponseHandler.
53
+ def new_response_handler
54
+ ResponseHandler.new
55
+ end
56
+
57
+ # Creates a new instance of the parameter.
58
+ # @param [String|optional] key The key of the parameter.
59
+ # @param [Object] value The value of the parameter.
60
+ # @return [Parameter] The instance of Parameter.
61
+ def new_parameter(value, key: nil)
62
+ Parameter.new
63
+ .key(key)
64
+ .value(value)
65
+ end
66
+ end
67
+ 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
+ # OauthAuthorizationApi
8
+ class OauthAuthorizationApi < BaseApi
9
+ # Create a new OAuth 2 token.
10
+ # @param [String] authorization Required parameter: Authorization header in
11
+ # Basic auth format
12
+ # @param [String] scope Optional parameter: Requested scopes as a
13
+ # space-delimited list.
14
+ # @param [Hash] _field_parameters Additional optional form parameters are
15
+ # supported by this endpoint.
16
+ # @return [ApiResponse] Complete http response with raw body and status code.
17
+ def request_token_client_authorization_token(authorization,
18
+ scope: nil,
19
+ _field_parameters: nil)
20
+ @api_call
21
+ .request(new_request_builder(HttpMethodEnum::POST,
22
+ '/v2/oauth/token',
23
+ Server::OAUTH_SERVER)
24
+ .form_param(new_parameter('client_credentials', key: 'grant_type'))
25
+ .header_param(new_parameter(authorization, key: 'Authorization')
26
+ .is_required(true))
27
+ .form_param(new_parameter(scope, key: 'scope'))
28
+ .header_param(new_parameter('application/x-www-form-urlencoded', key: 'content-type'))
29
+ .header_param(new_parameter('application/json', key: 'accept'))
30
+ .additional_form_params(_field_parameters))
31
+ .response(new_response_handler
32
+ .deserializer(APIHelper.method(:custom_type_deserializer))
33
+ .deserialize_into(OauthToken.method(:from_hash))
34
+ .is_api_response(true)
35
+ .local_error('400',
36
+ 'OAuth 2 provider returned an error.',
37
+ OauthProviderException)
38
+ .local_error('401',
39
+ 'OAuth 2 provider says client authentication failed.',
40
+ OauthProviderException))
41
+ .execute
42
+ end
43
+ end
44
+ end