korona-entry-client 1.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (72) hide show
  1. checksums.yaml +7 -0
  2. data/Gemfile +9 -0
  3. data/README.md +128 -0
  4. data/Rakefile +10 -0
  5. data/docs/BadRequestError.md +19 -0
  6. data/docs/EntryResponse.md +21 -0
  7. data/docs/ExternalTicketConfiguration.md +29 -0
  8. data/docs/ExternalTicketConfigurationList.md +17 -0
  9. data/docs/ExternalTicketConfigurationsApi.md +247 -0
  10. data/docs/ModelReference.md +23 -0
  11. data/docs/NotAcceptableError.md +19 -0
  12. data/docs/OrganizationalUnit.md +27 -0
  13. data/docs/OrganizationalUnitList.md +17 -0
  14. data/docs/OrganizationalUnitsApi.md +247 -0
  15. data/docs/Ticket.md +35 -0
  16. data/docs/TicketEntry.md +49 -0
  17. data/docs/TicketEntryLog.md +39 -0
  18. data/docs/TicketEntryLogList.md +17 -0
  19. data/docs/TicketImage.md +17 -0
  20. data/docs/TicketInformation.md +27 -0
  21. data/docs/TicketList.md +17 -0
  22. data/docs/TicketPersonalization.md +21 -0
  23. data/docs/TicketsApi.md +654 -0
  24. data/git_push.sh +58 -0
  25. data/korona-entry-client.gemspec +39 -0
  26. data/lib/korona-entry-client.rb +58 -0
  27. data/lib/korona-entry-client/api/external_ticket_configurations_api.rb +356 -0
  28. data/lib/korona-entry-client/api/organizational_units_api.rb +356 -0
  29. data/lib/korona-entry-client/api/tickets_api.rb +854 -0
  30. data/lib/korona-entry-client/api_client.rb +386 -0
  31. data/lib/korona-entry-client/api_error.rb +57 -0
  32. data/lib/korona-entry-client/configuration.rb +248 -0
  33. data/lib/korona-entry-client/models/bad_request_error.rb +217 -0
  34. data/lib/korona-entry-client/models/entry_response.rb +226 -0
  35. data/lib/korona-entry-client/models/external_ticket_configuration.rb +304 -0
  36. data/lib/korona-entry-client/models/external_ticket_configuration_list.rb +214 -0
  37. data/lib/korona-entry-client/models/model_reference.rb +238 -0
  38. data/lib/korona-entry-client/models/not_acceptable_error.rb +250 -0
  39. data/lib/korona-entry-client/models/organizational_unit.rb +257 -0
  40. data/lib/korona-entry-client/models/organizational_unit_list.rb +214 -0
  41. data/lib/korona-entry-client/models/ticket.rb +299 -0
  42. data/lib/korona-entry-client/models/ticket_entry.rb +403 -0
  43. data/lib/korona-entry-client/models/ticket_entry_log.rb +374 -0
  44. data/lib/korona-entry-client/models/ticket_entry_log_list.rb +214 -0
  45. data/lib/korona-entry-client/models/ticket_image.rb +215 -0
  46. data/lib/korona-entry-client/models/ticket_information.rb +258 -0
  47. data/lib/korona-entry-client/models/ticket_list.rb +214 -0
  48. data/lib/korona-entry-client/models/ticket_personalization.rb +228 -0
  49. data/lib/korona-entry-client/version.rb +15 -0
  50. data/spec/api/external_ticket_configurations_api_spec.rb +95 -0
  51. data/spec/api/organizational_units_api_spec.rb +95 -0
  52. data/spec/api/tickets_api_spec.rb +191 -0
  53. data/spec/api_client_spec.rb +226 -0
  54. data/spec/configuration_spec.rb +42 -0
  55. data/spec/models/bad_request_error_spec.rb +47 -0
  56. data/spec/models/entry_response_spec.rb +53 -0
  57. data/spec/models/external_ticket_configuration_list_spec.rb +41 -0
  58. data/spec/models/external_ticket_configuration_spec.rb +77 -0
  59. data/spec/models/model_reference_spec.rb +59 -0
  60. data/spec/models/not_acceptable_error_spec.rb +51 -0
  61. data/spec/models/organizational_unit_list_spec.rb +41 -0
  62. data/spec/models/organizational_unit_spec.rb +71 -0
  63. data/spec/models/ticket_entry_log_list_spec.rb +41 -0
  64. data/spec/models/ticket_entry_log_spec.rb +119 -0
  65. data/spec/models/ticket_entry_spec.rb +137 -0
  66. data/spec/models/ticket_image_spec.rb +41 -0
  67. data/spec/models/ticket_information_spec.rb +71 -0
  68. data/spec/models/ticket_list_spec.rb +41 -0
  69. data/spec/models/ticket_personalization_spec.rb +53 -0
  70. data/spec/models/ticket_spec.rb +95 -0
  71. data/spec/spec_helper.rb +111 -0
  72. metadata +196 -0
@@ -0,0 +1,403 @@
1
+ =begin
2
+ #KORONA.entry API v1
3
+
4
+ #Our api provides access to our entry services
5
+
6
+ The version of the OpenAPI document: 1.0.0
7
+
8
+ Generated by: https://openapi-generator.tech
9
+ OpenAPI Generator version: 4.3.0
10
+
11
+ =end
12
+
13
+ require 'date'
14
+
15
+ module KoronaEntryClient
16
+ # Represents a validity/definition of a ticket. each ticket can have more than one validity.
17
+ class TicketEntry
18
+ # Objects ID.
19
+ attr_accessor :id
20
+
21
+ # Date of creation.
22
+ attr_accessor :create_date
23
+
24
+ # *True*, if the ticket is used up.
25
+ attr_accessor :used_up
26
+
27
+ # Date of first use.
28
+ attr_accessor :first_use
29
+
30
+ # Date of last use (not exiting).
31
+ attr_accessor :last_use
32
+
33
+ # Date of last exiting.
34
+ attr_accessor :last_exit
35
+
36
+ # Number of entries already made.
37
+ attr_accessor :uses
38
+
39
+ # Optional maximum number of possible entries.
40
+ attr_accessor :uses_max
41
+
42
+ # When the ticket becomes valid.
43
+ attr_accessor :valid_from
44
+
45
+ # Optional fixed date until which the ticket is valid.
46
+ attr_accessor :valid_to
47
+
48
+ # Time from which the ticket becomes valid within a day. Format: HH:ii:ss
49
+ attr_accessor :valid_from_time
50
+
51
+ # Time until which the ticket becomes valid within a day. Format: HH:ii:ss
52
+ attr_accessor :valid_to_time
53
+
54
+ # Specifies the number of days after which the ticket is locked from the first use.
55
+ attr_accessor :lock_after_use
56
+
57
+ # Number of access points to which this validity applies.
58
+ attr_accessor :entry_gates
59
+
60
+ attr_accessor :information
61
+
62
+ # Date until which the ticketEntry is locked.
63
+ attr_accessor :locked_to
64
+
65
+ # Specifies how many seconds the ticket should be locked after a successful entry.
66
+ attr_accessor :re_entry_lock
67
+
68
+ # Attribute mapping from ruby-style variable name to JSON key.
69
+ def self.attribute_map
70
+ {
71
+ :'id' => :'id',
72
+ :'create_date' => :'createDate',
73
+ :'used_up' => :'usedUp',
74
+ :'first_use' => :'firstUse',
75
+ :'last_use' => :'lastUse',
76
+ :'last_exit' => :'lastExit',
77
+ :'uses' => :'uses',
78
+ :'uses_max' => :'usesMax',
79
+ :'valid_from' => :'validFrom',
80
+ :'valid_to' => :'validTo',
81
+ :'valid_from_time' => :'validFromTime',
82
+ :'valid_to_time' => :'validToTime',
83
+ :'lock_after_use' => :'lockAfterUse',
84
+ :'entry_gates' => :'entryGates',
85
+ :'information' => :'information',
86
+ :'locked_to' => :'lockedTo',
87
+ :'re_entry_lock' => :'reEntryLock'
88
+ }
89
+ end
90
+
91
+ # Attribute type mapping.
92
+ def self.openapi_types
93
+ {
94
+ :'id' => :'Integer',
95
+ :'create_date' => :'DateTime',
96
+ :'used_up' => :'Boolean',
97
+ :'first_use' => :'DateTime',
98
+ :'last_use' => :'DateTime',
99
+ :'last_exit' => :'DateTime',
100
+ :'uses' => :'Integer',
101
+ :'uses_max' => :'Integer',
102
+ :'valid_from' => :'DateTime',
103
+ :'valid_to' => :'DateTime',
104
+ :'valid_from_time' => :'String',
105
+ :'valid_to_time' => :'String',
106
+ :'lock_after_use' => :'Integer',
107
+ :'entry_gates' => :'Array<String>',
108
+ :'information' => :'TicketInformation',
109
+ :'locked_to' => :'DateTime',
110
+ :'re_entry_lock' => :'Integer'
111
+ }
112
+ end
113
+
114
+ # List of attributes with nullable: true
115
+ def self.openapi_nullable
116
+ Set.new([
117
+ ])
118
+ end
119
+
120
+ # Initializes the object
121
+ # @param [Hash] attributes Model attributes in the form of hash
122
+ def initialize(attributes = {})
123
+ if (!attributes.is_a?(Hash))
124
+ fail ArgumentError, "The input argument (attributes) must be a hash in `KoronaEntryClient::TicketEntry` initialize method"
125
+ end
126
+
127
+ # check to see if the attribute exists and convert string to symbol for hash key
128
+ attributes = attributes.each_with_object({}) { |(k, v), h|
129
+ if (!self.class.attribute_map.key?(k.to_sym))
130
+ fail ArgumentError, "`#{k}` is not a valid attribute in `KoronaEntryClient::TicketEntry`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
131
+ end
132
+ h[k.to_sym] = v
133
+ }
134
+
135
+ if attributes.key?(:'id')
136
+ self.id = attributes[:'id']
137
+ end
138
+
139
+ if attributes.key?(:'create_date')
140
+ self.create_date = attributes[:'create_date']
141
+ end
142
+
143
+ if attributes.key?(:'used_up')
144
+ self.used_up = attributes[:'used_up']
145
+ end
146
+
147
+ if attributes.key?(:'first_use')
148
+ self.first_use = attributes[:'first_use']
149
+ end
150
+
151
+ if attributes.key?(:'last_use')
152
+ self.last_use = attributes[:'last_use']
153
+ end
154
+
155
+ if attributes.key?(:'last_exit')
156
+ self.last_exit = attributes[:'last_exit']
157
+ end
158
+
159
+ if attributes.key?(:'uses')
160
+ self.uses = attributes[:'uses']
161
+ end
162
+
163
+ if attributes.key?(:'uses_max')
164
+ self.uses_max = attributes[:'uses_max']
165
+ end
166
+
167
+ if attributes.key?(:'valid_from')
168
+ self.valid_from = attributes[:'valid_from']
169
+ end
170
+
171
+ if attributes.key?(:'valid_to')
172
+ self.valid_to = attributes[:'valid_to']
173
+ end
174
+
175
+ if attributes.key?(:'valid_from_time')
176
+ self.valid_from_time = attributes[:'valid_from_time']
177
+ end
178
+
179
+ if attributes.key?(:'valid_to_time')
180
+ self.valid_to_time = attributes[:'valid_to_time']
181
+ end
182
+
183
+ if attributes.key?(:'lock_after_use')
184
+ self.lock_after_use = attributes[:'lock_after_use']
185
+ end
186
+
187
+ if attributes.key?(:'entry_gates')
188
+ if (value = attributes[:'entry_gates']).is_a?(Array)
189
+ self.entry_gates = value
190
+ end
191
+ end
192
+
193
+ if attributes.key?(:'information')
194
+ self.information = attributes[:'information']
195
+ end
196
+
197
+ if attributes.key?(:'locked_to')
198
+ self.locked_to = attributes[:'locked_to']
199
+ end
200
+
201
+ if attributes.key?(:'re_entry_lock')
202
+ self.re_entry_lock = attributes[:'re_entry_lock']
203
+ end
204
+ end
205
+
206
+ # Show invalid properties with the reasons. Usually used together with valid?
207
+ # @return Array for valid properties with the reasons
208
+ def list_invalid_properties
209
+ invalid_properties = Array.new
210
+ pattern = Regexp.new(/^([0-1]\d|2[0-3])\:[0-5]\d\:[0-5]\d$/)
211
+ if !@valid_from_time.nil? && @valid_from_time !~ pattern
212
+ invalid_properties.push("invalid value for \"valid_from_time\", must conform to the pattern #{pattern}.")
213
+ end
214
+
215
+ pattern = Regexp.new(/^([0-1]\d|2[0-3])\:[0-5]\d\:[0-5]\d$/)
216
+ if !@valid_to_time.nil? && @valid_to_time !~ pattern
217
+ invalid_properties.push("invalid value for \"valid_to_time\", must conform to the pattern #{pattern}.")
218
+ end
219
+
220
+ invalid_properties
221
+ end
222
+
223
+ # Check to see if the all the properties in the model are valid
224
+ # @return true if the model is valid
225
+ def valid?
226
+ return false if !@valid_from_time.nil? && @valid_from_time !~ Regexp.new(/^([0-1]\d|2[0-3])\:[0-5]\d\:[0-5]\d$/)
227
+ return false if !@valid_to_time.nil? && @valid_to_time !~ Regexp.new(/^([0-1]\d|2[0-3])\:[0-5]\d\:[0-5]\d$/)
228
+ true
229
+ end
230
+
231
+ # Custom attribute writer method with validation
232
+ # @param [Object] valid_from_time Value to be assigned
233
+ def valid_from_time=(valid_from_time)
234
+ pattern = Regexp.new(/^([0-1]\d|2[0-3])\:[0-5]\d\:[0-5]\d$/)
235
+ if !valid_from_time.nil? && valid_from_time !~ pattern
236
+ fail ArgumentError, "invalid value for \"valid_from_time\", must conform to the pattern #{pattern}."
237
+ end
238
+
239
+ @valid_from_time = valid_from_time
240
+ end
241
+
242
+ # Custom attribute writer method with validation
243
+ # @param [Object] valid_to_time Value to be assigned
244
+ def valid_to_time=(valid_to_time)
245
+ pattern = Regexp.new(/^([0-1]\d|2[0-3])\:[0-5]\d\:[0-5]\d$/)
246
+ if !valid_to_time.nil? && valid_to_time !~ pattern
247
+ fail ArgumentError, "invalid value for \"valid_to_time\", must conform to the pattern #{pattern}."
248
+ end
249
+
250
+ @valid_to_time = valid_to_time
251
+ end
252
+
253
+ # Checks equality by comparing each attribute.
254
+ # @param [Object] Object to be compared
255
+ def ==(o)
256
+ return true if self.equal?(o)
257
+ self.class == o.class &&
258
+ id == o.id &&
259
+ create_date == o.create_date &&
260
+ used_up == o.used_up &&
261
+ first_use == o.first_use &&
262
+ last_use == o.last_use &&
263
+ last_exit == o.last_exit &&
264
+ uses == o.uses &&
265
+ uses_max == o.uses_max &&
266
+ valid_from == o.valid_from &&
267
+ valid_to == o.valid_to &&
268
+ valid_from_time == o.valid_from_time &&
269
+ valid_to_time == o.valid_to_time &&
270
+ lock_after_use == o.lock_after_use &&
271
+ entry_gates == o.entry_gates &&
272
+ information == o.information &&
273
+ locked_to == o.locked_to &&
274
+ re_entry_lock == o.re_entry_lock
275
+ end
276
+
277
+ # @see the `==` method
278
+ # @param [Object] Object to be compared
279
+ def eql?(o)
280
+ self == o
281
+ end
282
+
283
+ # Calculates hash code according to all attributes.
284
+ # @return [Integer] Hash code
285
+ def hash
286
+ [id, create_date, used_up, first_use, last_use, last_exit, uses, uses_max, valid_from, valid_to, valid_from_time, valid_to_time, lock_after_use, entry_gates, information, locked_to, re_entry_lock].hash
287
+ end
288
+
289
+ # Builds the object from hash
290
+ # @param [Hash] attributes Model attributes in the form of hash
291
+ # @return [Object] Returns the model itself
292
+ def self.build_from_hash(attributes)
293
+ new.build_from_hash(attributes)
294
+ end
295
+
296
+ # Builds the object from hash
297
+ # @param [Hash] attributes Model attributes in the form of hash
298
+ # @return [Object] Returns the model itself
299
+ def build_from_hash(attributes)
300
+ return nil unless attributes.is_a?(Hash)
301
+ self.class.openapi_types.each_pair do |key, type|
302
+ if type =~ /\AArray<(.*)>/i
303
+ # check to ensure the input is an array given that the attribute
304
+ # is documented as an array but the input is not
305
+ if attributes[self.class.attribute_map[key]].is_a?(Array)
306
+ self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
307
+ end
308
+ elsif !attributes[self.class.attribute_map[key]].nil?
309
+ self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
310
+ end # or else data not found in attributes(hash), not an issue as the data can be optional
311
+ end
312
+
313
+ self
314
+ end
315
+
316
+ # Deserializes the data based on type
317
+ # @param string type Data type
318
+ # @param string value Value to be deserialized
319
+ # @return [Object] Deserialized data
320
+ def _deserialize(type, value)
321
+ case type.to_sym
322
+ when :DateTime
323
+ DateTime.parse(value)
324
+ when :Date
325
+ Date.parse(value)
326
+ when :String
327
+ value.to_s
328
+ when :Integer
329
+ value.to_i
330
+ when :Float
331
+ value.to_f
332
+ when :Boolean
333
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
334
+ true
335
+ else
336
+ false
337
+ end
338
+ when :Object
339
+ # generic object (usually a Hash), return directly
340
+ value
341
+ when /\AArray<(?<inner_type>.+)>\z/
342
+ inner_type = Regexp.last_match[:inner_type]
343
+ value.map { |v| _deserialize(inner_type, v) }
344
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
345
+ k_type = Regexp.last_match[:k_type]
346
+ v_type = Regexp.last_match[:v_type]
347
+ {}.tap do |hash|
348
+ value.each do |k, v|
349
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
350
+ end
351
+ end
352
+ else # model
353
+ KoronaEntryClient.const_get(type).build_from_hash(value)
354
+ end
355
+ end
356
+
357
+ # Returns the string representation of the object
358
+ # @return [String] String presentation of the object
359
+ def to_s
360
+ to_hash.to_s
361
+ end
362
+
363
+ # to_body is an alias to to_hash (backward compatibility)
364
+ # @return [Hash] Returns the object in the form of hash
365
+ def to_body
366
+ to_hash
367
+ end
368
+
369
+ # Returns the object in the form of hash
370
+ # @return [Hash] Returns the object in the form of hash
371
+ def to_hash
372
+ hash = {}
373
+ self.class.attribute_map.each_pair do |attr, param|
374
+ value = self.send(attr)
375
+ if value.nil?
376
+ is_nullable = self.class.openapi_nullable.include?(attr)
377
+ next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
378
+ end
379
+
380
+ hash[param] = _to_hash(value)
381
+ end
382
+ hash
383
+ end
384
+
385
+ # Outputs non-array value in the form of hash
386
+ # For object, use to_hash. Otherwise, just return the value
387
+ # @param [Object] value Any valid value
388
+ # @return [Hash] Returns the value in the form of hash
389
+ def _to_hash(value)
390
+ if value.is_a?(Array)
391
+ value.compact.map { |v| _to_hash(v) }
392
+ elsif value.is_a?(Hash)
393
+ {}.tap do |hash|
394
+ value.each { |k, v| hash[k] = _to_hash(v) }
395
+ end
396
+ elsif value.respond_to? :to_hash
397
+ value.to_hash
398
+ else
399
+ value
400
+ end
401
+ end
402
+ end
403
+ end
@@ -0,0 +1,374 @@
1
+ =begin
2
+ #KORONA.entry API v1
3
+
4
+ #Our api provides access to our entry services
5
+
6
+ The version of the OpenAPI document: 1.0.0
7
+
8
+ Generated by: https://openapi-generator.tech
9
+ OpenAPI Generator version: 4.3.0
10
+
11
+ =end
12
+
13
+ require 'date'
14
+
15
+ module KoronaEntryClient
16
+ # Represents a ticket log entry, f.e. created by update, check or access.
17
+ class TicketEntryLog
18
+ # Objects ID.
19
+ attr_accessor :id
20
+
21
+ # Short comment for this action.
22
+ attr_accessor :comment
23
+
24
+ attr_accessor :ticket
25
+
26
+ attr_accessor :ticket_entry
27
+
28
+ # Identification of action type.
29
+ attr_accessor :log_type
30
+
31
+ # Identification of response type.
32
+ attr_accessor :response
33
+
34
+ # Time of action.
35
+ attr_accessor :time
36
+
37
+ # Number of the organizational unit concerned.
38
+ attr_accessor :organizational_unit_number
39
+
40
+ # Client concerned.
41
+ attr_accessor :client
42
+
43
+ # Number of uses if its an entry action.
44
+ attr_accessor :number_of_uses
45
+
46
+ # Identification of commit type.
47
+ attr_accessor :commit_type
48
+
49
+ # Time of testing.
50
+ attr_accessor :test_time
51
+
52
+ class EnumAttributeValidator
53
+ attr_reader :datatype
54
+ attr_reader :allowable_values
55
+
56
+ def initialize(datatype, allowable_values)
57
+ @allowable_values = allowable_values.map do |value|
58
+ case datatype.to_s
59
+ when /Integer/i
60
+ value.to_i
61
+ when /Float/i
62
+ value.to_f
63
+ else
64
+ value
65
+ end
66
+ end
67
+ end
68
+
69
+ def valid?(value)
70
+ !value || allowable_values.include?(value)
71
+ end
72
+ end
73
+
74
+ # Attribute mapping from ruby-style variable name to JSON key.
75
+ def self.attribute_map
76
+ {
77
+ :'id' => :'id',
78
+ :'comment' => :'comment',
79
+ :'ticket' => :'ticket',
80
+ :'ticket_entry' => :'ticketEntry',
81
+ :'log_type' => :'logType',
82
+ :'response' => :'response',
83
+ :'time' => :'time',
84
+ :'organizational_unit_number' => :'organizationalUnitNumber',
85
+ :'client' => :'client',
86
+ :'number_of_uses' => :'numberOfUses',
87
+ :'commit_type' => :'commitType',
88
+ :'test_time' => :'testTime'
89
+ }
90
+ end
91
+
92
+ # Attribute type mapping.
93
+ def self.openapi_types
94
+ {
95
+ :'id' => :'Integer',
96
+ :'comment' => :'String',
97
+ :'ticket' => :'ModelReference',
98
+ :'ticket_entry' => :'ModelReference',
99
+ :'log_type' => :'String',
100
+ :'response' => :'String',
101
+ :'time' => :'DateTime',
102
+ :'organizational_unit_number' => :'String',
103
+ :'client' => :'String',
104
+ :'number_of_uses' => :'Integer',
105
+ :'commit_type' => :'String',
106
+ :'test_time' => :'DateTime'
107
+ }
108
+ end
109
+
110
+ # List of attributes with nullable: true
111
+ def self.openapi_nullable
112
+ Set.new([
113
+ ])
114
+ end
115
+
116
+ # Initializes the object
117
+ # @param [Hash] attributes Model attributes in the form of hash
118
+ def initialize(attributes = {})
119
+ if (!attributes.is_a?(Hash))
120
+ fail ArgumentError, "The input argument (attributes) must be a hash in `KoronaEntryClient::TicketEntryLog` initialize method"
121
+ end
122
+
123
+ # check to see if the attribute exists and convert string to symbol for hash key
124
+ attributes = attributes.each_with_object({}) { |(k, v), h|
125
+ if (!self.class.attribute_map.key?(k.to_sym))
126
+ fail ArgumentError, "`#{k}` is not a valid attribute in `KoronaEntryClient::TicketEntryLog`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
127
+ end
128
+ h[k.to_sym] = v
129
+ }
130
+
131
+ if attributes.key?(:'id')
132
+ self.id = attributes[:'id']
133
+ end
134
+
135
+ if attributes.key?(:'comment')
136
+ self.comment = attributes[:'comment']
137
+ end
138
+
139
+ if attributes.key?(:'ticket')
140
+ self.ticket = attributes[:'ticket']
141
+ end
142
+
143
+ if attributes.key?(:'ticket_entry')
144
+ self.ticket_entry = attributes[:'ticket_entry']
145
+ end
146
+
147
+ if attributes.key?(:'log_type')
148
+ self.log_type = attributes[:'log_type']
149
+ end
150
+
151
+ if attributes.key?(:'response')
152
+ self.response = attributes[:'response']
153
+ end
154
+
155
+ if attributes.key?(:'time')
156
+ self.time = attributes[:'time']
157
+ end
158
+
159
+ if attributes.key?(:'organizational_unit_number')
160
+ self.organizational_unit_number = attributes[:'organizational_unit_number']
161
+ end
162
+
163
+ if attributes.key?(:'client')
164
+ self.client = attributes[:'client']
165
+ end
166
+
167
+ if attributes.key?(:'number_of_uses')
168
+ self.number_of_uses = attributes[:'number_of_uses']
169
+ end
170
+
171
+ if attributes.key?(:'commit_type')
172
+ self.commit_type = attributes[:'commit_type']
173
+ end
174
+
175
+ if attributes.key?(:'test_time')
176
+ self.test_time = attributes[:'test_time']
177
+ end
178
+ end
179
+
180
+ # Show invalid properties with the reasons. Usually used together with valid?
181
+ # @return Array for valid properties with the reasons
182
+ def list_invalid_properties
183
+ invalid_properties = Array.new
184
+ invalid_properties
185
+ end
186
+
187
+ # Check to see if the all the properties in the model are valid
188
+ # @return true if the model is valid
189
+ def valid?
190
+ log_type_validator = EnumAttributeValidator.new('String', ["CREATE", "UPDATE", "EXTEND", "VALIDATE", "PREPARE_ENTRY", "COMMIT_ENTRY"])
191
+ return false unless log_type_validator.valid?(@log_type)
192
+ response_validator = EnumAttributeValidator.new('String', ["BEFORETIME", "DENIED", "DOESNTEXIST", "EXHAUSTED", "INVALID", "LOCKED", "SUSPENDED", "TIMEUP", "TIME_QUOTA_OVERDRAWN", "SUCCESS"])
193
+ return false unless response_validator.valid?(@response)
194
+ commit_type_validator = EnumAttributeValidator.new('String', ["ACCESS", "EXIT"])
195
+ return false unless commit_type_validator.valid?(@commit_type)
196
+ true
197
+ end
198
+
199
+ # Custom attribute writer method checking allowed values (enum).
200
+ # @param [Object] log_type Object to be assigned
201
+ def log_type=(log_type)
202
+ validator = EnumAttributeValidator.new('String', ["CREATE", "UPDATE", "EXTEND", "VALIDATE", "PREPARE_ENTRY", "COMMIT_ENTRY"])
203
+ unless validator.valid?(log_type)
204
+ fail ArgumentError, "invalid value for \"log_type\", must be one of #{validator.allowable_values}."
205
+ end
206
+ @log_type = log_type
207
+ end
208
+
209
+ # Custom attribute writer method checking allowed values (enum).
210
+ # @param [Object] response Object to be assigned
211
+ def response=(response)
212
+ validator = EnumAttributeValidator.new('String', ["BEFORETIME", "DENIED", "DOESNTEXIST", "EXHAUSTED", "INVALID", "LOCKED", "SUSPENDED", "TIMEUP", "TIME_QUOTA_OVERDRAWN", "SUCCESS"])
213
+ unless validator.valid?(response)
214
+ fail ArgumentError, "invalid value for \"response\", must be one of #{validator.allowable_values}."
215
+ end
216
+ @response = response
217
+ end
218
+
219
+ # Custom attribute writer method checking allowed values (enum).
220
+ # @param [Object] commit_type Object to be assigned
221
+ def commit_type=(commit_type)
222
+ validator = EnumAttributeValidator.new('String', ["ACCESS", "EXIT"])
223
+ unless validator.valid?(commit_type)
224
+ fail ArgumentError, "invalid value for \"commit_type\", must be one of #{validator.allowable_values}."
225
+ end
226
+ @commit_type = commit_type
227
+ end
228
+
229
+ # Checks equality by comparing each attribute.
230
+ # @param [Object] Object to be compared
231
+ def ==(o)
232
+ return true if self.equal?(o)
233
+ self.class == o.class &&
234
+ id == o.id &&
235
+ comment == o.comment &&
236
+ ticket == o.ticket &&
237
+ ticket_entry == o.ticket_entry &&
238
+ log_type == o.log_type &&
239
+ response == o.response &&
240
+ time == o.time &&
241
+ organizational_unit_number == o.organizational_unit_number &&
242
+ client == o.client &&
243
+ number_of_uses == o.number_of_uses &&
244
+ commit_type == o.commit_type &&
245
+ test_time == o.test_time
246
+ end
247
+
248
+ # @see the `==` method
249
+ # @param [Object] Object to be compared
250
+ def eql?(o)
251
+ self == o
252
+ end
253
+
254
+ # Calculates hash code according to all attributes.
255
+ # @return [Integer] Hash code
256
+ def hash
257
+ [id, comment, ticket, ticket_entry, log_type, response, time, organizational_unit_number, client, number_of_uses, commit_type, test_time].hash
258
+ end
259
+
260
+ # Builds the object from hash
261
+ # @param [Hash] attributes Model attributes in the form of hash
262
+ # @return [Object] Returns the model itself
263
+ def self.build_from_hash(attributes)
264
+ new.build_from_hash(attributes)
265
+ end
266
+
267
+ # Builds the object from hash
268
+ # @param [Hash] attributes Model attributes in the form of hash
269
+ # @return [Object] Returns the model itself
270
+ def build_from_hash(attributes)
271
+ return nil unless attributes.is_a?(Hash)
272
+ self.class.openapi_types.each_pair do |key, type|
273
+ if type =~ /\AArray<(.*)>/i
274
+ # check to ensure the input is an array given that the attribute
275
+ # is documented as an array but the input is not
276
+ if attributes[self.class.attribute_map[key]].is_a?(Array)
277
+ self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
278
+ end
279
+ elsif !attributes[self.class.attribute_map[key]].nil?
280
+ self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
281
+ end # or else data not found in attributes(hash), not an issue as the data can be optional
282
+ end
283
+
284
+ self
285
+ end
286
+
287
+ # Deserializes the data based on type
288
+ # @param string type Data type
289
+ # @param string value Value to be deserialized
290
+ # @return [Object] Deserialized data
291
+ def _deserialize(type, value)
292
+ case type.to_sym
293
+ when :DateTime
294
+ DateTime.parse(value)
295
+ when :Date
296
+ Date.parse(value)
297
+ when :String
298
+ value.to_s
299
+ when :Integer
300
+ value.to_i
301
+ when :Float
302
+ value.to_f
303
+ when :Boolean
304
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
305
+ true
306
+ else
307
+ false
308
+ end
309
+ when :Object
310
+ # generic object (usually a Hash), return directly
311
+ value
312
+ when /\AArray<(?<inner_type>.+)>\z/
313
+ inner_type = Regexp.last_match[:inner_type]
314
+ value.map { |v| _deserialize(inner_type, v) }
315
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
316
+ k_type = Regexp.last_match[:k_type]
317
+ v_type = Regexp.last_match[:v_type]
318
+ {}.tap do |hash|
319
+ value.each do |k, v|
320
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
321
+ end
322
+ end
323
+ else # model
324
+ KoronaEntryClient.const_get(type).build_from_hash(value)
325
+ end
326
+ end
327
+
328
+ # Returns the string representation of the object
329
+ # @return [String] String presentation of the object
330
+ def to_s
331
+ to_hash.to_s
332
+ end
333
+
334
+ # to_body is an alias to to_hash (backward compatibility)
335
+ # @return [Hash] Returns the object in the form of hash
336
+ def to_body
337
+ to_hash
338
+ end
339
+
340
+ # Returns the object in the form of hash
341
+ # @return [Hash] Returns the object in the form of hash
342
+ def to_hash
343
+ hash = {}
344
+ self.class.attribute_map.each_pair do |attr, param|
345
+ value = self.send(attr)
346
+ if value.nil?
347
+ is_nullable = self.class.openapi_nullable.include?(attr)
348
+ next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
349
+ end
350
+
351
+ hash[param] = _to_hash(value)
352
+ end
353
+ hash
354
+ end
355
+
356
+ # Outputs non-array value in the form of hash
357
+ # For object, use to_hash. Otherwise, just return the value
358
+ # @param [Object] value Any valid value
359
+ # @return [Hash] Returns the value in the form of hash
360
+ def _to_hash(value)
361
+ if value.is_a?(Array)
362
+ value.compact.map { |v| _to_hash(v) }
363
+ elsif value.is_a?(Hash)
364
+ {}.tap do |hash|
365
+ value.each { |k, v| hash[k] = _to_hash(v) }
366
+ end
367
+ elsif value.respond_to? :to_hash
368
+ value.to_hash
369
+ else
370
+ value
371
+ end
372
+ end
373
+ end
374
+ end