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.
- checksums.yaml +7 -0
- data/LICENSE +28 -0
- data/README.md +187 -0
- data/bin/console +15 -0
- data/lib/loyalty_ap_is/api_helper.rb +10 -0
- data/lib/loyalty_ap_is/apis/authorization_api.rb +116 -0
- data/lib/loyalty_ap_is/apis/balances_api.rb +96 -0
- data/lib/loyalty_ap_is/apis/base_api.rb +67 -0
- data/lib/loyalty_ap_is/apis/oauth_authorization_api.rb +44 -0
- data/lib/loyalty_ap_is/apis/offer_api.rb +164 -0
- data/lib/loyalty_ap_is/apis/profile_management_api.rb +44 -0
- data/lib/loyalty_ap_is/apis/redemption_api.rb +107 -0
- data/lib/loyalty_ap_is/apis/transaction_api.rb +143 -0
- data/lib/loyalty_ap_is/client.rb +137 -0
- data/lib/loyalty_ap_is/configuration.rb +238 -0
- data/lib/loyalty_ap_is/exceptions/api_exception.rb +21 -0
- data/lib/loyalty_ap_is/exceptions/common_error_exception.rb +98 -0
- data/lib/loyalty_ap_is/exceptions/consumers_balances400_error_exception.rb +57 -0
- data/lib/loyalty_ap_is/exceptions/consumers_balances401_error_exception.rb +57 -0
- data/lib/loyalty_ap_is/exceptions/consumers_balances404_error_exception.rb +57 -0
- data/lib/loyalty_ap_is/exceptions/consumers_balances422_error_exception.rb +57 -0
- data/lib/loyalty_ap_is/exceptions/error_response_exception.rb +57 -0
- data/lib/loyalty_ap_is/exceptions/json_api_error_exception.rb +60 -0
- data/lib/loyalty_ap_is/exceptions/oauth_provider_exception.rb +64 -0
- data/lib/loyalty_ap_is/exceptions/resource_not_found_error_exception.rb +57 -0
- data/lib/loyalty_ap_is/http/api_response.rb +19 -0
- data/lib/loyalty_ap_is/http/auth/client_authorization_token.rb +148 -0
- data/lib/loyalty_ap_is/http/auth/customer_header.rb +52 -0
- data/lib/loyalty_ap_is/http/auth/private_basic_token.rb +52 -0
- data/lib/loyalty_ap_is/http/auth/public_basic_token.rb +52 -0
- data/lib/loyalty_ap_is/http/auth/public_bearer_token.rb +53 -0
- data/lib/loyalty_ap_is/http/http_call_back.rb +10 -0
- data/lib/loyalty_ap_is/http/http_method_enum.rb +10 -0
- data/lib/loyalty_ap_is/http/http_request.rb +10 -0
- data/lib/loyalty_ap_is/http/http_response.rb +10 -0
- data/lib/loyalty_ap_is/http/proxy_settings.rb +22 -0
- data/lib/loyalty_ap_is/logging/configuration/api_logging_configuration.rb +186 -0
- data/lib/loyalty_ap_is/logging/sdk_logger.rb +17 -0
- data/lib/loyalty_ap_is/models/access_code_response.rb +87 -0
- data/lib/loyalty_ap_is/models/assign_offer_channel.rb +26 -0
- data/lib/loyalty_ap_is/models/auth_token_request.rb +75 -0
- data/lib/loyalty_ap_is/models/auth_token_response.rb +106 -0
- data/lib/loyalty_ap_is/models/bad_request_error.rb +63 -0
- data/lib/loyalty_ap_is/models/balance_amount.rb +84 -0
- data/lib/loyalty_ap_is/models/balance_amount_detail.rb +141 -0
- data/lib/loyalty_ap_is/models/balance_currency_amount.rb +93 -0
- data/lib/loyalty_ap_is/models/balance_currency_type.rb +60 -0
- data/lib/loyalty_ap_is/models/balance_state.rb +72 -0
- data/lib/loyalty_ap_is/models/base_model.rb +110 -0
- data/lib/loyalty_ap_is/models/client_auth_token_request.rb +78 -0
- data/lib/loyalty_ap_is/models/currency_data.rb +101 -0
- data/lib/loyalty_ap_is/models/customer_balances.rb +84 -0
- data/lib/loyalty_ap_is/models/error_base_container.rb +82 -0
- data/lib/loyalty_ap_is/models/error_info.rb +84 -0
- data/lib/loyalty_ap_is/models/error_item.rb +105 -0
- data/lib/loyalty_ap_is/models/error_presenter.rb +150 -0
- data/lib/loyalty_ap_is/models/error_source.rb +75 -0
- data/lib/loyalty_ap_is/models/ev_charging_details.rb +151 -0
- data/lib/loyalty_ap_is/models/exchange_access_code_request.rb +77 -0
- data/lib/loyalty_ap_is/models/fault.rb +85 -0
- data/lib/loyalty_ap_is/models/fault_detail.rb +76 -0
- data/lib/loyalty_ap_is/models/json_api_version.rb +75 -0
- data/lib/loyalty_ap_is/models/loyalty_card_info.rb +76 -0
- data/lib/loyalty_ap_is/models/m200_user_partners.rb +109 -0
- data/lib/loyalty_ap_is/models/method_not_allowed_error.rb +62 -0
- data/lib/loyalty_ap_is/models/not_found_error.rb +62 -0
- data/lib/loyalty_ap_is/models/not_found_error_response.rb +90 -0
- data/lib/loyalty_ap_is/models/oauth_provider_error.rb +62 -0
- data/lib/loyalty_ap_is/models/oauth_token.rb +96 -0
- data/lib/loyalty_ap_is/models/offer.rb +155 -0
- data/lib/loyalty_ap_is/models/offer_assignment.rb +172 -0
- data/lib/loyalty_ap_is/models/offer_base.rb +101 -0
- data/lib/loyalty_ap_is/models/offer_info.rb +156 -0
- data/lib/loyalty_ap_is/models/offer_language.rb +100 -0
- data/lib/loyalty_ap_is/models/points_to_cash.rb +99 -0
- data/lib/loyalty_ap_is/models/product_type.rb +53 -0
- data/lib/loyalty_ap_is/models/redeemed_item.rb +221 -0
- data/lib/loyalty_ap_is/models/redeemed_item_product.rb +131 -0
- data/lib/loyalty_ap_is/models/redemption_item.rb +109 -0
- data/lib/loyalty_ap_is/models/redemption_request.rb +107 -0
- data/lib/loyalty_ap_is/models/redemption_response.rb +118 -0
- data/lib/loyalty_ap_is/models/redemption_response_item.rb +111 -0
- data/lib/loyalty_ap_is/models/refresh_token_request.rb +75 -0
- data/lib/loyalty_ap_is/models/refresh_token_response.rb +93 -0
- data/lib/loyalty_ap_is/models/sale_item.rb +262 -0
- data/lib/loyalty_ap_is/models/sale_item_product.rb +135 -0
- data/lib/loyalty_ap_is/models/site_data.rb +121 -0
- data/lib/loyalty_ap_is/models/transaction.rb +351 -0
- data/lib/loyalty_ap_is/models/transaction_balance.rb +91 -0
- data/lib/loyalty_ap_is/models/transaction_balance_amount.rb +82 -0
- data/lib/loyalty_ap_is/models/transaction_balance_state.rb +64 -0
- data/lib/loyalty_ap_is/models/transaction_currency_type.rb +56 -0
- data/lib/loyalty_ap_is/models/transaction_detail_type.rb +53 -0
- data/lib/loyalty_ap_is/models/transaction_type_filter.rb +40 -0
- data/lib/loyalty_ap_is/models/transaction_voucher.rb +109 -0
- data/lib/loyalty_ap_is/models/transactions_response.rb +118 -0
- data/lib/loyalty_ap_is/models/unauthorized_error.rb +62 -0
- data/lib/loyalty_ap_is/models/unit_measure.rb +40 -0
- data/lib/loyalty_ap_is/models/unprocessable_entity_error_response.rb +90 -0
- data/lib/loyalty_ap_is/models/voucher_item.rb +99 -0
- data/lib/loyalty_ap_is/utilities/date_time_helper.rb +11 -0
- data/lib/loyalty_ap_is/utilities/file_wrapper.rb +28 -0
- data/lib/loyalty_ap_is.rb +128 -0
- metadata +189 -0
|
@@ -0,0 +1,238 @@
|
|
|
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
|
+
# An enum for SDK environments.
|
|
8
|
+
class Environment
|
|
9
|
+
ENVIRONMENT = [
|
|
10
|
+
SIT = 'SIT'.freeze,
|
|
11
|
+
PRODUCTION = 'Production'.freeze,
|
|
12
|
+
UAT = 'UAT'.freeze
|
|
13
|
+
].freeze
|
|
14
|
+
|
|
15
|
+
# Converts a string or symbol into a valid Environment constant.
|
|
16
|
+
def self.from_value(value, default_value = SIT)
|
|
17
|
+
return default_value if value.nil?
|
|
18
|
+
|
|
19
|
+
str = value.to_s.strip.downcase
|
|
20
|
+
case str
|
|
21
|
+
when 'sit' then SIT
|
|
22
|
+
when 'production' then PRODUCTION
|
|
23
|
+
when 'uat' then UAT
|
|
24
|
+
|
|
25
|
+
else
|
|
26
|
+
warn "[Environment] Unknown environment '#{value}', falling back to #{default_value} "
|
|
27
|
+
default_value
|
|
28
|
+
end
|
|
29
|
+
end
|
|
30
|
+
end
|
|
31
|
+
|
|
32
|
+
# An enum for API servers.
|
|
33
|
+
class Server
|
|
34
|
+
SERVER = [
|
|
35
|
+
OAUTH_SERVER = 'OAuth Server'.freeze,
|
|
36
|
+
SHELL = 'Shell'.freeze,
|
|
37
|
+
SHELL1 = 'Shell1'.freeze,
|
|
38
|
+
SHELL2 = 'Shell2'.freeze
|
|
39
|
+
].freeze
|
|
40
|
+
|
|
41
|
+
# Converts a string or symbol into a valid Server constant.
|
|
42
|
+
def self.from_value(value, default_value = OAUTH_SERVER)
|
|
43
|
+
return default_value if value.nil?
|
|
44
|
+
|
|
45
|
+
str = value.to_s.strip.downcase
|
|
46
|
+
case str
|
|
47
|
+
when 'oauth_server' then OAUTH_SERVER
|
|
48
|
+
when 'shell' then SHELL
|
|
49
|
+
when 'shell1' then SHELL1
|
|
50
|
+
when 'shell2' then SHELL2
|
|
51
|
+
|
|
52
|
+
else
|
|
53
|
+
warn "[Server] Unknown server '#{value}', falling back to #{default_value} "
|
|
54
|
+
default_value
|
|
55
|
+
end
|
|
56
|
+
end
|
|
57
|
+
end
|
|
58
|
+
|
|
59
|
+
# All configuration including auth info and base URI for the API access
|
|
60
|
+
# are configured in this class.
|
|
61
|
+
class Configuration < CoreLibrary::HttpClientConfiguration
|
|
62
|
+
# The attribute readers for properties.
|
|
63
|
+
attr_reader :environment, :public_bearer_token_credentials,
|
|
64
|
+
:public_basic_token_credentials,
|
|
65
|
+
:private_basic_token_credentials,
|
|
66
|
+
:client_authorization_token_credentials,
|
|
67
|
+
:customer_header_credentials
|
|
68
|
+
|
|
69
|
+
class << self
|
|
70
|
+
attr_reader :environments
|
|
71
|
+
end
|
|
72
|
+
|
|
73
|
+
def initialize(
|
|
74
|
+
connection: nil, adapter: :net_http_persistent, timeout: 30,
|
|
75
|
+
max_retries: 0, retry_interval: 1, backoff_factor: 2,
|
|
76
|
+
retry_statuses: [408, 413, 429, 500, 502, 503, 504, 521, 522, 524],
|
|
77
|
+
retry_methods: %i[get put], http_callback: nil, proxy_settings: nil,
|
|
78
|
+
logging_configuration: nil, environment: Environment::SIT,
|
|
79
|
+
public_bearer_token_credentials: nil, public_basic_token_credentials: nil,
|
|
80
|
+
private_basic_token_credentials: nil,
|
|
81
|
+
client_authorization_token_credentials: nil,
|
|
82
|
+
customer_header_credentials: nil
|
|
83
|
+
)
|
|
84
|
+
super connection: connection, adapter: adapter, timeout: timeout,
|
|
85
|
+
max_retries: max_retries, retry_interval: retry_interval,
|
|
86
|
+
backoff_factor: backoff_factor, retry_statuses: retry_statuses,
|
|
87
|
+
retry_methods: retry_methods, http_callback: http_callback,
|
|
88
|
+
proxy_settings: proxy_settings,
|
|
89
|
+
logging_configuration: logging_configuration
|
|
90
|
+
|
|
91
|
+
# Current API environment
|
|
92
|
+
@environment = String(environment)
|
|
93
|
+
|
|
94
|
+
# The object holding OAuth 2 Bearer token credentials
|
|
95
|
+
@public_bearer_token_credentials = public_bearer_token_credentials
|
|
96
|
+
|
|
97
|
+
# The object holding Custom Header Signature credentials
|
|
98
|
+
@public_basic_token_credentials = public_basic_token_credentials
|
|
99
|
+
|
|
100
|
+
# The object holding Custom Header Signature credentials
|
|
101
|
+
@private_basic_token_credentials = private_basic_token_credentials
|
|
102
|
+
|
|
103
|
+
# The object holding OAuth 2 Client Credentials Grant credentials
|
|
104
|
+
@client_authorization_token_credentials = client_authorization_token_credentials
|
|
105
|
+
|
|
106
|
+
# The object holding Custom Header Signature credentials
|
|
107
|
+
@customer_header_credentials = customer_header_credentials
|
|
108
|
+
|
|
109
|
+
# The Http Client to use for making requests.
|
|
110
|
+
set_http_client CoreLibrary::FaradayClient.new(self)
|
|
111
|
+
end
|
|
112
|
+
|
|
113
|
+
def clone_with(connection: nil, adapter: nil, timeout: nil,
|
|
114
|
+
max_retries: nil, retry_interval: nil, backoff_factor: nil,
|
|
115
|
+
retry_statuses: nil, retry_methods: nil, http_callback: nil,
|
|
116
|
+
proxy_settings: nil, logging_configuration: nil,
|
|
117
|
+
environment: nil, public_bearer_token_credentials: nil,
|
|
118
|
+
public_basic_token_credentials: nil,
|
|
119
|
+
private_basic_token_credentials: nil,
|
|
120
|
+
client_authorization_token_credentials: nil,
|
|
121
|
+
customer_header_credentials: nil)
|
|
122
|
+
connection ||= self.connection
|
|
123
|
+
adapter ||= self.adapter
|
|
124
|
+
timeout ||= self.timeout
|
|
125
|
+
max_retries ||= self.max_retries
|
|
126
|
+
retry_interval ||= self.retry_interval
|
|
127
|
+
backoff_factor ||= self.backoff_factor
|
|
128
|
+
retry_statuses ||= self.retry_statuses
|
|
129
|
+
retry_methods ||= self.retry_methods
|
|
130
|
+
http_callback ||= self.http_callback
|
|
131
|
+
proxy_settings ||= self.proxy_settings
|
|
132
|
+
logging_configuration ||= self.logging_configuration
|
|
133
|
+
environment ||= self.environment
|
|
134
|
+
public_bearer_token_credentials ||= self.public_bearer_token_credentials
|
|
135
|
+
public_basic_token_credentials ||= self.public_basic_token_credentials
|
|
136
|
+
private_basic_token_credentials ||= self.private_basic_token_credentials
|
|
137
|
+
client_authorization_token_credentials ||= self.client_authorization_token_credentials
|
|
138
|
+
customer_header_credentials ||= self.customer_header_credentials
|
|
139
|
+
|
|
140
|
+
Configuration.new(
|
|
141
|
+
connection: connection, adapter: adapter, timeout: timeout,
|
|
142
|
+
max_retries: max_retries, retry_interval: retry_interval,
|
|
143
|
+
backoff_factor: backoff_factor, retry_statuses: retry_statuses,
|
|
144
|
+
retry_methods: retry_methods, http_callback: http_callback,
|
|
145
|
+
proxy_settings: proxy_settings,
|
|
146
|
+
logging_configuration: logging_configuration, environment: environment,
|
|
147
|
+
public_bearer_token_credentials: public_bearer_token_credentials,
|
|
148
|
+
public_basic_token_credentials: public_basic_token_credentials,
|
|
149
|
+
private_basic_token_credentials: private_basic_token_credentials,
|
|
150
|
+
client_authorization_token_credentials: client_authorization_token_credentials,
|
|
151
|
+
customer_header_credentials: customer_header_credentials
|
|
152
|
+
)
|
|
153
|
+
end
|
|
154
|
+
|
|
155
|
+
|
|
156
|
+
# All the environments the SDK can run in.
|
|
157
|
+
ENVIRONMENTS = {
|
|
158
|
+
Environment::SIT => {
|
|
159
|
+
Server::OAUTH_SERVER => 'https://api-test.shell.com',
|
|
160
|
+
Server::SHELL => 'https://api-test.shell.com',
|
|
161
|
+
Server::SHELL1 => 'https://api-test.shell.com/loyalty/v1',
|
|
162
|
+
Server::SHELL2 => 'https://api-test.shell.com/loyalty'
|
|
163
|
+
},
|
|
164
|
+
Environment::PRODUCTION => {
|
|
165
|
+
Server::OAUTH_SERVER => 'https://api.shell.com',
|
|
166
|
+
Server::SHELL => 'https://id.consumer.shell.com',
|
|
167
|
+
Server::SHELL1 => 'https://api.shell.com/loyalty/v1',
|
|
168
|
+
Server::SHELL2 => 'https://api.shell.com/loyalty'
|
|
169
|
+
},
|
|
170
|
+
Environment::UAT => {
|
|
171
|
+
Server::OAUTH_SERVER => 'https://api.shell.com',
|
|
172
|
+
Server::SHELL => 'https://test.id.consumer.shell.com',
|
|
173
|
+
Server::SHELL1 => 'https://api-uat.shell.com/loyalty/v1',
|
|
174
|
+
Server::SHELL2 => 'https://api-uat.shell.com/loyalty'
|
|
175
|
+
}
|
|
176
|
+
}.freeze
|
|
177
|
+
|
|
178
|
+
# Generates the appropriate base URI for the environment and the server.
|
|
179
|
+
# @param [Configuration::Server] server The server enum for which the base URI is
|
|
180
|
+
# required.
|
|
181
|
+
# @return [String] The base URI.
|
|
182
|
+
def get_base_uri(server = Server::SHELL)
|
|
183
|
+
ENVIRONMENTS[environment][server].clone
|
|
184
|
+
end
|
|
185
|
+
|
|
186
|
+
# Builds a Configuration instance using environment variables.
|
|
187
|
+
def self.build_default_config_from_env
|
|
188
|
+
# === Core environment ===
|
|
189
|
+
environment = Environment.from_value(ENV.fetch('ENVIRONMENT', 'sit'))
|
|
190
|
+
timeout = (ENV['TIMEOUT'] || 30).to_f
|
|
191
|
+
max_retries = (ENV['MAX_RETRIES'] || 0).to_i
|
|
192
|
+
retry_interval = (ENV['RETRY_INTERVAL'] || 1).to_f
|
|
193
|
+
backoff_factor = (ENV['BACKOFF_FACTOR'] || 2).to_f
|
|
194
|
+
retry_statuses = ENV.fetch('RETRY_STATUSES',
|
|
195
|
+
'[408, 413, 429, 500, 502, 503, 504, 521, 522, 524]').gsub(/[\[\]]/, '')
|
|
196
|
+
.split(',')
|
|
197
|
+
.map(&:strip)
|
|
198
|
+
.map do |item|
|
|
199
|
+
item.match?(/\A\d+\z/) ? item.to_i : item.downcase
|
|
200
|
+
end
|
|
201
|
+
retry_methods = ENV.fetch('RETRY_METHODS', '%i[get put]').gsub(/[\[\]]/, '')
|
|
202
|
+
.split(',')
|
|
203
|
+
.map(&:strip)
|
|
204
|
+
.map do |item|
|
|
205
|
+
item.match?(/\A\d+\z/) ? item.to_i : item.downcase
|
|
206
|
+
end
|
|
207
|
+
|
|
208
|
+
# === Authentication credentials ===
|
|
209
|
+
public_bearer_token_credentials = PublicBearerTokenCredentials.from_env
|
|
210
|
+
public_basic_token_credentials = PublicBasicTokenCredentials.from_env
|
|
211
|
+
private_basic_token_credentials = PrivateBasicTokenCredentials.from_env
|
|
212
|
+
client_authorization_token_credentials = ClientAuthorizationTokenCredentials.from_env
|
|
213
|
+
customer_header_credentials = CustomerHeaderCredentials.from_env
|
|
214
|
+
|
|
215
|
+
# === Proxy settings ===
|
|
216
|
+
proxy_settings = ProxySettings.from_env
|
|
217
|
+
# === Logging Configuration ===
|
|
218
|
+
logging_configuration = LoggingConfiguration.from_env if LoggingConfiguration.any_logging_configured?
|
|
219
|
+
|
|
220
|
+
Configuration.new(
|
|
221
|
+
environment: environment,
|
|
222
|
+
timeout: timeout,
|
|
223
|
+
max_retries: max_retries,
|
|
224
|
+
retry_interval: retry_interval,
|
|
225
|
+
backoff_factor: backoff_factor,
|
|
226
|
+
retry_statuses: retry_statuses,
|
|
227
|
+
retry_methods: retry_methods,
|
|
228
|
+
public_bearer_token_credentials: public_bearer_token_credentials,
|
|
229
|
+
public_basic_token_credentials: public_basic_token_credentials,
|
|
230
|
+
private_basic_token_credentials: private_basic_token_credentials,
|
|
231
|
+
client_authorization_token_credentials: client_authorization_token_credentials,
|
|
232
|
+
customer_header_credentials: customer_header_credentials,
|
|
233
|
+
proxy_settings: proxy_settings,
|
|
234
|
+
logging_configuration: logging_configuration
|
|
235
|
+
)
|
|
236
|
+
end
|
|
237
|
+
end
|
|
238
|
+
end
|
|
@@ -0,0 +1,21 @@
|
|
|
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
|
+
# Class for exceptions when there is a network error, status code error, etc.
|
|
8
|
+
class APIException < CoreLibrary::ApiException
|
|
9
|
+
# Provides a human-readable string representation of the object.
|
|
10
|
+
def to_s
|
|
11
|
+
class_name = self.class.name.split('::').last
|
|
12
|
+
"<#{class_name} status_code: #{@response_code}, reason: #{@reason}>"
|
|
13
|
+
end
|
|
14
|
+
|
|
15
|
+
# Provides a debugging-friendly string with detailed object information.
|
|
16
|
+
def inspect
|
|
17
|
+
class_name = self.class.name.split('::').last
|
|
18
|
+
"<#{class_name} status_code: #{@response_code.inspect}, reason: #{@reason.inspect}>"
|
|
19
|
+
end
|
|
20
|
+
end
|
|
21
|
+
end
|
|
@@ -0,0 +1,98 @@
|
|
|
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
|
+
# Common Error class.
|
|
8
|
+
class CommonErrorException < APIException
|
|
9
|
+
SKIP = Object.new
|
|
10
|
+
private_constant :SKIP
|
|
11
|
+
|
|
12
|
+
# custom error code for developer or user
|
|
13
|
+
# Note: One of the following values will be returned:
|
|
14
|
+
# 1000, 1001, 1002, 1003, 1004, 1005, 1006, 1007, 1009, 1010, 1011, 1012,
|
|
15
|
+
# 1014, 1015, 1016
|
|
16
|
+
# @return [Float]
|
|
17
|
+
attr_accessor :error_code
|
|
18
|
+
|
|
19
|
+
# Custom error message <br>
|
|
20
|
+
# Note: One of the following values will be returned:
|
|
21
|
+
# - Offer does not exist
|
|
22
|
+
# - Customer does not exist
|
|
23
|
+
# - Valid from date is invalid
|
|
24
|
+
# - ValidityPeriod is invalid
|
|
25
|
+
# - Offer is by default assigned to all customers, which cannot be
|
|
26
|
+
# changed.
|
|
27
|
+
# - Assignment is not allowed
|
|
28
|
+
# - Customer assign should have validity dates.
|
|
29
|
+
# - Customer assign validity start date should be before the validity end
|
|
30
|
+
# date.
|
|
31
|
+
# - Customer assign validity dates must be between the offer assignable
|
|
32
|
+
# dates.
|
|
33
|
+
# - Offer validity start date should not be in the past.
|
|
34
|
+
# - Customer already assigned to this offer.
|
|
35
|
+
# - Offer module is disabled
|
|
36
|
+
# - Partner code is not valid for this offer
|
|
37
|
+
# - Reference ID already used
|
|
38
|
+
# - Partner assignment already ended for this customer
|
|
39
|
+
# @return [String]
|
|
40
|
+
attr_accessor :message
|
|
41
|
+
|
|
42
|
+
# Custom error message <br>
|
|
43
|
+
# Note: One of the following values will be returned:
|
|
44
|
+
# - Offer does not exist
|
|
45
|
+
# - Customer does not exist
|
|
46
|
+
# - Valid from date is invalid
|
|
47
|
+
# - ValidityPeriod is invalid
|
|
48
|
+
# - Offer is by default assigned to all customers, which cannot be
|
|
49
|
+
# changed.
|
|
50
|
+
# - Assignment is not allowed
|
|
51
|
+
# - Customer assign should have validity dates.
|
|
52
|
+
# - Customer assign validity start date should be before the validity end
|
|
53
|
+
# date.
|
|
54
|
+
# - Customer assign validity dates must be between the offer assignable
|
|
55
|
+
# dates.
|
|
56
|
+
# - Offer validity start date should not be in the past.
|
|
57
|
+
# - Customer already assigned to this offer.
|
|
58
|
+
# - Offer module is disabled
|
|
59
|
+
# - Partner code is not valid for this offer
|
|
60
|
+
# - Reference ID already used
|
|
61
|
+
# - Partner assignment already ended for this customer
|
|
62
|
+
# @return [ErrorBaseContainer]
|
|
63
|
+
attr_accessor :error
|
|
64
|
+
|
|
65
|
+
# The constructor.
|
|
66
|
+
# @param [String] reason The reason for raising an exception.
|
|
67
|
+
# @param [HttpResponse] response The HttpReponse of the API call.
|
|
68
|
+
def initialize(reason, response)
|
|
69
|
+
super(reason, response)
|
|
70
|
+
hash = APIHelper.json_deserialize(@response.raw_body)
|
|
71
|
+
unbox(hash)
|
|
72
|
+
end
|
|
73
|
+
|
|
74
|
+
# Populates this object by extracting properties from a hash.
|
|
75
|
+
# @param [Hash] hash The deserialized response sent by the server in the
|
|
76
|
+
# response body.
|
|
77
|
+
def unbox(hash)
|
|
78
|
+
return nil unless hash
|
|
79
|
+
|
|
80
|
+
@error_code = hash.key?('errorCode') ? hash['errorCode'] : nil
|
|
81
|
+
@message = hash.key?('message') ? hash['message'] : nil
|
|
82
|
+
@error = ErrorBaseContainer.from_hash(hash['error']) if hash['error']
|
|
83
|
+
end
|
|
84
|
+
|
|
85
|
+
# Provides a human-readable string representation of the object.
|
|
86
|
+
def to_s
|
|
87
|
+
class_name = self.class.name.split('::').last
|
|
88
|
+
"<#{class_name} error_code: #{@error_code}, message: #{@message}, error: #{@error}>"
|
|
89
|
+
end
|
|
90
|
+
|
|
91
|
+
# Provides a debugging-friendly string with detailed object information.
|
|
92
|
+
def inspect
|
|
93
|
+
class_name = self.class.name.split('::').last
|
|
94
|
+
"<#{class_name} error_code: #{@error_code.inspect}, message: #{@message.inspect}, error:"\
|
|
95
|
+
" #{@error.inspect}>"
|
|
96
|
+
end
|
|
97
|
+
end
|
|
98
|
+
end
|
|
@@ -0,0 +1,57 @@
|
|
|
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
|
+
# Consumers Balances 400 Error class.
|
|
8
|
+
class ConsumersBalances400ErrorException < APIException
|
|
9
|
+
SKIP = Object.new
|
|
10
|
+
private_constant :SKIP
|
|
11
|
+
|
|
12
|
+
# TODO: Write general description for this method
|
|
13
|
+
# @return [Integer]
|
|
14
|
+
attr_accessor :error_code
|
|
15
|
+
|
|
16
|
+
# TODO: Write general description for this method
|
|
17
|
+
# @return [String]
|
|
18
|
+
attr_accessor :message
|
|
19
|
+
|
|
20
|
+
# TODO: Write general description for this method
|
|
21
|
+
# @return [Object]
|
|
22
|
+
attr_accessor :error
|
|
23
|
+
|
|
24
|
+
# The constructor.
|
|
25
|
+
# @param [String] reason The reason for raising an exception.
|
|
26
|
+
# @param [HttpResponse] response The HttpReponse of the API call.
|
|
27
|
+
def initialize(reason, response)
|
|
28
|
+
super(reason, response)
|
|
29
|
+
hash = APIHelper.json_deserialize(@response.raw_body)
|
|
30
|
+
unbox(hash)
|
|
31
|
+
end
|
|
32
|
+
|
|
33
|
+
# Populates this object by extracting properties from a hash.
|
|
34
|
+
# @param [Hash] hash The deserialized response sent by the server in the
|
|
35
|
+
# response body.
|
|
36
|
+
def unbox(hash)
|
|
37
|
+
return nil unless hash
|
|
38
|
+
|
|
39
|
+
@error_code = hash.key?('errorCode') ? hash['errorCode'] : nil
|
|
40
|
+
@message = hash.key?('message') ? hash['message'] : nil
|
|
41
|
+
@error = hash.key?('error') ? hash['error'] : nil
|
|
42
|
+
end
|
|
43
|
+
|
|
44
|
+
# Provides a human-readable string representation of the object.
|
|
45
|
+
def to_s
|
|
46
|
+
class_name = self.class.name.split('::').last
|
|
47
|
+
"<#{class_name} error_code: #{@error_code}, message: #{@message}, error: #{@error}>"
|
|
48
|
+
end
|
|
49
|
+
|
|
50
|
+
# Provides a debugging-friendly string with detailed object information.
|
|
51
|
+
def inspect
|
|
52
|
+
class_name = self.class.name.split('::').last
|
|
53
|
+
"<#{class_name} error_code: #{@error_code.inspect}, message: #{@message.inspect}, error:"\
|
|
54
|
+
" #{@error.inspect}>"
|
|
55
|
+
end
|
|
56
|
+
end
|
|
57
|
+
end
|
|
@@ -0,0 +1,57 @@
|
|
|
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
|
+
# Consumers Balances 401 Error class.
|
|
8
|
+
class ConsumersBalances401ErrorException < APIException
|
|
9
|
+
SKIP = Object.new
|
|
10
|
+
private_constant :SKIP
|
|
11
|
+
|
|
12
|
+
# TODO: Write general description for this method
|
|
13
|
+
# @return [Integer]
|
|
14
|
+
attr_accessor :error_code
|
|
15
|
+
|
|
16
|
+
# TODO: Write general description for this method
|
|
17
|
+
# @return [String]
|
|
18
|
+
attr_accessor :message
|
|
19
|
+
|
|
20
|
+
# TODO: Write general description for this method
|
|
21
|
+
# @return [Object]
|
|
22
|
+
attr_accessor :error
|
|
23
|
+
|
|
24
|
+
# The constructor.
|
|
25
|
+
# @param [String] reason The reason for raising an exception.
|
|
26
|
+
# @param [HttpResponse] response The HttpReponse of the API call.
|
|
27
|
+
def initialize(reason, response)
|
|
28
|
+
super(reason, response)
|
|
29
|
+
hash = APIHelper.json_deserialize(@response.raw_body)
|
|
30
|
+
unbox(hash)
|
|
31
|
+
end
|
|
32
|
+
|
|
33
|
+
# Populates this object by extracting properties from a hash.
|
|
34
|
+
# @param [Hash] hash The deserialized response sent by the server in the
|
|
35
|
+
# response body.
|
|
36
|
+
def unbox(hash)
|
|
37
|
+
return nil unless hash
|
|
38
|
+
|
|
39
|
+
@error_code = hash.key?('errorCode') ? hash['errorCode'] : nil
|
|
40
|
+
@message = hash.key?('message') ? hash['message'] : nil
|
|
41
|
+
@error = hash.key?('error') ? hash['error'] : nil
|
|
42
|
+
end
|
|
43
|
+
|
|
44
|
+
# Provides a human-readable string representation of the object.
|
|
45
|
+
def to_s
|
|
46
|
+
class_name = self.class.name.split('::').last
|
|
47
|
+
"<#{class_name} error_code: #{@error_code}, message: #{@message}, error: #{@error}>"
|
|
48
|
+
end
|
|
49
|
+
|
|
50
|
+
# Provides a debugging-friendly string with detailed object information.
|
|
51
|
+
def inspect
|
|
52
|
+
class_name = self.class.name.split('::').last
|
|
53
|
+
"<#{class_name} error_code: #{@error_code.inspect}, message: #{@message.inspect}, error:"\
|
|
54
|
+
" #{@error.inspect}>"
|
|
55
|
+
end
|
|
56
|
+
end
|
|
57
|
+
end
|
|
@@ -0,0 +1,57 @@
|
|
|
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
|
+
# Consumers Balances 404 Error class.
|
|
8
|
+
class ConsumersBalances404ErrorException < APIException
|
|
9
|
+
SKIP = Object.new
|
|
10
|
+
private_constant :SKIP
|
|
11
|
+
|
|
12
|
+
# TODO: Write general description for this method
|
|
13
|
+
# @return [Integer]
|
|
14
|
+
attr_accessor :error_code
|
|
15
|
+
|
|
16
|
+
# TODO: Write general description for this method
|
|
17
|
+
# @return [String]
|
|
18
|
+
attr_accessor :message
|
|
19
|
+
|
|
20
|
+
# TODO: Write general description for this method
|
|
21
|
+
# @return [Object]
|
|
22
|
+
attr_accessor :error
|
|
23
|
+
|
|
24
|
+
# The constructor.
|
|
25
|
+
# @param [String] reason The reason for raising an exception.
|
|
26
|
+
# @param [HttpResponse] response The HttpReponse of the API call.
|
|
27
|
+
def initialize(reason, response)
|
|
28
|
+
super(reason, response)
|
|
29
|
+
hash = APIHelper.json_deserialize(@response.raw_body)
|
|
30
|
+
unbox(hash)
|
|
31
|
+
end
|
|
32
|
+
|
|
33
|
+
# Populates this object by extracting properties from a hash.
|
|
34
|
+
# @param [Hash] hash The deserialized response sent by the server in the
|
|
35
|
+
# response body.
|
|
36
|
+
def unbox(hash)
|
|
37
|
+
return nil unless hash
|
|
38
|
+
|
|
39
|
+
@error_code = hash.key?('errorCode') ? hash['errorCode'] : nil
|
|
40
|
+
@message = hash.key?('message') ? hash['message'] : nil
|
|
41
|
+
@error = hash.key?('error') ? hash['error'] : nil
|
|
42
|
+
end
|
|
43
|
+
|
|
44
|
+
# Provides a human-readable string representation of the object.
|
|
45
|
+
def to_s
|
|
46
|
+
class_name = self.class.name.split('::').last
|
|
47
|
+
"<#{class_name} error_code: #{@error_code}, message: #{@message}, error: #{@error}>"
|
|
48
|
+
end
|
|
49
|
+
|
|
50
|
+
# Provides a debugging-friendly string with detailed object information.
|
|
51
|
+
def inspect
|
|
52
|
+
class_name = self.class.name.split('::').last
|
|
53
|
+
"<#{class_name} error_code: #{@error_code.inspect}, message: #{@message.inspect}, error:"\
|
|
54
|
+
" #{@error.inspect}>"
|
|
55
|
+
end
|
|
56
|
+
end
|
|
57
|
+
end
|
|
@@ -0,0 +1,57 @@
|
|
|
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
|
+
# Consumers Balances 422 Error class.
|
|
8
|
+
class ConsumersBalances422ErrorException < APIException
|
|
9
|
+
SKIP = Object.new
|
|
10
|
+
private_constant :SKIP
|
|
11
|
+
|
|
12
|
+
# TODO: Write general description for this method
|
|
13
|
+
# @return [Integer]
|
|
14
|
+
attr_accessor :error_code
|
|
15
|
+
|
|
16
|
+
# TODO: Write general description for this method
|
|
17
|
+
# @return [String]
|
|
18
|
+
attr_accessor :message
|
|
19
|
+
|
|
20
|
+
# TODO: Write general description for this method
|
|
21
|
+
# @return [Object]
|
|
22
|
+
attr_accessor :error
|
|
23
|
+
|
|
24
|
+
# The constructor.
|
|
25
|
+
# @param [String] reason The reason for raising an exception.
|
|
26
|
+
# @param [HttpResponse] response The HttpReponse of the API call.
|
|
27
|
+
def initialize(reason, response)
|
|
28
|
+
super(reason, response)
|
|
29
|
+
hash = APIHelper.json_deserialize(@response.raw_body)
|
|
30
|
+
unbox(hash)
|
|
31
|
+
end
|
|
32
|
+
|
|
33
|
+
# Populates this object by extracting properties from a hash.
|
|
34
|
+
# @param [Hash] hash The deserialized response sent by the server in the
|
|
35
|
+
# response body.
|
|
36
|
+
def unbox(hash)
|
|
37
|
+
return nil unless hash
|
|
38
|
+
|
|
39
|
+
@error_code = hash.key?('errorCode') ? hash['errorCode'] : nil
|
|
40
|
+
@message = hash.key?('message') ? hash['message'] : nil
|
|
41
|
+
@error = hash.key?('error') ? hash['error'] : nil
|
|
42
|
+
end
|
|
43
|
+
|
|
44
|
+
# Provides a human-readable string representation of the object.
|
|
45
|
+
def to_s
|
|
46
|
+
class_name = self.class.name.split('::').last
|
|
47
|
+
"<#{class_name} error_code: #{@error_code}, message: #{@message}, error: #{@error}>"
|
|
48
|
+
end
|
|
49
|
+
|
|
50
|
+
# Provides a debugging-friendly string with detailed object information.
|
|
51
|
+
def inspect
|
|
52
|
+
class_name = self.class.name.split('::').last
|
|
53
|
+
"<#{class_name} error_code: #{@error_code.inspect}, message: #{@message.inspect}, error:"\
|
|
54
|
+
" #{@error.inspect}>"
|
|
55
|
+
end
|
|
56
|
+
end
|
|
57
|
+
end
|
|
@@ -0,0 +1,57 @@
|
|
|
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
|
+
# Error Response class.
|
|
8
|
+
class ErrorResponseException < APIException
|
|
9
|
+
SKIP = Object.new
|
|
10
|
+
private_constant :SKIP
|
|
11
|
+
|
|
12
|
+
# HTTP error code
|
|
13
|
+
# @return [Float]
|
|
14
|
+
attr_accessor :error_code
|
|
15
|
+
|
|
16
|
+
# HTTP error status message
|
|
17
|
+
# @return [String]
|
|
18
|
+
attr_accessor :message
|
|
19
|
+
|
|
20
|
+
# HTTP error status message
|
|
21
|
+
# @return [ErrorInfo]
|
|
22
|
+
attr_accessor :error
|
|
23
|
+
|
|
24
|
+
# The constructor.
|
|
25
|
+
# @param [String] reason The reason for raising an exception.
|
|
26
|
+
# @param [HttpResponse] response The HttpReponse of the API call.
|
|
27
|
+
def initialize(reason, response)
|
|
28
|
+
super(reason, response)
|
|
29
|
+
hash = APIHelper.json_deserialize(@response.raw_body)
|
|
30
|
+
unbox(hash)
|
|
31
|
+
end
|
|
32
|
+
|
|
33
|
+
# Populates this object by extracting properties from a hash.
|
|
34
|
+
# @param [Hash] hash The deserialized response sent by the server in the
|
|
35
|
+
# response body.
|
|
36
|
+
def unbox(hash)
|
|
37
|
+
return nil unless hash
|
|
38
|
+
|
|
39
|
+
@error_code = hash.key?('errorCode') ? hash['errorCode'] : nil
|
|
40
|
+
@message = hash.key?('message') ? hash['message'] : nil
|
|
41
|
+
@error = ErrorInfo.from_hash(hash['error']) if hash['error']
|
|
42
|
+
end
|
|
43
|
+
|
|
44
|
+
# Provides a human-readable string representation of the object.
|
|
45
|
+
def to_s
|
|
46
|
+
class_name = self.class.name.split('::').last
|
|
47
|
+
"<#{class_name} error_code: #{@error_code}, message: #{@message}, error: #{@error}>"
|
|
48
|
+
end
|
|
49
|
+
|
|
50
|
+
# Provides a debugging-friendly string with detailed object information.
|
|
51
|
+
def inspect
|
|
52
|
+
class_name = self.class.name.split('::').last
|
|
53
|
+
"<#{class_name} error_code: #{@error_code.inspect}, message: #{@message.inspect}, error:"\
|
|
54
|
+
" #{@error.inspect}>"
|
|
55
|
+
end
|
|
56
|
+
end
|
|
57
|
+
end
|