feratel-check-api-client 1.0.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/Gemfile +9 -0
- data/README.md +159 -0
- data/Rakefile +10 -0
- data/docs/AgeGroup.md +22 -0
- data/docs/AgeGroupTranslation.md +20 -0
- data/docs/CheckPoint.md +38 -0
- data/docs/CheckPointGroup.md +20 -0
- data/docs/CheckPointItem.md +26 -0
- data/docs/CheckResourcesApi.md +545 -0
- data/docs/CheckResult.md +26 -0
- data/docs/CheckState.md +20 -0
- data/docs/CheckStateEnum.md +15 -0
- data/docs/CheckStateTranslation.md +20 -0
- data/docs/CheckpointError.md +22 -0
- data/docs/Customer.md +24 -0
- data/docs/History.md +18 -0
- data/docs/HistoryItem.md +24 -0
- data/docs/HistoryItemState.md +26 -0
- data/docs/Identification.md +36 -0
- data/docs/IdentificationStatus.md +15 -0
- data/docs/IdentificationType.md +26 -0
- data/docs/IdentificationUsage.md +26 -0
- data/docs/IdentificationUsageType.md +15 -0
- data/docs/Identifier.md +20 -0
- data/docs/IdentifierType.md +15 -0
- data/docs/ServiceProvider.md +24 -0
- data/docs/ServiceType.md +28 -0
- data/docs/ServiceTypeAssignment.md +22 -0
- data/docs/ServiceTypeTranslation.md +20 -0
- data/docs/ServiceUsage.md +36 -0
- data/docs/ServiceUsageType.md +15 -0
- data/docs/SystemResourcesApi.md +147 -0
- data/docs/TransactError.md +22 -0
- data/docs/TransactResult.md +34 -0
- data/docs/TransactState.md +20 -0
- data/docs/TransactStateEnum.md +15 -0
- data/docs/TransactStateTranslation.md +20 -0
- data/docs/ValidTransactionInfo.md +20 -0
- data/docs/Week.md +30 -0
- data/feratel-check-api-client.gemspec +39 -0
- data/git_push.sh +57 -0
- data/lib/feratel-check-api-client/api/check_resources_api.rb +586 -0
- data/lib/feratel-check-api-client/api/system_resources_api.rb +148 -0
- data/lib/feratel-check-api-client/api_client.rb +394 -0
- data/lib/feratel-check-api-client/api_error.rb +58 -0
- data/lib/feratel-check-api-client/configuration.rb +308 -0
- data/lib/feratel-check-api-client/models/age_group.rb +255 -0
- data/lib/feratel-check-api-client/models/age_group_translation.rb +223 -0
- data/lib/feratel-check-api-client/models/check_point.rb +327 -0
- data/lib/feratel-check-api-client/models/check_point_group.rb +244 -0
- data/lib/feratel-check-api-client/models/check_point_item.rb +271 -0
- data/lib/feratel-check-api-client/models/check_result.rb +250 -0
- data/lib/feratel-check-api-client/models/check_state.rb +247 -0
- data/lib/feratel-check-api-client/models/check_state_enum.rb +82 -0
- data/lib/feratel-check-api-client/models/check_state_translation.rb +223 -0
- data/lib/feratel-check-api-client/models/checkpoint_error.rb +256 -0
- data/lib/feratel-check-api-client/models/customer.rb +262 -0
- data/lib/feratel-check-api-client/models/history.rb +216 -0
- data/lib/feratel-check-api-client/models/history_item.rb +262 -0
- data/lib/feratel-check-api-client/models/history_item_state.rb +250 -0
- data/lib/feratel-check-api-client/models/identification.rb +338 -0
- data/lib/feratel-check-api-client/models/identification_status.rb +43 -0
- data/lib/feratel-check-api-client/models/identification_type.rb +271 -0
- data/lib/feratel-check-api-client/models/identification_usage.rb +314 -0
- data/lib/feratel-check-api-client/models/identification_usage_type.rb +42 -0
- data/lib/feratel-check-api-client/models/identifier.rb +245 -0
- data/lib/feratel-check-api-client/models/identifier_type.rb +44 -0
- data/lib/feratel-check-api-client/models/service_provider.rb +262 -0
- data/lib/feratel-check-api-client/models/service_type.rb +282 -0
- data/lib/feratel-check-api-client/models/service_type_assignment.rb +253 -0
- data/lib/feratel-check-api-client/models/service_type_translation.rb +223 -0
- data/lib/feratel-check-api-client/models/service_usage.rb +380 -0
- data/lib/feratel-check-api-client/models/service_usage_type.rb +50 -0
- data/lib/feratel-check-api-client/models/transact_error.rb +256 -0
- data/lib/feratel-check-api-client/models/transact_result.rb +349 -0
- data/lib/feratel-check-api-client/models/transact_state.rb +247 -0
- data/lib/feratel-check-api-client/models/transact_state_enum.rb +54 -0
- data/lib/feratel-check-api-client/models/transact_state_translation.rb +223 -0
- data/lib/feratel-check-api-client/models/valid_transaction_info.rb +223 -0
- data/lib/feratel-check-api-client/models/week.rb +268 -0
- data/lib/feratel-check-api-client/version.rb +15 -0
- data/lib/feratel-check-api-client.rb +75 -0
- data/spec/api/check_resources_api_spec.rb +137 -0
- data/spec/api/system_resources_api_spec.rb +59 -0
- data/spec/models/age_group_spec.rb +48 -0
- data/spec/models/age_group_translation_spec.rb +42 -0
- data/spec/models/check_point_group_spec.rb +42 -0
- data/spec/models/check_point_item_spec.rb +60 -0
- data/spec/models/check_point_spec.rb +96 -0
- data/spec/models/check_result_spec.rb +60 -0
- data/spec/models/check_state_enum_spec.rb +30 -0
- data/spec/models/check_state_spec.rb +42 -0
- data/spec/models/check_state_translation_spec.rb +42 -0
- data/spec/models/checkpoint_error_spec.rb +48 -0
- data/spec/models/customer_spec.rb +54 -0
- data/spec/models/history_item_spec.rb +54 -0
- data/spec/models/history_item_state_spec.rb +60 -0
- data/spec/models/history_spec.rb +36 -0
- data/spec/models/identification_spec.rb +90 -0
- data/spec/models/identification_status_spec.rb +30 -0
- data/spec/models/identification_type_spec.rb +60 -0
- data/spec/models/identification_usage_spec.rb +60 -0
- data/spec/models/identification_usage_type_spec.rb +30 -0
- data/spec/models/identifier_spec.rb +42 -0
- data/spec/models/identifier_type_spec.rb +30 -0
- data/spec/models/service_provider_spec.rb +54 -0
- data/spec/models/service_type_assignment_spec.rb +48 -0
- data/spec/models/service_type_spec.rb +66 -0
- data/spec/models/service_type_translation_spec.rb +42 -0
- data/spec/models/service_usage_spec.rb +90 -0
- data/spec/models/service_usage_type_spec.rb +30 -0
- data/spec/models/transact_error_spec.rb +48 -0
- data/spec/models/transact_result_spec.rb +84 -0
- data/spec/models/transact_state_enum_spec.rb +30 -0
- data/spec/models/transact_state_spec.rb +42 -0
- data/spec/models/transact_state_translation_spec.rb +42 -0
- data/spec/models/valid_transaction_info_spec.rb +42 -0
- data/spec/models/week_spec.rb +72 -0
- data/spec/spec_helper.rb +111 -0
- metadata +255 -0
@@ -0,0 +1,308 @@
|
|
1
|
+
=begin
|
2
|
+
#CheckAPI Standard
|
3
|
+
|
4
|
+
#This documentation describes your available CheckAPI REST services: Get your checkpoints and their details, check the permission of a customer's ID, take a look at your checkpoint's history - everything a checkpoint needs can be found here in one place. Please look at the descriptions in each service below. <div id=\"authorize-information-wrap\"><h1>Authorize</h1><p>You can use this automated authentication to try out your activated methods - just click „Authorize“, enter CardAPI credentials and have a try! You received the CardAPI username and password via e-mail – credentials are different from your developer-portal credentials. Authentication is based on OAUTH2 (implicit grant flow) and needs to be implemented and called prior to using any API method. <b>CLIENT_ID</b><br>The client ID is pre-filled automatically according to the chosen application. You can find your available client IDs in the \"Applications\" - Area. <b>GRANT_TYPE</b><br>With grant_type=password you get an access-token and a refresh-token for your request. The received access token can be used for 10 minutes, there are two ways to renew it. Either you can send the same request again or you can use the grant_type=refresh_token. The refresh token needs to be used every 30 minutes and can provide new access tokens for 10 hours without using your credentials.</p></div>
|
5
|
+
|
6
|
+
The version of the OpenAPI document: 1.17.0
|
7
|
+
|
8
|
+
Generated by: https://openapi-generator.tech
|
9
|
+
Generator version: 7.8.0
|
10
|
+
|
11
|
+
=end
|
12
|
+
|
13
|
+
module FeratelCheckApiClient
|
14
|
+
class Configuration
|
15
|
+
# Defines url scheme
|
16
|
+
attr_accessor :scheme
|
17
|
+
|
18
|
+
# Defines url host
|
19
|
+
attr_accessor :host
|
20
|
+
|
21
|
+
# Defines url base path
|
22
|
+
attr_accessor :base_path
|
23
|
+
|
24
|
+
# Define server configuration index
|
25
|
+
attr_accessor :server_index
|
26
|
+
|
27
|
+
# Define server operation configuration index
|
28
|
+
attr_accessor :server_operation_index
|
29
|
+
|
30
|
+
# Default server variables
|
31
|
+
attr_accessor :server_variables
|
32
|
+
|
33
|
+
# Default server operation variables
|
34
|
+
attr_accessor :server_operation_variables
|
35
|
+
|
36
|
+
# Defines API keys used with API Key authentications.
|
37
|
+
#
|
38
|
+
# @return [Hash] key: parameter name, value: parameter value (API key)
|
39
|
+
#
|
40
|
+
# @example parameter name is "api_key", API key is "xxx" (e.g. "api_key=xxx" in query string)
|
41
|
+
# config.api_key['api_key'] = 'xxx'
|
42
|
+
attr_accessor :api_key
|
43
|
+
|
44
|
+
# Defines API key prefixes used with API Key authentications.
|
45
|
+
#
|
46
|
+
# @return [Hash] key: parameter name, value: API key prefix
|
47
|
+
#
|
48
|
+
# @example parameter name is "Authorization", API key prefix is "Token" (e.g. "Authorization: Token xxx" in headers)
|
49
|
+
# config.api_key_prefix['api_key'] = 'Token'
|
50
|
+
attr_accessor :api_key_prefix
|
51
|
+
|
52
|
+
# Defines the username used with HTTP basic authentication.
|
53
|
+
#
|
54
|
+
# @return [String]
|
55
|
+
attr_accessor :username
|
56
|
+
|
57
|
+
# Defines the password used with HTTP basic authentication.
|
58
|
+
#
|
59
|
+
# @return [String]
|
60
|
+
attr_accessor :password
|
61
|
+
|
62
|
+
# Defines the access token (Bearer) used with OAuth2.
|
63
|
+
attr_accessor :access_token
|
64
|
+
|
65
|
+
# Defines a Proc used to fetch or refresh access tokens (Bearer) used with OAuth2.
|
66
|
+
# Overrides the access_token if set
|
67
|
+
# @return [Proc]
|
68
|
+
attr_accessor :access_token_getter
|
69
|
+
|
70
|
+
# Set this to return data as binary instead of downloading a temp file. When enabled (set to true)
|
71
|
+
# HTTP responses with return type `File` will be returned as a stream of binary data.
|
72
|
+
# Default to false.
|
73
|
+
attr_accessor :return_binary_data
|
74
|
+
|
75
|
+
# Set this to enable/disable debugging. When enabled (set to true), HTTP request/response
|
76
|
+
# details will be logged with `logger.debug` (see the `logger` attribute).
|
77
|
+
# Default to false.
|
78
|
+
#
|
79
|
+
# @return [true, false]
|
80
|
+
attr_accessor :debugging
|
81
|
+
|
82
|
+
# Set this to ignore operation servers for the API client. This is useful when you need to
|
83
|
+
# send requests to a different server than the one specified in the OpenAPI document.
|
84
|
+
# Will default to the base url defined in the spec but can be overridden by setting
|
85
|
+
# `scheme`, `host`, `base_path` directly.
|
86
|
+
# Default to false.
|
87
|
+
# @return [true, false]
|
88
|
+
attr_accessor :ignore_operation_servers
|
89
|
+
|
90
|
+
# Defines the logger used for debugging.
|
91
|
+
# Default to `Rails.logger` (when in Rails) or logging to STDOUT.
|
92
|
+
#
|
93
|
+
# @return [#debug]
|
94
|
+
attr_accessor :logger
|
95
|
+
|
96
|
+
# Defines the temporary folder to store downloaded files
|
97
|
+
# (for API endpoints that have file response).
|
98
|
+
# Default to use `Tempfile`.
|
99
|
+
#
|
100
|
+
# @return [String]
|
101
|
+
attr_accessor :temp_folder_path
|
102
|
+
|
103
|
+
# The time limit for HTTP request in seconds.
|
104
|
+
# Default to 0 (never times out).
|
105
|
+
attr_accessor :timeout
|
106
|
+
|
107
|
+
# Set this to false to skip client side validation in the operation.
|
108
|
+
# Default to true.
|
109
|
+
# @return [true, false]
|
110
|
+
attr_accessor :client_side_validation
|
111
|
+
|
112
|
+
### TLS/SSL setting
|
113
|
+
# Set this to false to skip verifying SSL certificate when calling API from https server.
|
114
|
+
# Default to true.
|
115
|
+
#
|
116
|
+
# @note Do NOT set it to false in production code, otherwise you would face multiple types of cryptographic attacks.
|
117
|
+
#
|
118
|
+
# @return [true, false]
|
119
|
+
attr_accessor :verify_ssl
|
120
|
+
|
121
|
+
### TLS/SSL setting
|
122
|
+
# Set this to false to skip verifying SSL host name
|
123
|
+
# Default to true.
|
124
|
+
#
|
125
|
+
# @note Do NOT set it to false in production code, otherwise you would face multiple types of cryptographic attacks.
|
126
|
+
#
|
127
|
+
# @return [true, false]
|
128
|
+
attr_accessor :verify_ssl_host
|
129
|
+
|
130
|
+
### TLS/SSL setting
|
131
|
+
# Set this to customize the certificate file to verify the peer.
|
132
|
+
#
|
133
|
+
# @return [String] the path to the certificate file
|
134
|
+
#
|
135
|
+
# @see The `cainfo` option of Typhoeus, `--cert` option of libcurl. Related source code:
|
136
|
+
# https://github.com/typhoeus/typhoeus/blob/master/lib/typhoeus/easy_factory.rb#L145
|
137
|
+
attr_accessor :ssl_ca_cert
|
138
|
+
|
139
|
+
### TLS/SSL setting
|
140
|
+
# Client certificate file (for client certificate)
|
141
|
+
attr_accessor :cert_file
|
142
|
+
|
143
|
+
### TLS/SSL setting
|
144
|
+
# Client private key file (for client certificate)
|
145
|
+
attr_accessor :key_file
|
146
|
+
|
147
|
+
# Set this to customize parameters encoding of array parameter with multi collectionFormat.
|
148
|
+
# Default to nil.
|
149
|
+
#
|
150
|
+
# @see The params_encoding option of Ethon. Related source code:
|
151
|
+
# https://github.com/typhoeus/ethon/blob/master/lib/ethon/easy/queryable.rb#L96
|
152
|
+
attr_accessor :params_encoding
|
153
|
+
|
154
|
+
|
155
|
+
attr_accessor :inject_format
|
156
|
+
|
157
|
+
attr_accessor :force_ending_format
|
158
|
+
|
159
|
+
def initialize
|
160
|
+
@scheme = 'http'
|
161
|
+
@host = 'localhost'
|
162
|
+
@base_path = ''
|
163
|
+
@server_index = nil
|
164
|
+
@server_operation_index = {}
|
165
|
+
@server_variables = {}
|
166
|
+
@server_operation_variables = {}
|
167
|
+
@api_key = {}
|
168
|
+
@api_key_prefix = {}
|
169
|
+
@client_side_validation = true
|
170
|
+
@verify_ssl = true
|
171
|
+
@verify_ssl_host = true
|
172
|
+
@cert_file = nil
|
173
|
+
@key_file = nil
|
174
|
+
@timeout = 0
|
175
|
+
@params_encoding = nil
|
176
|
+
@debugging = false
|
177
|
+
@ignore_operation_servers = false
|
178
|
+
@inject_format = false
|
179
|
+
@force_ending_format = false
|
180
|
+
@logger = defined?(Rails) ? Rails.logger : Logger.new(STDOUT)
|
181
|
+
|
182
|
+
yield(self) if block_given?
|
183
|
+
end
|
184
|
+
|
185
|
+
# The default Configuration object.
|
186
|
+
def self.default
|
187
|
+
@@default ||= Configuration.new
|
188
|
+
end
|
189
|
+
|
190
|
+
def configure
|
191
|
+
yield(self) if block_given?
|
192
|
+
end
|
193
|
+
|
194
|
+
def scheme=(scheme)
|
195
|
+
# remove :// from scheme
|
196
|
+
@scheme = scheme.sub(/:\/\//, '')
|
197
|
+
end
|
198
|
+
|
199
|
+
def host=(host)
|
200
|
+
# remove http(s):// and anything after a slash
|
201
|
+
@host = host.sub(/https?:\/\//, '').split('/').first
|
202
|
+
end
|
203
|
+
|
204
|
+
def base_path=(base_path)
|
205
|
+
# Add leading and trailing slashes to base_path
|
206
|
+
@base_path = "/#{base_path}".gsub(/\/+/, '/')
|
207
|
+
@base_path = '' if @base_path == '/'
|
208
|
+
end
|
209
|
+
|
210
|
+
# Returns base URL for specified operation based on server settings
|
211
|
+
def base_url(operation = nil)
|
212
|
+
return "#{scheme}://#{[host, base_path].join('/').gsub(/\/+/, '/')}".sub(/\/+\z/, '') if ignore_operation_servers
|
213
|
+
if operation_server_settings.key?(operation) then
|
214
|
+
index = server_operation_index.fetch(operation, server_index)
|
215
|
+
server_url(index.nil? ? 0 : index, server_operation_variables.fetch(operation, server_variables), operation_server_settings[operation])
|
216
|
+
else
|
217
|
+
server_index.nil? ? "#{scheme}://#{[host, base_path].join('/').gsub(/\/+/, '/')}".sub(/\/+\z/, '') : server_url(server_index, server_variables, nil)
|
218
|
+
end
|
219
|
+
end
|
220
|
+
|
221
|
+
# Gets API key (with prefix if set).
|
222
|
+
# @param [String] param_name the parameter name of API key auth
|
223
|
+
def api_key_with_prefix(param_name, param_alias = nil)
|
224
|
+
key = @api_key[param_name]
|
225
|
+
key = @api_key.fetch(param_alias, key) unless param_alias.nil?
|
226
|
+
if @api_key_prefix[param_name]
|
227
|
+
"#{@api_key_prefix[param_name]} #{key}"
|
228
|
+
else
|
229
|
+
key
|
230
|
+
end
|
231
|
+
end
|
232
|
+
|
233
|
+
# Gets access_token using access_token_getter or uses the static access_token
|
234
|
+
def access_token_with_refresh
|
235
|
+
return access_token if access_token_getter.nil?
|
236
|
+
access_token_getter.call
|
237
|
+
end
|
238
|
+
|
239
|
+
# Gets Basic Auth token string
|
240
|
+
def basic_auth_token
|
241
|
+
'Basic ' + ["#{username}:#{password}"].pack('m').delete("\r\n")
|
242
|
+
end
|
243
|
+
|
244
|
+
# Returns Auth Settings hash for api client.
|
245
|
+
def auth_settings
|
246
|
+
{
|
247
|
+
'oauth' =>
|
248
|
+
{
|
249
|
+
type: 'oauth2',
|
250
|
+
in: 'header',
|
251
|
+
key: 'Authorization',
|
252
|
+
value: "Bearer #{access_token_with_refresh}"
|
253
|
+
},
|
254
|
+
}
|
255
|
+
end
|
256
|
+
|
257
|
+
# Returns an array of Server setting
|
258
|
+
def server_settings
|
259
|
+
[
|
260
|
+
{
|
261
|
+
url: "",
|
262
|
+
description: "No description provided",
|
263
|
+
}
|
264
|
+
]
|
265
|
+
end
|
266
|
+
|
267
|
+
def operation_server_settings
|
268
|
+
{
|
269
|
+
}
|
270
|
+
end
|
271
|
+
|
272
|
+
# Returns URL based on server settings
|
273
|
+
#
|
274
|
+
# @param index array index of the server settings
|
275
|
+
# @param variables hash of variable and the corresponding value
|
276
|
+
def server_url(index, variables = {}, servers = nil)
|
277
|
+
servers = server_settings if servers == nil
|
278
|
+
|
279
|
+
# check array index out of bound
|
280
|
+
if (index.nil? || index < 0 || index >= servers.size)
|
281
|
+
fail ArgumentError, "Invalid index #{index} when selecting the server. Must not be nil and must be less than #{servers.size}"
|
282
|
+
end
|
283
|
+
|
284
|
+
server = servers[index]
|
285
|
+
url = server[:url]
|
286
|
+
|
287
|
+
return url unless server.key? :variables
|
288
|
+
|
289
|
+
# go through variable and assign a value
|
290
|
+
server[:variables].each do |name, variable|
|
291
|
+
if variables.key?(name)
|
292
|
+
if (!server[:variables][name].key?(:enum_values) || server[:variables][name][:enum_values].include?(variables[name]))
|
293
|
+
url.gsub! "{" + name.to_s + "}", variables[name]
|
294
|
+
else
|
295
|
+
fail ArgumentError, "The variable `#{name}` in the server URL has invalid value #{variables[name]}. Must be #{server[:variables][name][:enum_values]}."
|
296
|
+
end
|
297
|
+
else
|
298
|
+
# use default value
|
299
|
+
url.gsub! "{" + name.to_s + "}", server[:variables][name][:default_value]
|
300
|
+
end
|
301
|
+
end
|
302
|
+
|
303
|
+
url
|
304
|
+
end
|
305
|
+
|
306
|
+
|
307
|
+
end
|
308
|
+
end
|
@@ -0,0 +1,255 @@
|
|
1
|
+
=begin
|
2
|
+
#CheckAPI Standard
|
3
|
+
|
4
|
+
#This documentation describes your available CheckAPI REST services: Get your checkpoints and their details, check the permission of a customer's ID, take a look at your checkpoint's history - everything a checkpoint needs can be found here in one place. Please look at the descriptions in each service below. <div id=\"authorize-information-wrap\"><h1>Authorize</h1><p>You can use this automated authentication to try out your activated methods - just click „Authorize“, enter CardAPI credentials and have a try! You received the CardAPI username and password via e-mail – credentials are different from your developer-portal credentials. Authentication is based on OAUTH2 (implicit grant flow) and needs to be implemented and called prior to using any API method. <b>CLIENT_ID</b><br>The client ID is pre-filled automatically according to the chosen application. You can find your available client IDs in the \"Applications\" - Area. <b>GRANT_TYPE</b><br>With grant_type=password you get an access-token and a refresh-token for your request. The received access token can be used for 10 minutes, there are two ways to renew it. Either you can send the same request again or you can use the grant_type=refresh_token. The refresh token needs to be used every 30 minutes and can provide new access tokens for 10 hours without using your credentials.</p></div>
|
5
|
+
|
6
|
+
The version of the OpenAPI document: 1.17.0
|
7
|
+
|
8
|
+
Generated by: https://openapi-generator.tech
|
9
|
+
Generator version: 7.8.0
|
10
|
+
|
11
|
+
=end
|
12
|
+
|
13
|
+
require 'date'
|
14
|
+
require 'time'
|
15
|
+
|
16
|
+
module FeratelCheckApiClient
|
17
|
+
class AgeGroup
|
18
|
+
attr_accessor :id
|
19
|
+
|
20
|
+
attr_accessor :name
|
21
|
+
|
22
|
+
attr_accessor :translations
|
23
|
+
|
24
|
+
# Attribute mapping from ruby-style variable name to JSON key.
|
25
|
+
def self.attribute_map
|
26
|
+
{
|
27
|
+
:'id' => :'id',
|
28
|
+
:'name' => :'name',
|
29
|
+
:'translations' => :'translations'
|
30
|
+
}
|
31
|
+
end
|
32
|
+
|
33
|
+
# Returns all the JSON keys this model knows about
|
34
|
+
def self.acceptable_attributes
|
35
|
+
attribute_map.values
|
36
|
+
end
|
37
|
+
|
38
|
+
# Attribute type mapping.
|
39
|
+
def self.openapi_types
|
40
|
+
{
|
41
|
+
:'id' => :'String',
|
42
|
+
:'name' => :'String',
|
43
|
+
:'translations' => :'Array<AgeGroupTranslation>'
|
44
|
+
}
|
45
|
+
end
|
46
|
+
|
47
|
+
# List of attributes with nullable: true
|
48
|
+
def self.openapi_nullable
|
49
|
+
Set.new([
|
50
|
+
])
|
51
|
+
end
|
52
|
+
|
53
|
+
# Initializes the object
|
54
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
55
|
+
def initialize(attributes = {})
|
56
|
+
if (!attributes.is_a?(Hash))
|
57
|
+
fail ArgumentError, "The input argument (attributes) must be a hash in `FeratelCheckApiClient::AgeGroup` initialize method"
|
58
|
+
end
|
59
|
+
|
60
|
+
# check to see if the attribute exists and convert string to symbol for hash key
|
61
|
+
attributes = attributes.each_with_object({}) { |(k, v), h|
|
62
|
+
if (!self.class.attribute_map.key?(k.to_sym))
|
63
|
+
fail ArgumentError, "`#{k}` is not a valid attribute in `FeratelCheckApiClient::AgeGroup`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
|
64
|
+
end
|
65
|
+
h[k.to_sym] = v
|
66
|
+
}
|
67
|
+
|
68
|
+
if attributes.key?(:'id')
|
69
|
+
self.id = attributes[:'id']
|
70
|
+
end
|
71
|
+
|
72
|
+
if attributes.key?(:'name')
|
73
|
+
self.name = attributes[:'name']
|
74
|
+
end
|
75
|
+
|
76
|
+
if attributes.key?(:'translations')
|
77
|
+
if (value = attributes[:'translations']).is_a?(Array)
|
78
|
+
self.translations = value
|
79
|
+
end
|
80
|
+
end
|
81
|
+
end
|
82
|
+
|
83
|
+
# Show invalid properties with the reasons. Usually used together with valid?
|
84
|
+
# @return Array for valid properties with the reasons
|
85
|
+
def list_invalid_properties
|
86
|
+
warn '[DEPRECATED] the `list_invalid_properties` method is obsolete'
|
87
|
+
invalid_properties = Array.new
|
88
|
+
pattern = Regexp.new(/[a-fA-F0-9]{8}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{12}/)
|
89
|
+
if !@id.nil? && @id !~ pattern
|
90
|
+
invalid_properties.push("invalid value for \"id\", must conform to the pattern #{pattern}.")
|
91
|
+
end
|
92
|
+
|
93
|
+
invalid_properties
|
94
|
+
end
|
95
|
+
|
96
|
+
# Check to see if the all the properties in the model are valid
|
97
|
+
# @return true if the model is valid
|
98
|
+
def valid?
|
99
|
+
warn '[DEPRECATED] the `valid?` method is obsolete'
|
100
|
+
return false if !@id.nil? && @id !~ Regexp.new(/[a-fA-F0-9]{8}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{12}/)
|
101
|
+
true
|
102
|
+
end
|
103
|
+
|
104
|
+
# Custom attribute writer method with validation
|
105
|
+
# @param [Object] id Value to be assigned
|
106
|
+
def id=(id)
|
107
|
+
if id.nil?
|
108
|
+
fail ArgumentError, 'id cannot be nil'
|
109
|
+
end
|
110
|
+
|
111
|
+
pattern = Regexp.new(/[a-fA-F0-9]{8}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{12}/)
|
112
|
+
if id !~ pattern
|
113
|
+
fail ArgumentError, "invalid value for \"id\", must conform to the pattern #{pattern}."
|
114
|
+
end
|
115
|
+
|
116
|
+
@id = id
|
117
|
+
end
|
118
|
+
|
119
|
+
# Checks equality by comparing each attribute.
|
120
|
+
# @param [Object] Object to be compared
|
121
|
+
def ==(o)
|
122
|
+
return true if self.equal?(o)
|
123
|
+
self.class == o.class &&
|
124
|
+
id == o.id &&
|
125
|
+
name == o.name &&
|
126
|
+
translations == o.translations
|
127
|
+
end
|
128
|
+
|
129
|
+
# @see the `==` method
|
130
|
+
# @param [Object] Object to be compared
|
131
|
+
def eql?(o)
|
132
|
+
self == o
|
133
|
+
end
|
134
|
+
|
135
|
+
# Calculates hash code according to all attributes.
|
136
|
+
# @return [Integer] Hash code
|
137
|
+
def hash
|
138
|
+
[id, name, translations].hash
|
139
|
+
end
|
140
|
+
|
141
|
+
# Builds the object from hash
|
142
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
143
|
+
# @return [Object] Returns the model itself
|
144
|
+
def self.build_from_hash(attributes)
|
145
|
+
return nil unless attributes.is_a?(Hash)
|
146
|
+
attributes = attributes.transform_keys(&:to_sym)
|
147
|
+
transformed_hash = {}
|
148
|
+
openapi_types.each_pair do |key, type|
|
149
|
+
if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil?
|
150
|
+
transformed_hash["#{key}"] = nil
|
151
|
+
elsif type =~ /\AArray<(.*)>/i
|
152
|
+
# check to ensure the input is an array given that the attribute
|
153
|
+
# is documented as an array but the input is not
|
154
|
+
if attributes[attribute_map[key]].is_a?(Array)
|
155
|
+
transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) }
|
156
|
+
end
|
157
|
+
elsif !attributes[attribute_map[key]].nil?
|
158
|
+
transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]])
|
159
|
+
end
|
160
|
+
end
|
161
|
+
new(transformed_hash)
|
162
|
+
end
|
163
|
+
|
164
|
+
# Deserializes the data based on type
|
165
|
+
# @param string type Data type
|
166
|
+
# @param string value Value to be deserialized
|
167
|
+
# @return [Object] Deserialized data
|
168
|
+
def self._deserialize(type, value)
|
169
|
+
case type.to_sym
|
170
|
+
when :Time
|
171
|
+
Time.parse(value)
|
172
|
+
when :Date
|
173
|
+
Date.parse(value)
|
174
|
+
when :String
|
175
|
+
value.to_s
|
176
|
+
when :Integer
|
177
|
+
value.to_i
|
178
|
+
when :Float
|
179
|
+
value.to_f
|
180
|
+
when :Boolean
|
181
|
+
if value.to_s =~ /\A(true|t|yes|y|1)\z/i
|
182
|
+
true
|
183
|
+
else
|
184
|
+
false
|
185
|
+
end
|
186
|
+
when :Object
|
187
|
+
# generic object (usually a Hash), return directly
|
188
|
+
value
|
189
|
+
when /\AArray<(?<inner_type>.+)>\z/
|
190
|
+
inner_type = Regexp.last_match[:inner_type]
|
191
|
+
value.map { |v| _deserialize(inner_type, v) }
|
192
|
+
when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
|
193
|
+
k_type = Regexp.last_match[:k_type]
|
194
|
+
v_type = Regexp.last_match[:v_type]
|
195
|
+
{}.tap do |hash|
|
196
|
+
value.each do |k, v|
|
197
|
+
hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
|
198
|
+
end
|
199
|
+
end
|
200
|
+
else # model
|
201
|
+
# models (e.g. Pet) or oneOf
|
202
|
+
klass = FeratelCheckApiClient.const_get(type)
|
203
|
+
klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
|
204
|
+
end
|
205
|
+
end
|
206
|
+
|
207
|
+
# Returns the string representation of the object
|
208
|
+
# @return [String] String presentation of the object
|
209
|
+
def to_s
|
210
|
+
to_hash.to_s
|
211
|
+
end
|
212
|
+
|
213
|
+
# to_body is an alias to to_hash (backward compatibility)
|
214
|
+
# @return [Hash] Returns the object in the form of hash
|
215
|
+
def to_body
|
216
|
+
to_hash
|
217
|
+
end
|
218
|
+
|
219
|
+
# Returns the object in the form of hash
|
220
|
+
# @return [Hash] Returns the object in the form of hash
|
221
|
+
def to_hash
|
222
|
+
hash = {}
|
223
|
+
self.class.attribute_map.each_pair do |attr, param|
|
224
|
+
value = self.send(attr)
|
225
|
+
if value.nil?
|
226
|
+
is_nullable = self.class.openapi_nullable.include?(attr)
|
227
|
+
next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
|
228
|
+
end
|
229
|
+
|
230
|
+
hash[param] = _to_hash(value)
|
231
|
+
end
|
232
|
+
hash
|
233
|
+
end
|
234
|
+
|
235
|
+
# Outputs non-array value in the form of hash
|
236
|
+
# For object, use to_hash. Otherwise, just return the value
|
237
|
+
# @param [Object] value Any valid value
|
238
|
+
# @return [Hash] Returns the value in the form of hash
|
239
|
+
def _to_hash(value)
|
240
|
+
if value.is_a?(Array)
|
241
|
+
value.compact.map { |v| _to_hash(v) }
|
242
|
+
elsif value.is_a?(Hash)
|
243
|
+
{}.tap do |hash|
|
244
|
+
value.each { |k, v| hash[k] = _to_hash(v) }
|
245
|
+
end
|
246
|
+
elsif value.respond_to? :to_hash
|
247
|
+
value.to_hash
|
248
|
+
else
|
249
|
+
value
|
250
|
+
end
|
251
|
+
end
|
252
|
+
|
253
|
+
end
|
254
|
+
|
255
|
+
end
|