smplkit 3.0.82 → 3.0.83

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 (55) hide show
  1. checksums.yaml +4 -4
  2. data/lib/smplkit/_generated/jobs/lib/smplkit_jobs_client/api/jobs_api.rb +420 -0
  3. data/lib/smplkit/_generated/jobs/lib/smplkit_jobs_client/api/runs_api.rb +281 -0
  4. data/lib/smplkit/_generated/jobs/lib/smplkit_jobs_client/api/usage_api.rb +82 -0
  5. data/lib/smplkit/_generated/jobs/lib/smplkit_jobs_client/api_client.rb +441 -0
  6. data/lib/smplkit/_generated/jobs/lib/smplkit_jobs_client/api_error.rb +58 -0
  7. data/lib/smplkit/_generated/jobs/lib/smplkit_jobs_client/api_model_base.rb +88 -0
  8. data/lib/smplkit/_generated/jobs/lib/smplkit_jobs_client/configuration.rb +392 -0
  9. data/lib/smplkit/_generated/jobs/lib/smplkit_jobs_client/models/http_header.rb +220 -0
  10. data/lib/smplkit/_generated/jobs/lib/smplkit_jobs_client/models/job.rb +401 -0
  11. data/lib/smplkit/_generated/jobs/lib/smplkit_jobs_client/models/job_create_request.rb +165 -0
  12. data/lib/smplkit/_generated/jobs/lib/smplkit_jobs_client/models/job_create_resource.rb +237 -0
  13. data/lib/smplkit/_generated/jobs/lib/smplkit_jobs_client/models/job_http_configuration.rb +368 -0
  14. data/lib/smplkit/_generated/jobs/lib/smplkit_jobs_client/models/job_list_response.rb +193 -0
  15. data/lib/smplkit/_generated/jobs/lib/smplkit_jobs_client/models/job_request.rb +165 -0
  16. data/lib/smplkit/_generated/jobs/lib/smplkit_jobs_client/models/job_resource.rb +186 -0
  17. data/lib/smplkit/_generated/jobs/lib/smplkit_jobs_client/models/job_response.rb +165 -0
  18. data/lib/smplkit/_generated/jobs/lib/smplkit_jobs_client/models/list_meta.rb +165 -0
  19. data/lib/smplkit/_generated/jobs/lib/smplkit_jobs_client/models/pagination_meta.rb +215 -0
  20. data/lib/smplkit/_generated/jobs/lib/smplkit_jobs_client/models/run.rb +405 -0
  21. data/lib/smplkit/_generated/jobs/lib/smplkit_jobs_client/models/run_list_links.rb +149 -0
  22. data/lib/smplkit/_generated/jobs/lib/smplkit_jobs_client/models/run_list_meta.rb +166 -0
  23. data/lib/smplkit/_generated/jobs/lib/smplkit_jobs_client/models/run_list_response.rb +203 -0
  24. data/lib/smplkit/_generated/jobs/lib/smplkit_jobs_client/models/run_resource.rb +202 -0
  25. data/lib/smplkit/_generated/jobs/lib/smplkit_jobs_client/models/run_response.rb +165 -0
  26. data/lib/smplkit/_generated/jobs/lib/smplkit_jobs_client/models/usage.rb +274 -0
  27. data/lib/smplkit/_generated/jobs/lib/smplkit_jobs_client/models/usage_resource.rb +187 -0
  28. data/lib/smplkit/_generated/jobs/lib/smplkit_jobs_client/models/usage_response.rb +165 -0
  29. data/lib/smplkit/_generated/jobs/lib/smplkit_jobs_client/version.rb +15 -0
  30. data/lib/smplkit/_generated/jobs/lib/smplkit_jobs_client.rb +63 -0
  31. data/lib/smplkit/_generated/jobs/spec/api/jobs_api_spec.rb +111 -0
  32. data/lib/smplkit/_generated/jobs/spec/api/runs_api_spec.rb +85 -0
  33. data/lib/smplkit/_generated/jobs/spec/api/usage_api_spec.rb +47 -0
  34. data/lib/smplkit/_generated/jobs/spec/models/http_header_spec.rb +42 -0
  35. data/lib/smplkit/_generated/jobs/spec/models/job_create_request_spec.rb +36 -0
  36. data/lib/smplkit/_generated/jobs/spec/models/job_create_resource_spec.rb +52 -0
  37. data/lib/smplkit/_generated/jobs/spec/models/job_http_configuration_spec.rb +82 -0
  38. data/lib/smplkit/_generated/jobs/spec/models/job_list_response_spec.rb +42 -0
  39. data/lib/smplkit/_generated/jobs/spec/models/job_request_spec.rb +36 -0
  40. data/lib/smplkit/_generated/jobs/spec/models/job_resource_spec.rb +48 -0
  41. data/lib/smplkit/_generated/jobs/spec/models/job_response_spec.rb +36 -0
  42. data/lib/smplkit/_generated/jobs/spec/models/job_spec.rb +110 -0
  43. data/lib/smplkit/_generated/jobs/spec/models/list_meta_spec.rb +36 -0
  44. data/lib/smplkit/_generated/jobs/spec/models/pagination_meta_spec.rb +54 -0
  45. data/lib/smplkit/_generated/jobs/spec/models/run_list_links_spec.rb +36 -0
  46. data/lib/smplkit/_generated/jobs/spec/models/run_list_meta_spec.rb +36 -0
  47. data/lib/smplkit/_generated/jobs/spec/models/run_list_response_spec.rb +48 -0
  48. data/lib/smplkit/_generated/jobs/spec/models/run_resource_spec.rb +48 -0
  49. data/lib/smplkit/_generated/jobs/spec/models/run_response_spec.rb +36 -0
  50. data/lib/smplkit/_generated/jobs/spec/models/run_spec.rb +138 -0
  51. data/lib/smplkit/_generated/jobs/spec/models/usage_resource_spec.rb +48 -0
  52. data/lib/smplkit/_generated/jobs/spec/models/usage_response_spec.rb +36 -0
  53. data/lib/smplkit/_generated/jobs/spec/models/usage_spec.rb +60 -0
  54. data/lib/smplkit/_generated/jobs/spec/spec_helper.rb +111 -0
  55. metadata +54 -1
@@ -0,0 +1,401 @@
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 scheduled unit of work: an HTTP request run on a schedule. The job is the definition; each time it fires the service records a run capturing the request, response, timing, and outcome.
18
+ class Job < ApiModelBase
19
+ # Human-readable name for the job.
20
+ attr_accessor :name
21
+
22
+ # Free-text description for the job.
23
+ attr_accessor :description
24
+
25
+ # Whether the job is scheduling runs. Set to `false` to pause without deleting.
26
+ attr_accessor :enabled
27
+
28
+ # Job type. Only `http` is supported today.
29
+ attr_accessor :type
30
+
31
+ # When the job runs. One of: an ISO-8601 datetime (a one-off run at that instant), a 5-field cron expression evaluated in **UTC** (recurring), or the literal `now` (run once, as soon as possible). A datetime or `now` job disables itself after it fires.
32
+ attr_accessor :schedule
33
+
34
+ # The HTTP request to perform, including method, url, headers, body, and timeout.
35
+ attr_accessor :configuration
36
+
37
+ # How overlapping runs are handled. `ALLOW` (the only value today) permits them.
38
+ attr_accessor :concurrency_policy
39
+
40
+ # The next scheduled fire time. `null` once a one-off job has fired.
41
+ attr_accessor :next_run_at
42
+
43
+ # When the job was created.
44
+ attr_accessor :created_at
45
+
46
+ # When the job was last modified.
47
+ attr_accessor :updated_at
48
+
49
+ # When the job was deleted. `null` for active jobs.
50
+ attr_accessor :deleted_at
51
+
52
+ # Monotonic counter incremented on every update, starting at 1.
53
+ attr_accessor :version
54
+
55
+ class EnumAttributeValidator
56
+ attr_reader :datatype
57
+ attr_reader :allowable_values
58
+
59
+ def initialize(datatype, allowable_values)
60
+ @allowable_values = allowable_values.map do |value|
61
+ case datatype.to_s
62
+ when /Integer/i
63
+ value.to_i
64
+ when /Float/i
65
+ value.to_f
66
+ else
67
+ value
68
+ end
69
+ end
70
+ end
71
+
72
+ def valid?(value)
73
+ !value || allowable_values.include?(value)
74
+ end
75
+ end
76
+
77
+ # Attribute mapping from ruby-style variable name to JSON key.
78
+ def self.attribute_map
79
+ {
80
+ :'name' => :'name',
81
+ :'description' => :'description',
82
+ :'enabled' => :'enabled',
83
+ :'type' => :'type',
84
+ :'schedule' => :'schedule',
85
+ :'configuration' => :'configuration',
86
+ :'concurrency_policy' => :'concurrency_policy',
87
+ :'next_run_at' => :'next_run_at',
88
+ :'created_at' => :'created_at',
89
+ :'updated_at' => :'updated_at',
90
+ :'deleted_at' => :'deleted_at',
91
+ :'version' => :'version'
92
+ }
93
+ end
94
+
95
+ # Returns attribute mapping this model knows about
96
+ def self.acceptable_attribute_map
97
+ attribute_map
98
+ end
99
+
100
+ # Returns all the JSON keys this model knows about
101
+ def self.acceptable_attributes
102
+ acceptable_attribute_map.values
103
+ end
104
+
105
+ # Attribute type mapping.
106
+ def self.openapi_types
107
+ {
108
+ :'name' => :'String',
109
+ :'description' => :'String',
110
+ :'enabled' => :'Boolean',
111
+ :'type' => :'String',
112
+ :'schedule' => :'String',
113
+ :'configuration' => :'JobHttpConfiguration',
114
+ :'concurrency_policy' => :'String',
115
+ :'next_run_at' => :'Time',
116
+ :'created_at' => :'Time',
117
+ :'updated_at' => :'Time',
118
+ :'deleted_at' => :'Time',
119
+ :'version' => :'Integer'
120
+ }
121
+ end
122
+
123
+ # List of attributes with nullable: true
124
+ def self.openapi_nullable
125
+ Set.new([
126
+ :'description',
127
+ :'next_run_at',
128
+ :'created_at',
129
+ :'updated_at',
130
+ :'deleted_at',
131
+ :'version'
132
+ ])
133
+ end
134
+
135
+ # Initializes the object
136
+ # @param [Hash] attributes Model attributes in the form of hash
137
+ def initialize(attributes = {})
138
+ if (!attributes.is_a?(Hash))
139
+ fail ArgumentError, "The input argument (attributes) must be a hash in `SmplkitGeneratedClient::Jobs::Job` initialize method"
140
+ end
141
+
142
+ # check to see if the attribute exists and convert string to symbol for hash key
143
+ acceptable_attribute_map = self.class.acceptable_attribute_map
144
+ attributes = attributes.each_with_object({}) { |(k, v), h|
145
+ if (!acceptable_attribute_map.key?(k.to_sym))
146
+ fail ArgumentError, "`#{k}` is not a valid attribute in `SmplkitGeneratedClient::Jobs::Job`. Please check the name to make sure it's valid. List of attributes: " + acceptable_attribute_map.keys.inspect
147
+ end
148
+ h[k.to_sym] = v
149
+ }
150
+
151
+ if attributes.key?(:'name')
152
+ self.name = attributes[:'name']
153
+ else
154
+ self.name = nil
155
+ end
156
+
157
+ if attributes.key?(:'description')
158
+ self.description = attributes[:'description']
159
+ end
160
+
161
+ if attributes.key?(:'enabled')
162
+ self.enabled = attributes[:'enabled']
163
+ else
164
+ self.enabled = true
165
+ end
166
+
167
+ if attributes.key?(:'type')
168
+ self.type = attributes[:'type']
169
+ else
170
+ self.type = 'http'
171
+ end
172
+
173
+ if attributes.key?(:'schedule')
174
+ self.schedule = attributes[:'schedule']
175
+ else
176
+ self.schedule = nil
177
+ end
178
+
179
+ if attributes.key?(:'configuration')
180
+ self.configuration = attributes[:'configuration']
181
+ else
182
+ self.configuration = nil
183
+ end
184
+
185
+ if attributes.key?(:'concurrency_policy')
186
+ self.concurrency_policy = attributes[:'concurrency_policy']
187
+ else
188
+ self.concurrency_policy = 'ALLOW'
189
+ end
190
+
191
+ if attributes.key?(:'next_run_at')
192
+ self.next_run_at = attributes[:'next_run_at']
193
+ end
194
+
195
+ if attributes.key?(:'created_at')
196
+ self.created_at = attributes[:'created_at']
197
+ end
198
+
199
+ if attributes.key?(:'updated_at')
200
+ self.updated_at = attributes[:'updated_at']
201
+ end
202
+
203
+ if attributes.key?(:'deleted_at')
204
+ self.deleted_at = attributes[:'deleted_at']
205
+ end
206
+
207
+ if attributes.key?(:'version')
208
+ self.version = attributes[:'version']
209
+ end
210
+ end
211
+
212
+ # Show invalid properties with the reasons. Usually used together with valid?
213
+ # @return Array for valid properties with the reasons
214
+ def list_invalid_properties
215
+ warn '[DEPRECATED] the `list_invalid_properties` method is obsolete'
216
+ invalid_properties = Array.new
217
+ if @name.nil?
218
+ invalid_properties.push('invalid value for "name", name cannot be nil.')
219
+ end
220
+
221
+ if @name.to_s.length > 200
222
+ invalid_properties.push('invalid value for "name", the character length must be smaller than or equal to 200.')
223
+ end
224
+
225
+ if @name.to_s.length < 1
226
+ invalid_properties.push('invalid value for "name", the character length must be greater than or equal to 1.')
227
+ end
228
+
229
+ if !@description.nil? && @description.to_s.length > 2000
230
+ invalid_properties.push('invalid value for "description", the character length must be smaller than or equal to 2000.')
231
+ end
232
+
233
+ if @schedule.nil?
234
+ invalid_properties.push('invalid value for "schedule", schedule cannot be nil.')
235
+ end
236
+
237
+ if @configuration.nil?
238
+ invalid_properties.push('invalid value for "configuration", configuration cannot be nil.')
239
+ end
240
+
241
+ invalid_properties
242
+ end
243
+
244
+ # Check to see if the all the properties in the model are valid
245
+ # @return true if the model is valid
246
+ def valid?
247
+ warn '[DEPRECATED] the `valid?` method is obsolete'
248
+ return false if @name.nil?
249
+ return false if @name.to_s.length > 200
250
+ return false if @name.to_s.length < 1
251
+ return false if !@description.nil? && @description.to_s.length > 2000
252
+ type_validator = EnumAttributeValidator.new('String', ["http"])
253
+ return false unless type_validator.valid?(@type)
254
+ return false if @schedule.nil?
255
+ return false if @configuration.nil?
256
+ concurrency_policy_validator = EnumAttributeValidator.new('String', ["ALLOW"])
257
+ return false unless concurrency_policy_validator.valid?(@concurrency_policy)
258
+ true
259
+ end
260
+
261
+ # Custom attribute writer method with validation
262
+ # @param [Object] name Value to be assigned
263
+ def name=(name)
264
+ if name.nil?
265
+ fail ArgumentError, 'name cannot be nil'
266
+ end
267
+
268
+ if name.to_s.length > 200
269
+ fail ArgumentError, 'invalid value for "name", the character length must be smaller than or equal to 200.'
270
+ end
271
+
272
+ if name.to_s.length < 1
273
+ fail ArgumentError, 'invalid value for "name", the character length must be greater than or equal to 1.'
274
+ end
275
+
276
+ @name = name
277
+ end
278
+
279
+ # Custom attribute writer method with validation
280
+ # @param [Object] description Value to be assigned
281
+ def description=(description)
282
+ if !description.nil? && description.to_s.length > 2000
283
+ fail ArgumentError, 'invalid value for "description", the character length must be smaller than or equal to 2000.'
284
+ end
285
+
286
+ @description = description
287
+ end
288
+
289
+ # Custom attribute writer method checking allowed values (enum).
290
+ # @param [Object] type Object to be assigned
291
+ def type=(type)
292
+ validator = EnumAttributeValidator.new('String', ["http"])
293
+ unless validator.valid?(type)
294
+ fail ArgumentError, "invalid value for \"type\", must be one of #{validator.allowable_values}."
295
+ end
296
+ @type = type
297
+ end
298
+
299
+ # Custom attribute writer method with validation
300
+ # @param [Object] schedule Value to be assigned
301
+ def schedule=(schedule)
302
+ if schedule.nil?
303
+ fail ArgumentError, 'schedule cannot be nil'
304
+ end
305
+
306
+ @schedule = schedule
307
+ end
308
+
309
+ # Custom attribute writer method with validation
310
+ # @param [Object] configuration Value to be assigned
311
+ def configuration=(configuration)
312
+ if configuration.nil?
313
+ fail ArgumentError, 'configuration cannot be nil'
314
+ end
315
+
316
+ @configuration = configuration
317
+ end
318
+
319
+ # Custom attribute writer method checking allowed values (enum).
320
+ # @param [Object] concurrency_policy Object to be assigned
321
+ def concurrency_policy=(concurrency_policy)
322
+ validator = EnumAttributeValidator.new('String', ["ALLOW"])
323
+ unless validator.valid?(concurrency_policy)
324
+ fail ArgumentError, "invalid value for \"concurrency_policy\", must be one of #{validator.allowable_values}."
325
+ end
326
+ @concurrency_policy = concurrency_policy
327
+ end
328
+
329
+ # Checks equality by comparing each attribute.
330
+ # @param [Object] Object to be compared
331
+ def ==(o)
332
+ return true if self.equal?(o)
333
+ self.class == o.class &&
334
+ name == o.name &&
335
+ description == o.description &&
336
+ enabled == o.enabled &&
337
+ type == o.type &&
338
+ schedule == o.schedule &&
339
+ configuration == o.configuration &&
340
+ concurrency_policy == o.concurrency_policy &&
341
+ next_run_at == o.next_run_at &&
342
+ created_at == o.created_at &&
343
+ updated_at == o.updated_at &&
344
+ deleted_at == o.deleted_at &&
345
+ version == o.version
346
+ end
347
+
348
+ # @see the `==` method
349
+ # @param [Object] Object to be compared
350
+ def eql?(o)
351
+ self == o
352
+ end
353
+
354
+ # Calculates hash code according to all attributes.
355
+ # @return [Integer] Hash code
356
+ def hash
357
+ [name, description, enabled, type, schedule, configuration, concurrency_policy, next_run_at, created_at, updated_at, deleted_at, version].hash
358
+ end
359
+
360
+ # Builds the object from hash
361
+ # @param [Hash] attributes Model attributes in the form of hash
362
+ # @return [Object] Returns the model itself
363
+ def self.build_from_hash(attributes)
364
+ return nil unless attributes.is_a?(Hash)
365
+ attributes = attributes.transform_keys(&:to_sym)
366
+ transformed_hash = {}
367
+ openapi_types.each_pair do |key, type|
368
+ if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil?
369
+ transformed_hash["#{key}"] = nil
370
+ elsif type =~ /\AArray<(.*)>/i
371
+ # check to ensure the input is an array given that the attribute
372
+ # is documented as an array but the input is not
373
+ if attributes[attribute_map[key]].is_a?(Array)
374
+ transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) }
375
+ end
376
+ elsif !attributes[attribute_map[key]].nil?
377
+ transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]])
378
+ end
379
+ end
380
+ new(transformed_hash)
381
+ end
382
+
383
+ # Returns the object in the form of hash
384
+ # @return [Hash] Returns the object in the form of hash
385
+ def to_hash
386
+ hash = {}
387
+ self.class.attribute_map.each_pair do |attr, param|
388
+ value = self.send(attr)
389
+ if value.nil?
390
+ is_nullable = self.class.openapi_nullable.include?(attr)
391
+ next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
392
+ end
393
+
394
+ hash[param] = _to_hash(value)
395
+ end
396
+ hash
397
+ end
398
+
399
+ end
400
+
401
+ end
@@ -0,0 +1,165 @@
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
+ # JSON:API request envelope for creating a job (caller-supplied `data.id`).
18
+ class JobCreateRequest < ApiModelBase
19
+ attr_accessor :data
20
+
21
+ # Attribute mapping from ruby-style variable name to JSON key.
22
+ def self.attribute_map
23
+ {
24
+ :'data' => :'data'
25
+ }
26
+ end
27
+
28
+ # Returns attribute mapping this model knows about
29
+ def self.acceptable_attribute_map
30
+ attribute_map
31
+ end
32
+
33
+ # Returns all the JSON keys this model knows about
34
+ def self.acceptable_attributes
35
+ acceptable_attribute_map.values
36
+ end
37
+
38
+ # Attribute type mapping.
39
+ def self.openapi_types
40
+ {
41
+ :'data' => :'JobCreateResource'
42
+ }
43
+ end
44
+
45
+ # List of attributes with nullable: true
46
+ def self.openapi_nullable
47
+ Set.new([
48
+ ])
49
+ end
50
+
51
+ # Initializes the object
52
+ # @param [Hash] attributes Model attributes in the form of hash
53
+ def initialize(attributes = {})
54
+ if (!attributes.is_a?(Hash))
55
+ fail ArgumentError, "The input argument (attributes) must be a hash in `SmplkitGeneratedClient::Jobs::JobCreateRequest` initialize method"
56
+ end
57
+
58
+ # check to see if the attribute exists and convert string to symbol for hash key
59
+ acceptable_attribute_map = self.class.acceptable_attribute_map
60
+ attributes = attributes.each_with_object({}) { |(k, v), h|
61
+ if (!acceptable_attribute_map.key?(k.to_sym))
62
+ fail ArgumentError, "`#{k}` is not a valid attribute in `SmplkitGeneratedClient::Jobs::JobCreateRequest`. Please check the name to make sure it's valid. List of attributes: " + acceptable_attribute_map.keys.inspect
63
+ end
64
+ h[k.to_sym] = v
65
+ }
66
+
67
+ if attributes.key?(:'data')
68
+ self.data = attributes[:'data']
69
+ else
70
+ self.data = nil
71
+ end
72
+ end
73
+
74
+ # Show invalid properties with the reasons. Usually used together with valid?
75
+ # @return Array for valid properties with the reasons
76
+ def list_invalid_properties
77
+ warn '[DEPRECATED] the `list_invalid_properties` method is obsolete'
78
+ invalid_properties = Array.new
79
+ if @data.nil?
80
+ invalid_properties.push('invalid value for "data", data cannot be nil.')
81
+ end
82
+
83
+ invalid_properties
84
+ end
85
+
86
+ # Check to see if the all the properties in the model are valid
87
+ # @return true if the model is valid
88
+ def valid?
89
+ warn '[DEPRECATED] the `valid?` method is obsolete'
90
+ return false if @data.nil?
91
+ true
92
+ end
93
+
94
+ # Custom attribute writer method with validation
95
+ # @param [Object] data Value to be assigned
96
+ def data=(data)
97
+ if data.nil?
98
+ fail ArgumentError, 'data cannot be nil'
99
+ end
100
+
101
+ @data = data
102
+ end
103
+
104
+ # Checks equality by comparing each attribute.
105
+ # @param [Object] Object to be compared
106
+ def ==(o)
107
+ return true if self.equal?(o)
108
+ self.class == o.class &&
109
+ data == o.data
110
+ end
111
+
112
+ # @see the `==` method
113
+ # @param [Object] Object to be compared
114
+ def eql?(o)
115
+ self == o
116
+ end
117
+
118
+ # Calculates hash code according to all attributes.
119
+ # @return [Integer] Hash code
120
+ def hash
121
+ [data].hash
122
+ end
123
+
124
+ # Builds the object from hash
125
+ # @param [Hash] attributes Model attributes in the form of hash
126
+ # @return [Object] Returns the model itself
127
+ def self.build_from_hash(attributes)
128
+ return nil unless attributes.is_a?(Hash)
129
+ attributes = attributes.transform_keys(&:to_sym)
130
+ transformed_hash = {}
131
+ openapi_types.each_pair do |key, type|
132
+ if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil?
133
+ transformed_hash["#{key}"] = nil
134
+ elsif type =~ /\AArray<(.*)>/i
135
+ # check to ensure the input is an array given that the attribute
136
+ # is documented as an array but the input is not
137
+ if attributes[attribute_map[key]].is_a?(Array)
138
+ transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) }
139
+ end
140
+ elsif !attributes[attribute_map[key]].nil?
141
+ transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]])
142
+ end
143
+ end
144
+ new(transformed_hash)
145
+ end
146
+
147
+ # Returns the object in the form of hash
148
+ # @return [Hash] Returns the object in the form of hash
149
+ def to_hash
150
+ hash = {}
151
+ self.class.attribute_map.each_pair do |attr, param|
152
+ value = self.send(attr)
153
+ if value.nil?
154
+ is_nullable = self.class.openapi_nullable.include?(attr)
155
+ next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
156
+ end
157
+
158
+ hash[param] = _to_hash(value)
159
+ end
160
+ hash
161
+ end
162
+
163
+ end
164
+
165
+ end