smplkit 3.0.117 → 3.0.118

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 (32) hide show
  1. checksums.yaml +4 -4
  2. data/lib/smplkit/_generated/jobs/lib/smplkit_jobs_client/api/retry_policies_api.rb +364 -0
  3. data/lib/smplkit/_generated/jobs/lib/smplkit_jobs_client/api/runs_api.rb +5 -2
  4. data/lib/smplkit/_generated/jobs/lib/smplkit_jobs_client/models/job.rb +12 -1
  5. data/lib/smplkit/_generated/jobs/lib/smplkit_jobs_client/models/job_environment.rb +12 -1
  6. data/lib/smplkit/_generated/jobs/lib/smplkit_jobs_client/models/retry_on.rb +185 -0
  7. data/lib/smplkit/_generated/jobs/lib/smplkit_jobs_client/models/retry_policy.rb +396 -0
  8. data/lib/smplkit/_generated/jobs/lib/smplkit_jobs_client/models/retry_policy_create_request.rb +165 -0
  9. data/lib/smplkit/_generated/jobs/lib/smplkit_jobs_client/models/retry_policy_create_resource.rb +237 -0
  10. data/lib/smplkit/_generated/jobs/lib/smplkit_jobs_client/models/retry_policy_list_response.rb +193 -0
  11. data/lib/smplkit/_generated/jobs/lib/smplkit_jobs_client/models/retry_policy_request.rb +165 -0
  12. data/lib/smplkit/_generated/jobs/lib/smplkit_jobs_client/models/retry_policy_resource.rb +186 -0
  13. data/lib/smplkit/_generated/jobs/lib/smplkit_jobs_client/models/retry_policy_response.rb +165 -0
  14. data/lib/smplkit/_generated/jobs/lib/smplkit_jobs_client/models/run.rb +15 -4
  15. data/lib/smplkit/_generated/jobs/lib/smplkit_jobs_client/models/run_list_meta.rb +1 -1
  16. data/lib/smplkit/_generated/jobs/lib/smplkit_jobs_client/models/run_retry.rb +193 -0
  17. data/lib/smplkit/_generated/jobs/lib/smplkit_jobs_client.rb +10 -0
  18. data/lib/smplkit/_generated/jobs/spec/api/retry_policies_api_spec.rb +100 -0
  19. data/lib/smplkit/_generated/jobs/spec/api/runs_api_spec.rb +2 -1
  20. data/lib/smplkit/_generated/jobs/spec/models/job_environment_spec.rb +6 -0
  21. data/lib/smplkit/_generated/jobs/spec/models/job_spec.rb +6 -0
  22. data/lib/smplkit/_generated/jobs/spec/models/retry_on_spec.rb +46 -0
  23. data/lib/smplkit/_generated/jobs/spec/models/retry_policy_create_request_spec.rb +36 -0
  24. data/lib/smplkit/_generated/jobs/spec/models/retry_policy_create_resource_spec.rb +52 -0
  25. data/lib/smplkit/_generated/jobs/spec/models/retry_policy_list_response_spec.rb +42 -0
  26. data/lib/smplkit/_generated/jobs/spec/models/retry_policy_request_spec.rb +36 -0
  27. data/lib/smplkit/_generated/jobs/spec/models/retry_policy_resource_spec.rb +48 -0
  28. data/lib/smplkit/_generated/jobs/spec/models/retry_policy_response_spec.rb +36 -0
  29. data/lib/smplkit/_generated/jobs/spec/models/retry_policy_spec.rb +94 -0
  30. data/lib/smplkit/_generated/jobs/spec/models/run_retry_spec.rb +42 -0
  31. data/lib/smplkit/_generated/jobs/spec/models/run_spec.rb +7 -1
  32. metadata +21 -1
@@ -0,0 +1,185 @@
1
+ =begin
2
+ #smplkit Jobs API
3
+
4
+ #Scheduled HTTP job execution API for smplkit.
5
+
6
+ The version of the OpenAPI document: 0.1.0
7
+
8
+ Generated by: https://openapi-generator.tech
9
+ Generator version: 7.22.0
10
+
11
+ =end
12
+
13
+ require 'date'
14
+ require 'time'
15
+
16
+ module SmplkitGeneratedClient::Jobs
17
+ # Which failures a policy retries. An empty policy (both lists empty or absent) retries nothing.
18
+ class RetryOn < ApiModelBase
19
+ # Response status codes that should be retried when a run fails because the response did not match the job's success status (for example `[429, 503]` to retry on rate-limit and unavailable). Each is a 3-digit HTTP status code. Empty matches no status.
20
+ attr_accessor :statuses
21
+
22
+ # Failure reasons that should be retried: `TIMEOUT` (the run did not complete in time), `CONNECTION_ERROR` (the endpoint could not be reached), or `NON_SUCCESS_STATUS` (any non-success response, regardless of `statuses`). Empty matches no reason.
23
+ attr_accessor :reasons
24
+
25
+ class EnumAttributeValidator
26
+ attr_reader :datatype
27
+ attr_reader :allowable_values
28
+
29
+ def initialize(datatype, allowable_values)
30
+ @allowable_values = allowable_values.map do |value|
31
+ case datatype.to_s
32
+ when /Integer/i
33
+ value.to_i
34
+ when /Float/i
35
+ value.to_f
36
+ else
37
+ value
38
+ end
39
+ end
40
+ end
41
+
42
+ def valid?(value)
43
+ !value || allowable_values.include?(value)
44
+ end
45
+ end
46
+
47
+ # Attribute mapping from ruby-style variable name to JSON key.
48
+ def self.attribute_map
49
+ {
50
+ :'statuses' => :'statuses',
51
+ :'reasons' => :'reasons'
52
+ }
53
+ end
54
+
55
+ # Returns attribute mapping this model knows about
56
+ def self.acceptable_attribute_map
57
+ attribute_map
58
+ end
59
+
60
+ # Returns all the JSON keys this model knows about
61
+ def self.acceptable_attributes
62
+ acceptable_attribute_map.values
63
+ end
64
+
65
+ # Attribute type mapping.
66
+ def self.openapi_types
67
+ {
68
+ :'statuses' => :'Array<Integer>',
69
+ :'reasons' => :'Array<String>'
70
+ }
71
+ end
72
+
73
+ # List of attributes with nullable: true
74
+ def self.openapi_nullable
75
+ Set.new([
76
+ ])
77
+ end
78
+
79
+ # Initializes the object
80
+ # @param [Hash] attributes Model attributes in the form of hash
81
+ def initialize(attributes = {})
82
+ if (!attributes.is_a?(Hash))
83
+ fail ArgumentError, "The input argument (attributes) must be a hash in `SmplkitGeneratedClient::Jobs::RetryOn` initialize method"
84
+ end
85
+
86
+ # check to see if the attribute exists and convert string to symbol for hash key
87
+ acceptable_attribute_map = self.class.acceptable_attribute_map
88
+ attributes = attributes.each_with_object({}) { |(k, v), h|
89
+ if (!acceptable_attribute_map.key?(k.to_sym))
90
+ fail ArgumentError, "`#{k}` is not a valid attribute in `SmplkitGeneratedClient::Jobs::RetryOn`. Please check the name to make sure it's valid. List of attributes: " + acceptable_attribute_map.keys.inspect
91
+ end
92
+ h[k.to_sym] = v
93
+ }
94
+
95
+ if attributes.key?(:'statuses')
96
+ if (value = attributes[:'statuses']).is_a?(Array)
97
+ self.statuses = value
98
+ end
99
+ end
100
+
101
+ if attributes.key?(:'reasons')
102
+ if (value = attributes[:'reasons']).is_a?(Array)
103
+ self.reasons = value
104
+ end
105
+ end
106
+ end
107
+
108
+ # Show invalid properties with the reasons. Usually used together with valid?
109
+ # @return Array for valid properties with the reasons
110
+ def list_invalid_properties
111
+ warn '[DEPRECATED] the `list_invalid_properties` method is obsolete'
112
+ invalid_properties = Array.new
113
+ invalid_properties
114
+ end
115
+
116
+ # Check to see if the all the properties in the model are valid
117
+ # @return true if the model is valid
118
+ def valid?
119
+ warn '[DEPRECATED] the `valid?` method is obsolete'
120
+ true
121
+ end
122
+
123
+ # Checks equality by comparing each attribute.
124
+ # @param [Object] Object to be compared
125
+ def ==(o)
126
+ return true if self.equal?(o)
127
+ self.class == o.class &&
128
+ statuses == o.statuses &&
129
+ reasons == o.reasons
130
+ end
131
+
132
+ # @see the `==` method
133
+ # @param [Object] Object to be compared
134
+ def eql?(o)
135
+ self == o
136
+ end
137
+
138
+ # Calculates hash code according to all attributes.
139
+ # @return [Integer] Hash code
140
+ def hash
141
+ [statuses, reasons].hash
142
+ end
143
+
144
+ # Builds the object from hash
145
+ # @param [Hash] attributes Model attributes in the form of hash
146
+ # @return [Object] Returns the model itself
147
+ def self.build_from_hash(attributes)
148
+ return nil unless attributes.is_a?(Hash)
149
+ attributes = attributes.transform_keys(&:to_sym)
150
+ transformed_hash = {}
151
+ openapi_types.each_pair do |key, type|
152
+ if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil?
153
+ transformed_hash["#{key}"] = nil
154
+ elsif type =~ /\AArray<(.*)>/i
155
+ # check to ensure the input is an array given that the attribute
156
+ # is documented as an array but the input is not
157
+ if attributes[attribute_map[key]].is_a?(Array)
158
+ transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) }
159
+ end
160
+ elsif !attributes[attribute_map[key]].nil?
161
+ transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]])
162
+ end
163
+ end
164
+ new(transformed_hash)
165
+ end
166
+
167
+ # Returns the object in the form of hash
168
+ # @return [Hash] Returns the object in the form of hash
169
+ def to_hash
170
+ hash = {}
171
+ self.class.attribute_map.each_pair do |attr, param|
172
+ value = self.send(attr)
173
+ if value.nil?
174
+ is_nullable = self.class.openapi_nullable.include?(attr)
175
+ next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
176
+ end
177
+
178
+ hash[param] = _to_hash(value)
179
+ end
180
+ hash
181
+ end
182
+
183
+ end
184
+
185
+ end
@@ -0,0 +1,396 @@
1
+ =begin
2
+ #smplkit Jobs API
3
+
4
+ #Scheduled HTTP job execution API for smplkit.
5
+
6
+ The version of the OpenAPI document: 0.1.0
7
+
8
+ Generated by: https://openapi-generator.tech
9
+ Generator version: 7.22.0
10
+
11
+ =end
12
+
13
+ require 'date'
14
+ require 'time'
15
+
16
+ module SmplkitGeneratedClient::Jobs
17
+ # A named, reusable automatic-retry policy. A policy decides whether and how a failed run is retried. Reference it from a job's `retry_policy` (and optionally override it per environment). A job that references nothing uses the built-in `Default` policy, which never retries.
18
+ class RetryPolicy < ApiModelBase
19
+ # Human-readable name for the policy.
20
+ attr_accessor :name
21
+
22
+ # How many times a failed run is retried, after the initial attempt — so `max_retries` of 3 means up to 4 attempts in total. `0` disables retries. Maximum 10.
23
+ attr_accessor :max_retries
24
+
25
+ # How the wait between retries grows. `fixed` waits `delay_seconds` before every retry. `exponential` doubles the wait each time — `delay_seconds`, then `2×`, `4×`, … — capped at `max_delay_seconds`.
26
+ attr_accessor :backoff
27
+
28
+ # The wait before a retry, in seconds. For `fixed` backoff it is the constant wait before every retry; for `exponential` it is the base wait that doubles each retry.
29
+ attr_accessor :delay_seconds
30
+
31
+ # The ceiling on the wait between retries, in seconds, for `exponential` backoff — once the doubling reaches it, every subsequent retry waits this long. Only valid with `exponential` backoff; omit it for `fixed`.
32
+ attr_accessor :max_delay_seconds
33
+
34
+ # Which failures are retried. A run is retried only when its failure matches this set; an empty set retries nothing. Some failures are never retried regardless of this value.
35
+ attr_accessor :retry_on
36
+
37
+ # When the policy was created.
38
+ attr_accessor :created_at
39
+
40
+ # When the policy was last modified.
41
+ attr_accessor :updated_at
42
+
43
+ # When the policy was deleted. `null` for active policies.
44
+ attr_accessor :deleted_at
45
+
46
+ # Monotonic counter incremented on every update, starting at 1.
47
+ attr_accessor :version
48
+
49
+ class EnumAttributeValidator
50
+ attr_reader :datatype
51
+ attr_reader :allowable_values
52
+
53
+ def initialize(datatype, allowable_values)
54
+ @allowable_values = allowable_values.map do |value|
55
+ case datatype.to_s
56
+ when /Integer/i
57
+ value.to_i
58
+ when /Float/i
59
+ value.to_f
60
+ else
61
+ value
62
+ end
63
+ end
64
+ end
65
+
66
+ def valid?(value)
67
+ !value || allowable_values.include?(value)
68
+ end
69
+ end
70
+
71
+ # Attribute mapping from ruby-style variable name to JSON key.
72
+ def self.attribute_map
73
+ {
74
+ :'name' => :'name',
75
+ :'max_retries' => :'max_retries',
76
+ :'backoff' => :'backoff',
77
+ :'delay_seconds' => :'delay_seconds',
78
+ :'max_delay_seconds' => :'max_delay_seconds',
79
+ :'retry_on' => :'retry_on',
80
+ :'created_at' => :'created_at',
81
+ :'updated_at' => :'updated_at',
82
+ :'deleted_at' => :'deleted_at',
83
+ :'version' => :'version'
84
+ }
85
+ end
86
+
87
+ # Returns attribute mapping this model knows about
88
+ def self.acceptable_attribute_map
89
+ attribute_map
90
+ end
91
+
92
+ # Returns all the JSON keys this model knows about
93
+ def self.acceptable_attributes
94
+ acceptable_attribute_map.values
95
+ end
96
+
97
+ # Attribute type mapping.
98
+ def self.openapi_types
99
+ {
100
+ :'name' => :'String',
101
+ :'max_retries' => :'Integer',
102
+ :'backoff' => :'String',
103
+ :'delay_seconds' => :'Integer',
104
+ :'max_delay_seconds' => :'Integer',
105
+ :'retry_on' => :'RetryOn',
106
+ :'created_at' => :'Time',
107
+ :'updated_at' => :'Time',
108
+ :'deleted_at' => :'Time',
109
+ :'version' => :'Integer'
110
+ }
111
+ end
112
+
113
+ # List of attributes with nullable: true
114
+ def self.openapi_nullable
115
+ Set.new([
116
+ :'max_delay_seconds',
117
+ :'created_at',
118
+ :'updated_at',
119
+ :'deleted_at',
120
+ :'version'
121
+ ])
122
+ end
123
+
124
+ # Initializes the object
125
+ # @param [Hash] attributes Model attributes in the form of hash
126
+ def initialize(attributes = {})
127
+ if (!attributes.is_a?(Hash))
128
+ fail ArgumentError, "The input argument (attributes) must be a hash in `SmplkitGeneratedClient::Jobs::RetryPolicy` initialize method"
129
+ end
130
+
131
+ # check to see if the attribute exists and convert string to symbol for hash key
132
+ acceptable_attribute_map = self.class.acceptable_attribute_map
133
+ attributes = attributes.each_with_object({}) { |(k, v), h|
134
+ if (!acceptable_attribute_map.key?(k.to_sym))
135
+ fail ArgumentError, "`#{k}` is not a valid attribute in `SmplkitGeneratedClient::Jobs::RetryPolicy`. Please check the name to make sure it's valid. List of attributes: " + acceptable_attribute_map.keys.inspect
136
+ end
137
+ h[k.to_sym] = v
138
+ }
139
+
140
+ if attributes.key?(:'name')
141
+ self.name = attributes[:'name']
142
+ else
143
+ self.name = nil
144
+ end
145
+
146
+ if attributes.key?(:'max_retries')
147
+ self.max_retries = attributes[:'max_retries']
148
+ else
149
+ self.max_retries = nil
150
+ end
151
+
152
+ if attributes.key?(:'backoff')
153
+ self.backoff = attributes[:'backoff']
154
+ else
155
+ self.backoff = nil
156
+ end
157
+
158
+ if attributes.key?(:'delay_seconds')
159
+ self.delay_seconds = attributes[:'delay_seconds']
160
+ else
161
+ self.delay_seconds = nil
162
+ end
163
+
164
+ if attributes.key?(:'max_delay_seconds')
165
+ self.max_delay_seconds = attributes[:'max_delay_seconds']
166
+ end
167
+
168
+ if attributes.key?(:'retry_on')
169
+ self.retry_on = attributes[:'retry_on']
170
+ end
171
+
172
+ if attributes.key?(:'created_at')
173
+ self.created_at = attributes[:'created_at']
174
+ end
175
+
176
+ if attributes.key?(:'updated_at')
177
+ self.updated_at = attributes[:'updated_at']
178
+ end
179
+
180
+ if attributes.key?(:'deleted_at')
181
+ self.deleted_at = attributes[:'deleted_at']
182
+ end
183
+
184
+ if attributes.key?(:'version')
185
+ self.version = attributes[:'version']
186
+ end
187
+ end
188
+
189
+ # Show invalid properties with the reasons. Usually used together with valid?
190
+ # @return Array for valid properties with the reasons
191
+ def list_invalid_properties
192
+ warn '[DEPRECATED] the `list_invalid_properties` method is obsolete'
193
+ invalid_properties = Array.new
194
+ if @name.nil?
195
+ invalid_properties.push('invalid value for "name", name cannot be nil.')
196
+ end
197
+
198
+ if @name.to_s.length > 200
199
+ invalid_properties.push('invalid value for "name", the character length must be smaller than or equal to 200.')
200
+ end
201
+
202
+ if @name.to_s.length < 1
203
+ invalid_properties.push('invalid value for "name", the character length must be greater than or equal to 1.')
204
+ end
205
+
206
+ if @max_retries.nil?
207
+ invalid_properties.push('invalid value for "max_retries", max_retries cannot be nil.')
208
+ end
209
+
210
+ if @max_retries > 10
211
+ invalid_properties.push('invalid value for "max_retries", must be smaller than or equal to 10.')
212
+ end
213
+
214
+ if @max_retries < 0
215
+ invalid_properties.push('invalid value for "max_retries", must be greater than or equal to 0.')
216
+ end
217
+
218
+ if @backoff.nil?
219
+ invalid_properties.push('invalid value for "backoff", backoff cannot be nil.')
220
+ end
221
+
222
+ if @delay_seconds.nil?
223
+ invalid_properties.push('invalid value for "delay_seconds", delay_seconds cannot be nil.')
224
+ end
225
+
226
+ if @delay_seconds < 1
227
+ invalid_properties.push('invalid value for "delay_seconds", must be greater than or equal to 1.')
228
+ end
229
+
230
+ if !@max_delay_seconds.nil? && @max_delay_seconds < 1
231
+ invalid_properties.push('invalid value for "max_delay_seconds", must be greater than or equal to 1.')
232
+ end
233
+
234
+ invalid_properties
235
+ end
236
+
237
+ # Check to see if the all the properties in the model are valid
238
+ # @return true if the model is valid
239
+ def valid?
240
+ warn '[DEPRECATED] the `valid?` method is obsolete'
241
+ return false if @name.nil?
242
+ return false if @name.to_s.length > 200
243
+ return false if @name.to_s.length < 1
244
+ return false if @max_retries.nil?
245
+ return false if @max_retries > 10
246
+ return false if @max_retries < 0
247
+ return false if @backoff.nil?
248
+ backoff_validator = EnumAttributeValidator.new('String', ["fixed", "exponential"])
249
+ return false unless backoff_validator.valid?(@backoff)
250
+ return false if @delay_seconds.nil?
251
+ return false if @delay_seconds < 1
252
+ return false if !@max_delay_seconds.nil? && @max_delay_seconds < 1
253
+ true
254
+ end
255
+
256
+ # Custom attribute writer method with validation
257
+ # @param [Object] name Value to be assigned
258
+ def name=(name)
259
+ if name.nil?
260
+ fail ArgumentError, 'name cannot be nil'
261
+ end
262
+
263
+ if name.to_s.length > 200
264
+ fail ArgumentError, 'invalid value for "name", the character length must be smaller than or equal to 200.'
265
+ end
266
+
267
+ if name.to_s.length < 1
268
+ fail ArgumentError, 'invalid value for "name", the character length must be greater than or equal to 1.'
269
+ end
270
+
271
+ @name = name
272
+ end
273
+
274
+ # Custom attribute writer method with validation
275
+ # @param [Object] max_retries Value to be assigned
276
+ def max_retries=(max_retries)
277
+ if max_retries.nil?
278
+ fail ArgumentError, 'max_retries cannot be nil'
279
+ end
280
+
281
+ if max_retries > 10
282
+ fail ArgumentError, 'invalid value for "max_retries", must be smaller than or equal to 10.'
283
+ end
284
+
285
+ if max_retries < 0
286
+ fail ArgumentError, 'invalid value for "max_retries", must be greater than or equal to 0.'
287
+ end
288
+
289
+ @max_retries = max_retries
290
+ end
291
+
292
+ # Custom attribute writer method checking allowed values (enum).
293
+ # @param [Object] backoff Object to be assigned
294
+ def backoff=(backoff)
295
+ validator = EnumAttributeValidator.new('String', ["fixed", "exponential"])
296
+ unless validator.valid?(backoff)
297
+ fail ArgumentError, "invalid value for \"backoff\", must be one of #{validator.allowable_values}."
298
+ end
299
+ @backoff = backoff
300
+ end
301
+
302
+ # Custom attribute writer method with validation
303
+ # @param [Object] delay_seconds Value to be assigned
304
+ def delay_seconds=(delay_seconds)
305
+ if delay_seconds.nil?
306
+ fail ArgumentError, 'delay_seconds cannot be nil'
307
+ end
308
+
309
+ if delay_seconds < 1
310
+ fail ArgumentError, 'invalid value for "delay_seconds", must be greater than or equal to 1.'
311
+ end
312
+
313
+ @delay_seconds = delay_seconds
314
+ end
315
+
316
+ # Custom attribute writer method with validation
317
+ # @param [Object] max_delay_seconds Value to be assigned
318
+ def max_delay_seconds=(max_delay_seconds)
319
+ if !max_delay_seconds.nil? && max_delay_seconds < 1
320
+ fail ArgumentError, 'invalid value for "max_delay_seconds", must be greater than or equal to 1.'
321
+ end
322
+
323
+ @max_delay_seconds = max_delay_seconds
324
+ end
325
+
326
+ # Checks equality by comparing each attribute.
327
+ # @param [Object] Object to be compared
328
+ def ==(o)
329
+ return true if self.equal?(o)
330
+ self.class == o.class &&
331
+ name == o.name &&
332
+ max_retries == o.max_retries &&
333
+ backoff == o.backoff &&
334
+ delay_seconds == o.delay_seconds &&
335
+ max_delay_seconds == o.max_delay_seconds &&
336
+ retry_on == o.retry_on &&
337
+ created_at == o.created_at &&
338
+ updated_at == o.updated_at &&
339
+ deleted_at == o.deleted_at &&
340
+ version == o.version
341
+ end
342
+
343
+ # @see the `==` method
344
+ # @param [Object] Object to be compared
345
+ def eql?(o)
346
+ self == o
347
+ end
348
+
349
+ # Calculates hash code according to all attributes.
350
+ # @return [Integer] Hash code
351
+ def hash
352
+ [name, max_retries, backoff, delay_seconds, max_delay_seconds, retry_on, created_at, updated_at, deleted_at, version].hash
353
+ end
354
+
355
+ # Builds the object from hash
356
+ # @param [Hash] attributes Model attributes in the form of hash
357
+ # @return [Object] Returns the model itself
358
+ def self.build_from_hash(attributes)
359
+ return nil unless attributes.is_a?(Hash)
360
+ attributes = attributes.transform_keys(&:to_sym)
361
+ transformed_hash = {}
362
+ openapi_types.each_pair do |key, type|
363
+ if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil?
364
+ transformed_hash["#{key}"] = nil
365
+ elsif type =~ /\AArray<(.*)>/i
366
+ # check to ensure the input is an array given that the attribute
367
+ # is documented as an array but the input is not
368
+ if attributes[attribute_map[key]].is_a?(Array)
369
+ transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) }
370
+ end
371
+ elsif !attributes[attribute_map[key]].nil?
372
+ transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]])
373
+ end
374
+ end
375
+ new(transformed_hash)
376
+ end
377
+
378
+ # Returns the object in the form of hash
379
+ # @return [Hash] Returns the object in the form of hash
380
+ def to_hash
381
+ hash = {}
382
+ self.class.attribute_map.each_pair do |attr, param|
383
+ value = self.send(attr)
384
+ if value.nil?
385
+ is_nullable = self.class.openapi_nullable.include?(attr)
386
+ next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
387
+ end
388
+
389
+ hash[param] = _to_hash(value)
390
+ end
391
+ hash
392
+ end
393
+
394
+ end
395
+
396
+ end