feratel-check-api-client 1.0.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (121) hide show
  1. checksums.yaml +7 -0
  2. data/Gemfile +9 -0
  3. data/README.md +159 -0
  4. data/Rakefile +10 -0
  5. data/docs/AgeGroup.md +22 -0
  6. data/docs/AgeGroupTranslation.md +20 -0
  7. data/docs/CheckPoint.md +38 -0
  8. data/docs/CheckPointGroup.md +20 -0
  9. data/docs/CheckPointItem.md +26 -0
  10. data/docs/CheckResourcesApi.md +545 -0
  11. data/docs/CheckResult.md +26 -0
  12. data/docs/CheckState.md +20 -0
  13. data/docs/CheckStateEnum.md +15 -0
  14. data/docs/CheckStateTranslation.md +20 -0
  15. data/docs/CheckpointError.md +22 -0
  16. data/docs/Customer.md +24 -0
  17. data/docs/History.md +18 -0
  18. data/docs/HistoryItem.md +24 -0
  19. data/docs/HistoryItemState.md +26 -0
  20. data/docs/Identification.md +36 -0
  21. data/docs/IdentificationStatus.md +15 -0
  22. data/docs/IdentificationType.md +26 -0
  23. data/docs/IdentificationUsage.md +26 -0
  24. data/docs/IdentificationUsageType.md +15 -0
  25. data/docs/Identifier.md +20 -0
  26. data/docs/IdentifierType.md +15 -0
  27. data/docs/ServiceProvider.md +24 -0
  28. data/docs/ServiceType.md +28 -0
  29. data/docs/ServiceTypeAssignment.md +22 -0
  30. data/docs/ServiceTypeTranslation.md +20 -0
  31. data/docs/ServiceUsage.md +36 -0
  32. data/docs/ServiceUsageType.md +15 -0
  33. data/docs/SystemResourcesApi.md +147 -0
  34. data/docs/TransactError.md +22 -0
  35. data/docs/TransactResult.md +34 -0
  36. data/docs/TransactState.md +20 -0
  37. data/docs/TransactStateEnum.md +15 -0
  38. data/docs/TransactStateTranslation.md +20 -0
  39. data/docs/ValidTransactionInfo.md +20 -0
  40. data/docs/Week.md +30 -0
  41. data/feratel-check-api-client.gemspec +39 -0
  42. data/git_push.sh +57 -0
  43. data/lib/feratel-check-api-client/api/check_resources_api.rb +586 -0
  44. data/lib/feratel-check-api-client/api/system_resources_api.rb +148 -0
  45. data/lib/feratel-check-api-client/api_client.rb +394 -0
  46. data/lib/feratel-check-api-client/api_error.rb +58 -0
  47. data/lib/feratel-check-api-client/configuration.rb +308 -0
  48. data/lib/feratel-check-api-client/models/age_group.rb +255 -0
  49. data/lib/feratel-check-api-client/models/age_group_translation.rb +223 -0
  50. data/lib/feratel-check-api-client/models/check_point.rb +327 -0
  51. data/lib/feratel-check-api-client/models/check_point_group.rb +244 -0
  52. data/lib/feratel-check-api-client/models/check_point_item.rb +271 -0
  53. data/lib/feratel-check-api-client/models/check_result.rb +250 -0
  54. data/lib/feratel-check-api-client/models/check_state.rb +247 -0
  55. data/lib/feratel-check-api-client/models/check_state_enum.rb +82 -0
  56. data/lib/feratel-check-api-client/models/check_state_translation.rb +223 -0
  57. data/lib/feratel-check-api-client/models/checkpoint_error.rb +256 -0
  58. data/lib/feratel-check-api-client/models/customer.rb +262 -0
  59. data/lib/feratel-check-api-client/models/history.rb +216 -0
  60. data/lib/feratel-check-api-client/models/history_item.rb +262 -0
  61. data/lib/feratel-check-api-client/models/history_item_state.rb +250 -0
  62. data/lib/feratel-check-api-client/models/identification.rb +338 -0
  63. data/lib/feratel-check-api-client/models/identification_status.rb +43 -0
  64. data/lib/feratel-check-api-client/models/identification_type.rb +271 -0
  65. data/lib/feratel-check-api-client/models/identification_usage.rb +314 -0
  66. data/lib/feratel-check-api-client/models/identification_usage_type.rb +42 -0
  67. data/lib/feratel-check-api-client/models/identifier.rb +245 -0
  68. data/lib/feratel-check-api-client/models/identifier_type.rb +44 -0
  69. data/lib/feratel-check-api-client/models/service_provider.rb +262 -0
  70. data/lib/feratel-check-api-client/models/service_type.rb +282 -0
  71. data/lib/feratel-check-api-client/models/service_type_assignment.rb +253 -0
  72. data/lib/feratel-check-api-client/models/service_type_translation.rb +223 -0
  73. data/lib/feratel-check-api-client/models/service_usage.rb +380 -0
  74. data/lib/feratel-check-api-client/models/service_usage_type.rb +50 -0
  75. data/lib/feratel-check-api-client/models/transact_error.rb +256 -0
  76. data/lib/feratel-check-api-client/models/transact_result.rb +349 -0
  77. data/lib/feratel-check-api-client/models/transact_state.rb +247 -0
  78. data/lib/feratel-check-api-client/models/transact_state_enum.rb +54 -0
  79. data/lib/feratel-check-api-client/models/transact_state_translation.rb +223 -0
  80. data/lib/feratel-check-api-client/models/valid_transaction_info.rb +223 -0
  81. data/lib/feratel-check-api-client/models/week.rb +268 -0
  82. data/lib/feratel-check-api-client/version.rb +15 -0
  83. data/lib/feratel-check-api-client.rb +75 -0
  84. data/spec/api/check_resources_api_spec.rb +137 -0
  85. data/spec/api/system_resources_api_spec.rb +59 -0
  86. data/spec/models/age_group_spec.rb +48 -0
  87. data/spec/models/age_group_translation_spec.rb +42 -0
  88. data/spec/models/check_point_group_spec.rb +42 -0
  89. data/spec/models/check_point_item_spec.rb +60 -0
  90. data/spec/models/check_point_spec.rb +96 -0
  91. data/spec/models/check_result_spec.rb +60 -0
  92. data/spec/models/check_state_enum_spec.rb +30 -0
  93. data/spec/models/check_state_spec.rb +42 -0
  94. data/spec/models/check_state_translation_spec.rb +42 -0
  95. data/spec/models/checkpoint_error_spec.rb +48 -0
  96. data/spec/models/customer_spec.rb +54 -0
  97. data/spec/models/history_item_spec.rb +54 -0
  98. data/spec/models/history_item_state_spec.rb +60 -0
  99. data/spec/models/history_spec.rb +36 -0
  100. data/spec/models/identification_spec.rb +90 -0
  101. data/spec/models/identification_status_spec.rb +30 -0
  102. data/spec/models/identification_type_spec.rb +60 -0
  103. data/spec/models/identification_usage_spec.rb +60 -0
  104. data/spec/models/identification_usage_type_spec.rb +30 -0
  105. data/spec/models/identifier_spec.rb +42 -0
  106. data/spec/models/identifier_type_spec.rb +30 -0
  107. data/spec/models/service_provider_spec.rb +54 -0
  108. data/spec/models/service_type_assignment_spec.rb +48 -0
  109. data/spec/models/service_type_spec.rb +66 -0
  110. data/spec/models/service_type_translation_spec.rb +42 -0
  111. data/spec/models/service_usage_spec.rb +90 -0
  112. data/spec/models/service_usage_type_spec.rb +30 -0
  113. data/spec/models/transact_error_spec.rb +48 -0
  114. data/spec/models/transact_result_spec.rb +84 -0
  115. data/spec/models/transact_state_enum_spec.rb +30 -0
  116. data/spec/models/transact_state_spec.rb +42 -0
  117. data/spec/models/transact_state_translation_spec.rb +42 -0
  118. data/spec/models/valid_transaction_info_spec.rb +42 -0
  119. data/spec/models/week_spec.rb +72 -0
  120. data/spec/spec_helper.rb +111 -0
  121. metadata +255 -0
@@ -0,0 +1,338 @@
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 Identification
18
+ attr_accessor :id
19
+
20
+ attr_accessor :customer
21
+
22
+ attr_accessor :external_id
23
+
24
+ attr_accessor :external_id2
25
+
26
+ attr_accessor :from_date
27
+
28
+ attr_accessor :id_code
29
+
30
+ attr_accessor :id_number
31
+
32
+ attr_accessor :status
33
+
34
+ attr_accessor :to_date
35
+
36
+ attr_accessor :type
37
+
38
+ class EnumAttributeValidator
39
+ attr_reader :datatype
40
+ attr_reader :allowable_values
41
+
42
+ def initialize(datatype, allowable_values)
43
+ @allowable_values = allowable_values.map do |value|
44
+ case datatype.to_s
45
+ when /Integer/i
46
+ value.to_i
47
+ when /Float/i
48
+ value.to_f
49
+ else
50
+ value
51
+ end
52
+ end
53
+ end
54
+
55
+ def valid?(value)
56
+ !value || allowable_values.include?(value)
57
+ end
58
+ end
59
+
60
+ # Attribute mapping from ruby-style variable name to JSON key.
61
+ def self.attribute_map
62
+ {
63
+ :'id' => :'id',
64
+ :'customer' => :'customer',
65
+ :'external_id' => :'externalId',
66
+ :'external_id2' => :'externalId2',
67
+ :'from_date' => :'fromDate',
68
+ :'id_code' => :'idCode',
69
+ :'id_number' => :'idNumber',
70
+ :'status' => :'status',
71
+ :'to_date' => :'toDate',
72
+ :'type' => :'type'
73
+ }
74
+ end
75
+
76
+ # Returns all the JSON keys this model knows about
77
+ def self.acceptable_attributes
78
+ attribute_map.values
79
+ end
80
+
81
+ # Attribute type mapping.
82
+ def self.openapi_types
83
+ {
84
+ :'id' => :'String',
85
+ :'customer' => :'Customer',
86
+ :'external_id' => :'String',
87
+ :'external_id2' => :'String',
88
+ :'from_date' => :'Date',
89
+ :'id_code' => :'String',
90
+ :'id_number' => :'Integer',
91
+ :'status' => :'IdentificationStatus',
92
+ :'to_date' => :'Date',
93
+ :'type' => :'IdentificationType'
94
+ }
95
+ end
96
+
97
+ # List of attributes with nullable: true
98
+ def self.openapi_nullable
99
+ Set.new([
100
+ ])
101
+ end
102
+
103
+ # Initializes the object
104
+ # @param [Hash] attributes Model attributes in the form of hash
105
+ def initialize(attributes = {})
106
+ if (!attributes.is_a?(Hash))
107
+ fail ArgumentError, "The input argument (attributes) must be a hash in `FeratelCheckApiClient::Identification` initialize method"
108
+ end
109
+
110
+ # check to see if the attribute exists and convert string to symbol for hash key
111
+ attributes = attributes.each_with_object({}) { |(k, v), h|
112
+ if (!self.class.attribute_map.key?(k.to_sym))
113
+ fail ArgumentError, "`#{k}` is not a valid attribute in `FeratelCheckApiClient::Identification`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
114
+ end
115
+ h[k.to_sym] = v
116
+ }
117
+
118
+ if attributes.key?(:'id')
119
+ self.id = attributes[:'id']
120
+ end
121
+
122
+ if attributes.key?(:'customer')
123
+ self.customer = attributes[:'customer']
124
+ end
125
+
126
+ if attributes.key?(:'external_id')
127
+ self.external_id = attributes[:'external_id']
128
+ end
129
+
130
+ if attributes.key?(:'external_id2')
131
+ self.external_id2 = attributes[:'external_id2']
132
+ end
133
+
134
+ if attributes.key?(:'from_date')
135
+ self.from_date = attributes[:'from_date']
136
+ end
137
+
138
+ if attributes.key?(:'id_code')
139
+ self.id_code = attributes[:'id_code']
140
+ end
141
+
142
+ if attributes.key?(:'id_number')
143
+ self.id_number = attributes[:'id_number']
144
+ end
145
+
146
+ if attributes.key?(:'status')
147
+ self.status = attributes[:'status']
148
+ end
149
+
150
+ if attributes.key?(:'to_date')
151
+ self.to_date = attributes[:'to_date']
152
+ end
153
+
154
+ if attributes.key?(:'type')
155
+ self.type = attributes[:'type']
156
+ end
157
+ end
158
+
159
+ # Show invalid properties with the reasons. Usually used together with valid?
160
+ # @return Array for valid properties with the reasons
161
+ def list_invalid_properties
162
+ warn '[DEPRECATED] the `list_invalid_properties` method is obsolete'
163
+ invalid_properties = Array.new
164
+ 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}/)
165
+ if !@id.nil? && @id !~ pattern
166
+ invalid_properties.push("invalid value for \"id\", must conform to the pattern #{pattern}.")
167
+ end
168
+
169
+ invalid_properties
170
+ end
171
+
172
+ # Check to see if the all the properties in the model are valid
173
+ # @return true if the model is valid
174
+ def valid?
175
+ warn '[DEPRECATED] the `valid?` method is obsolete'
176
+ 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}/)
177
+ true
178
+ end
179
+
180
+ # Custom attribute writer method with validation
181
+ # @param [Object] id Value to be assigned
182
+ def id=(id)
183
+ if id.nil?
184
+ fail ArgumentError, 'id cannot be nil'
185
+ end
186
+
187
+ 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}/)
188
+ if id !~ pattern
189
+ fail ArgumentError, "invalid value for \"id\", must conform to the pattern #{pattern}."
190
+ end
191
+
192
+ @id = id
193
+ end
194
+
195
+ # Checks equality by comparing each attribute.
196
+ # @param [Object] Object to be compared
197
+ def ==(o)
198
+ return true if self.equal?(o)
199
+ self.class == o.class &&
200
+ id == o.id &&
201
+ customer == o.customer &&
202
+ external_id == o.external_id &&
203
+ external_id2 == o.external_id2 &&
204
+ from_date == o.from_date &&
205
+ id_code == o.id_code &&
206
+ id_number == o.id_number &&
207
+ status == o.status &&
208
+ to_date == o.to_date &&
209
+ type == o.type
210
+ end
211
+
212
+ # @see the `==` method
213
+ # @param [Object] Object to be compared
214
+ def eql?(o)
215
+ self == o
216
+ end
217
+
218
+ # Calculates hash code according to all attributes.
219
+ # @return [Integer] Hash code
220
+ def hash
221
+ [id, customer, external_id, external_id2, from_date, id_code, id_number, status, to_date, type].hash
222
+ end
223
+
224
+ # Builds the object from hash
225
+ # @param [Hash] attributes Model attributes in the form of hash
226
+ # @return [Object] Returns the model itself
227
+ def self.build_from_hash(attributes)
228
+ return nil unless attributes.is_a?(Hash)
229
+ attributes = attributes.transform_keys(&:to_sym)
230
+ transformed_hash = {}
231
+ openapi_types.each_pair do |key, type|
232
+ if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil?
233
+ transformed_hash["#{key}"] = nil
234
+ elsif type =~ /\AArray<(.*)>/i
235
+ # check to ensure the input is an array given that the attribute
236
+ # is documented as an array but the input is not
237
+ if attributes[attribute_map[key]].is_a?(Array)
238
+ transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) }
239
+ end
240
+ elsif !attributes[attribute_map[key]].nil?
241
+ transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]])
242
+ end
243
+ end
244
+ new(transformed_hash)
245
+ end
246
+
247
+ # Deserializes the data based on type
248
+ # @param string type Data type
249
+ # @param string value Value to be deserialized
250
+ # @return [Object] Deserialized data
251
+ def self._deserialize(type, value)
252
+ case type.to_sym
253
+ when :Time
254
+ Time.parse(value)
255
+ when :Date
256
+ Date.parse(value)
257
+ when :String
258
+ value.to_s
259
+ when :Integer
260
+ value.to_i
261
+ when :Float
262
+ value.to_f
263
+ when :Boolean
264
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
265
+ true
266
+ else
267
+ false
268
+ end
269
+ when :Object
270
+ # generic object (usually a Hash), return directly
271
+ value
272
+ when /\AArray<(?<inner_type>.+)>\z/
273
+ inner_type = Regexp.last_match[:inner_type]
274
+ value.map { |v| _deserialize(inner_type, v) }
275
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
276
+ k_type = Regexp.last_match[:k_type]
277
+ v_type = Regexp.last_match[:v_type]
278
+ {}.tap do |hash|
279
+ value.each do |k, v|
280
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
281
+ end
282
+ end
283
+ else # model
284
+ # models (e.g. Pet) or oneOf
285
+ klass = FeratelCheckApiClient.const_get(type)
286
+ klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
287
+ end
288
+ end
289
+
290
+ # Returns the string representation of the object
291
+ # @return [String] String presentation of the object
292
+ def to_s
293
+ to_hash.to_s
294
+ end
295
+
296
+ # to_body is an alias to to_hash (backward compatibility)
297
+ # @return [Hash] Returns the object in the form of hash
298
+ def to_body
299
+ to_hash
300
+ end
301
+
302
+ # Returns the object in the form of hash
303
+ # @return [Hash] Returns the object in the form of hash
304
+ def to_hash
305
+ hash = {}
306
+ self.class.attribute_map.each_pair do |attr, param|
307
+ value = self.send(attr)
308
+ if value.nil?
309
+ is_nullable = self.class.openapi_nullable.include?(attr)
310
+ next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
311
+ end
312
+
313
+ hash[param] = _to_hash(value)
314
+ end
315
+ hash
316
+ end
317
+
318
+ # Outputs non-array value in the form of hash
319
+ # For object, use to_hash. Otherwise, just return the value
320
+ # @param [Object] value Any valid value
321
+ # @return [Hash] Returns the value in the form of hash
322
+ def _to_hash(value)
323
+ if value.is_a?(Array)
324
+ value.compact.map { |v| _to_hash(v) }
325
+ elsif value.is_a?(Hash)
326
+ {}.tap do |hash|
327
+ value.each { |k, v| hash[k] = _to_hash(v) }
328
+ end
329
+ elsif value.respond_to? :to_hash
330
+ value.to_hash
331
+ else
332
+ value
333
+ end
334
+ end
335
+
336
+ end
337
+
338
+ end
@@ -0,0 +1,43 @@
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 IdentificationStatus
18
+ ACTIVE = "ACTIVE".freeze
19
+ BLOCKED = "BLOCKED".freeze
20
+ EXPIRED = "EXPIRED".freeze
21
+ INACTIVE = "INACTIVE".freeze
22
+ PENDING = "PENDING".freeze
23
+
24
+ def self.all_vars
25
+ @all_vars ||= [ACTIVE, BLOCKED, EXPIRED, INACTIVE, PENDING].freeze
26
+ end
27
+
28
+ # Builds the enum from string
29
+ # @param [String] The enum value in the form of the string
30
+ # @return [String] The enum value
31
+ def self.build_from_hash(value)
32
+ new.build_from_hash(value)
33
+ end
34
+
35
+ # Builds the enum from string
36
+ # @param [String] The enum value in the form of the string
37
+ # @return [String] The enum value
38
+ def build_from_hash(value)
39
+ return value if IdentificationStatus.all_vars.include?(value)
40
+ raise "Invalid ENUM value #{value} for class #IdentificationStatus"
41
+ end
42
+ end
43
+ end
@@ -0,0 +1,271 @@
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 IdentificationType
18
+ attr_accessor :id
19
+
20
+ attr_accessor :age_group
21
+
22
+ attr_accessor :code
23
+
24
+ attr_accessor :name
25
+
26
+ attr_accessor :type_id
27
+
28
+ # Attribute mapping from ruby-style variable name to JSON key.
29
+ def self.attribute_map
30
+ {
31
+ :'id' => :'id',
32
+ :'age_group' => :'ageGroup',
33
+ :'code' => :'code',
34
+ :'name' => :'name',
35
+ :'type_id' => :'typeId'
36
+ }
37
+ end
38
+
39
+ # Returns all the JSON keys this model knows about
40
+ def self.acceptable_attributes
41
+ attribute_map.values
42
+ end
43
+
44
+ # Attribute type mapping.
45
+ def self.openapi_types
46
+ {
47
+ :'id' => :'String',
48
+ :'age_group' => :'AgeGroup',
49
+ :'code' => :'String',
50
+ :'name' => :'String',
51
+ :'type_id' => :'Integer'
52
+ }
53
+ end
54
+
55
+ # List of attributes with nullable: true
56
+ def self.openapi_nullable
57
+ Set.new([
58
+ ])
59
+ end
60
+
61
+ # Initializes the object
62
+ # @param [Hash] attributes Model attributes in the form of hash
63
+ def initialize(attributes = {})
64
+ if (!attributes.is_a?(Hash))
65
+ fail ArgumentError, "The input argument (attributes) must be a hash in `FeratelCheckApiClient::IdentificationType` initialize method"
66
+ end
67
+
68
+ # check to see if the attribute exists and convert string to symbol for hash key
69
+ attributes = attributes.each_with_object({}) { |(k, v), h|
70
+ if (!self.class.attribute_map.key?(k.to_sym))
71
+ fail ArgumentError, "`#{k}` is not a valid attribute in `FeratelCheckApiClient::IdentificationType`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
72
+ end
73
+ h[k.to_sym] = v
74
+ }
75
+
76
+ if attributes.key?(:'id')
77
+ self.id = attributes[:'id']
78
+ end
79
+
80
+ if attributes.key?(:'age_group')
81
+ self.age_group = attributes[:'age_group']
82
+ end
83
+
84
+ if attributes.key?(:'code')
85
+ self.code = attributes[:'code']
86
+ end
87
+
88
+ if attributes.key?(:'name')
89
+ self.name = attributes[:'name']
90
+ end
91
+
92
+ if attributes.key?(:'type_id')
93
+ self.type_id = attributes[:'type_id']
94
+ end
95
+ end
96
+
97
+ # Show invalid properties with the reasons. Usually used together with valid?
98
+ # @return Array for valid properties with the reasons
99
+ def list_invalid_properties
100
+ warn '[DEPRECATED] the `list_invalid_properties` method is obsolete'
101
+ invalid_properties = Array.new
102
+ 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}/)
103
+ if !@id.nil? && @id !~ pattern
104
+ invalid_properties.push("invalid value for \"id\", must conform to the pattern #{pattern}.")
105
+ end
106
+
107
+ invalid_properties
108
+ end
109
+
110
+ # Check to see if the all the properties in the model are valid
111
+ # @return true if the model is valid
112
+ def valid?
113
+ warn '[DEPRECATED] the `valid?` method is obsolete'
114
+ 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}/)
115
+ true
116
+ end
117
+
118
+ # Custom attribute writer method with validation
119
+ # @param [Object] id Value to be assigned
120
+ def id=(id)
121
+ if id.nil?
122
+ fail ArgumentError, 'id cannot be nil'
123
+ end
124
+
125
+ 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}/)
126
+ if id !~ pattern
127
+ fail ArgumentError, "invalid value for \"id\", must conform to the pattern #{pattern}."
128
+ end
129
+
130
+ @id = id
131
+ end
132
+
133
+ # Checks equality by comparing each attribute.
134
+ # @param [Object] Object to be compared
135
+ def ==(o)
136
+ return true if self.equal?(o)
137
+ self.class == o.class &&
138
+ id == o.id &&
139
+ age_group == o.age_group &&
140
+ code == o.code &&
141
+ name == o.name &&
142
+ type_id == o.type_id
143
+ end
144
+
145
+ # @see the `==` method
146
+ # @param [Object] Object to be compared
147
+ def eql?(o)
148
+ self == o
149
+ end
150
+
151
+ # Calculates hash code according to all attributes.
152
+ # @return [Integer] Hash code
153
+ def hash
154
+ [id, age_group, code, name, type_id].hash
155
+ end
156
+
157
+ # Builds the object from hash
158
+ # @param [Hash] attributes Model attributes in the form of hash
159
+ # @return [Object] Returns the model itself
160
+ def self.build_from_hash(attributes)
161
+ return nil unless attributes.is_a?(Hash)
162
+ attributes = attributes.transform_keys(&:to_sym)
163
+ transformed_hash = {}
164
+ openapi_types.each_pair do |key, type|
165
+ if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil?
166
+ transformed_hash["#{key}"] = nil
167
+ elsif type =~ /\AArray<(.*)>/i
168
+ # check to ensure the input is an array given that the attribute
169
+ # is documented as an array but the input is not
170
+ if attributes[attribute_map[key]].is_a?(Array)
171
+ transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) }
172
+ end
173
+ elsif !attributes[attribute_map[key]].nil?
174
+ transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]])
175
+ end
176
+ end
177
+ new(transformed_hash)
178
+ end
179
+
180
+ # Deserializes the data based on type
181
+ # @param string type Data type
182
+ # @param string value Value to be deserialized
183
+ # @return [Object] Deserialized data
184
+ def self._deserialize(type, value)
185
+ case type.to_sym
186
+ when :Time
187
+ Time.parse(value)
188
+ when :Date
189
+ Date.parse(value)
190
+ when :String
191
+ value.to_s
192
+ when :Integer
193
+ value.to_i
194
+ when :Float
195
+ value.to_f
196
+ when :Boolean
197
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
198
+ true
199
+ else
200
+ false
201
+ end
202
+ when :Object
203
+ # generic object (usually a Hash), return directly
204
+ value
205
+ when /\AArray<(?<inner_type>.+)>\z/
206
+ inner_type = Regexp.last_match[:inner_type]
207
+ value.map { |v| _deserialize(inner_type, v) }
208
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
209
+ k_type = Regexp.last_match[:k_type]
210
+ v_type = Regexp.last_match[:v_type]
211
+ {}.tap do |hash|
212
+ value.each do |k, v|
213
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
214
+ end
215
+ end
216
+ else # model
217
+ # models (e.g. Pet) or oneOf
218
+ klass = FeratelCheckApiClient.const_get(type)
219
+ klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
220
+ end
221
+ end
222
+
223
+ # Returns the string representation of the object
224
+ # @return [String] String presentation of the object
225
+ def to_s
226
+ to_hash.to_s
227
+ end
228
+
229
+ # to_body is an alias to to_hash (backward compatibility)
230
+ # @return [Hash] Returns the object in the form of hash
231
+ def to_body
232
+ to_hash
233
+ end
234
+
235
+ # Returns the object in the form of hash
236
+ # @return [Hash] Returns the object in the form of hash
237
+ def to_hash
238
+ hash = {}
239
+ self.class.attribute_map.each_pair do |attr, param|
240
+ value = self.send(attr)
241
+ if value.nil?
242
+ is_nullable = self.class.openapi_nullable.include?(attr)
243
+ next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
244
+ end
245
+
246
+ hash[param] = _to_hash(value)
247
+ end
248
+ hash
249
+ end
250
+
251
+ # Outputs non-array value in the form of hash
252
+ # For object, use to_hash. Otherwise, just return the value
253
+ # @param [Object] value Any valid value
254
+ # @return [Hash] Returns the value in the form of hash
255
+ def _to_hash(value)
256
+ if value.is_a?(Array)
257
+ value.compact.map { |v| _to_hash(v) }
258
+ elsif value.is_a?(Hash)
259
+ {}.tap do |hash|
260
+ value.each { |k, v| hash[k] = _to_hash(v) }
261
+ end
262
+ elsif value.respond_to? :to_hash
263
+ value.to_hash
264
+ else
265
+ value
266
+ end
267
+ end
268
+
269
+ end
270
+
271
+ end