appnigma-sdk 0.1.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 (63) hide show
  1. checksums.yaml +7 -0
  2. data/LICENSE +21 -0
  3. data/README.md +359 -0
  4. data/lib/appnigma/checks.rb +90 -0
  5. data/lib/appnigma/client.rb +118 -0
  6. data/lib/appnigma/connections.rb +31 -0
  7. data/lib/appnigma/constants.rb +80 -0
  8. data/lib/appnigma/crm.rb +40 -0
  9. data/lib/appnigma/errors.rb +135 -0
  10. data/lib/appnigma/generated/api/default_api.rb +972 -0
  11. data/lib/appnigma/generated/api_client.rb +441 -0
  12. data/lib/appnigma/generated/api_error.rb +58 -0
  13. data/lib/appnigma/generated/api_model_base.rb +88 -0
  14. data/lib/appnigma/generated/configuration.rb +392 -0
  15. data/lib/appnigma/generated/models/connection_status.rb +41 -0
  16. data/lib/appnigma/generated/models/create_connection_link_input.rb +265 -0
  17. data/lib/appnigma/generated/models/create_connection_link_output.rb +205 -0
  18. data/lib/appnigma/generated/models/crm_company.rb +322 -0
  19. data/lib/appnigma/generated/models/crm_company_get_output.rb +177 -0
  20. data/lib/appnigma/generated/models/crm_company_list_output.rb +192 -0
  21. data/lib/appnigma/generated/models/crm_contact.rb +404 -0
  22. data/lib/appnigma/generated/models/crm_contact_get_output.rb +177 -0
  23. data/lib/appnigma/generated/models/crm_contact_list_output.rb +192 -0
  24. data/lib/appnigma/generated/models/crm_custom_field.rb +189 -0
  25. data/lib/appnigma/generated/models/crm_deal.rb +479 -0
  26. data/lib/appnigma/generated/models/crm_deal_get_output.rb +177 -0
  27. data/lib/appnigma/generated/models/crm_deal_list_output.rb +192 -0
  28. data/lib/appnigma/generated/models/crm_email.rb +249 -0
  29. data/lib/appnigma/generated/models/crm_get_input.rb +272 -0
  30. data/lib/appnigma/generated/models/crm_labelled.rb +190 -0
  31. data/lib/appnigma/generated/models/crm_list_input.rb +303 -0
  32. data/lib/appnigma/generated/models/crm_phone.rb +249 -0
  33. data/lib/appnigma/generated/models/function_entry.rb +346 -0
  34. data/lib/appnigma/generated/models/function_owner.rb +105 -0
  35. data/lib/appnigma/generated/models/function_owner_one_of.rb +201 -0
  36. data/lib/appnigma/generated/models/function_owner_one_of1.rb +227 -0
  37. data/lib/appnigma/generated/models/get_connection_output.rb +251 -0
  38. data/lib/appnigma/generated/models/get_guide_output.rb +178 -0
  39. data/lib/appnigma/generated/models/json_value.rb +106 -0
  40. data/lib/appnigma/generated/models/list_functions_output.rb +179 -0
  41. data/lib/appnigma/generated/models/platform_request_input.rb +314 -0
  42. data/lib/appnigma/generated/models/platform_request_input_body.rb +104 -0
  43. data/lib/appnigma/generated/models/platform_request_output.rb +221 -0
  44. data/lib/appnigma/generated/models/post_input.rb +327 -0
  45. data/lib/appnigma/generated/models/post_input_record_value.rb +104 -0
  46. data/lib/appnigma/generated/models/post_output.rb +203 -0
  47. data/lib/appnigma/generated/models/pull_input.rb +335 -0
  48. data/lib/appnigma/generated/models/pull_output.rb +191 -0
  49. data/lib/appnigma/generated/models/pull_output_records_inner.rb +205 -0
  50. data/lib/appnigma/generated/models/run_input.rb +332 -0
  51. data/lib/appnigma/generated/models/run_output.rb +164 -0
  52. data/lib/appnigma/generated/models/sdk_error.rb +177 -0
  53. data/lib/appnigma/generated/models/sdk_error_error.rb +254 -0
  54. data/lib/appnigma/generated/models/sdk_error_error_details.rb +211 -0
  55. data/lib/appnigma/generated/models/sdk_problem.rb +205 -0
  56. data/lib/appnigma/generated/version.rb +15 -0
  57. data/lib/appnigma/generated.rb +82 -0
  58. data/lib/appnigma/names.rb +62 -0
  59. data/lib/appnigma/retry.rb +80 -0
  60. data/lib/appnigma/transport.rb +138 -0
  61. data/lib/appnigma/version.rb +9 -0
  62. data/lib/appnigma.rb +16 -0
  63. metadata +155 -0
@@ -0,0 +1,479 @@
1
+ =begin
2
+ #Appnigma SDK API
3
+
4
+ #The routes a customer's product calls through an Appnigma SDK. Every answer carries a request id in X-Request-Id; quote it when you write to support.
5
+
6
+ The version of the OpenAPI document: 1.0.0
7
+
8
+ Generated by: https://openapi-generator.tech
9
+ Generator version: 7.26.0
10
+
11
+ =end
12
+
13
+ require 'date'
14
+ require 'time'
15
+
16
+ module Appnigma::Generated
17
+ class CrmDeal < ApiModelBase
18
+ # The record's id in the CRM
19
+ attr_accessor :id
20
+
21
+ attr_accessor :platform
22
+
23
+ # ISO 8601, in UTC
24
+ attr_accessor :created_at
25
+
26
+ # ISO 8601, in UTC
27
+ attr_accessor :updated_at
28
+
29
+ # The CRM's custom properties, by their internal name
30
+ attr_accessor :custom_fields
31
+
32
+ # The record exactly as the CRM sent it
33
+ attr_accessor :raw
34
+
35
+ attr_accessor :name
36
+
37
+ attr_accessor :amount
38
+
39
+ # ISO 4217, such as USD
40
+ attr_accessor :currency
41
+
42
+ attr_accessor :status
43
+
44
+ attr_accessor :stage
45
+
46
+ attr_accessor :pipeline
47
+
48
+ attr_accessor :probability
49
+
50
+ # YYYY-MM-DD
51
+ attr_accessor :close_date
52
+
53
+ # ISO 8601, in UTC
54
+ attr_accessor :closed_at
55
+
56
+ attr_accessor :company_id
57
+
58
+ attr_accessor :owner_id
59
+
60
+ class EnumAttributeValidator
61
+ attr_reader :datatype
62
+ attr_reader :allowable_values
63
+
64
+ def initialize(datatype, allowable_values)
65
+ @allowable_values = allowable_values.map do |value|
66
+ case datatype.to_s
67
+ when /Integer/i
68
+ value.to_i
69
+ when /Float/i
70
+ value.to_f
71
+ else
72
+ value
73
+ end
74
+ end
75
+ end
76
+
77
+ def valid?(value)
78
+ !value || allowable_values.include?(value)
79
+ end
80
+ end
81
+
82
+ # Attribute mapping from ruby-style variable name to JSON key.
83
+ def self.attribute_map
84
+ {
85
+ :'id' => :'id',
86
+ :'platform' => :'platform',
87
+ :'created_at' => :'createdAt',
88
+ :'updated_at' => :'updatedAt',
89
+ :'custom_fields' => :'customFields',
90
+ :'raw' => :'raw',
91
+ :'name' => :'name',
92
+ :'amount' => :'amount',
93
+ :'currency' => :'currency',
94
+ :'status' => :'status',
95
+ :'stage' => :'stage',
96
+ :'pipeline' => :'pipeline',
97
+ :'probability' => :'probability',
98
+ :'close_date' => :'closeDate',
99
+ :'closed_at' => :'closedAt',
100
+ :'company_id' => :'companyId',
101
+ :'owner_id' => :'ownerId'
102
+ }
103
+ end
104
+
105
+ # Returns attribute mapping this model knows about
106
+ def self.acceptable_attribute_map
107
+ attribute_map
108
+ end
109
+
110
+ # Returns all the JSON keys this model knows about
111
+ def self.acceptable_attributes
112
+ acceptable_attribute_map.values
113
+ end
114
+
115
+ # Attribute type mapping.
116
+ def self.openapi_types
117
+ {
118
+ :'id' => :'String',
119
+ :'platform' => :'String',
120
+ :'created_at' => :'String',
121
+ :'updated_at' => :'String',
122
+ :'custom_fields' => :'Hash<String, CrmCustomField>',
123
+ :'raw' => :'Object',
124
+ :'name' => :'String',
125
+ :'amount' => :'Float',
126
+ :'currency' => :'String',
127
+ :'status' => :'String',
128
+ :'stage' => :'CrmLabelled',
129
+ :'pipeline' => :'CrmLabelled',
130
+ :'probability' => :'Float',
131
+ :'close_date' => :'String',
132
+ :'closed_at' => :'String',
133
+ :'company_id' => :'String',
134
+ :'owner_id' => :'String'
135
+ }
136
+ end
137
+
138
+ # List of attributes with nullable: true
139
+ def self.openapi_nullable
140
+ Set.new([
141
+ :'created_at',
142
+ :'updated_at',
143
+ :'name',
144
+ :'amount',
145
+ :'currency',
146
+ :'status',
147
+ :'stage',
148
+ :'pipeline',
149
+ :'probability',
150
+ :'close_date',
151
+ :'closed_at',
152
+ :'company_id',
153
+ :'owner_id'
154
+ ])
155
+ end
156
+
157
+ # Returns attribute type mapping
158
+ def self.acceptable_openapi_types
159
+ openapi_types
160
+ end
161
+
162
+ # Returns the nullable attributes
163
+ def self.acceptable_openapi_nullable
164
+ openapi_nullable
165
+ end
166
+
167
+ # Initializes the object
168
+ # @param [Hash] attributes Model attributes in the form of hash
169
+ def initialize(attributes = {})
170
+ if (!attributes.is_a?(Hash))
171
+ fail ArgumentError, "The input argument (attributes) must be a hash in `Appnigma::Generated::CrmDeal` initialize method"
172
+ end
173
+
174
+ # check to see if the attribute exists and convert string to symbol for hash key
175
+ acceptable_attribute_map = self.class.acceptable_attribute_map
176
+ attributes = attributes.each_with_object({}) { |(k, v), h|
177
+ if (!acceptable_attribute_map.key?(k.to_sym))
178
+ fail ArgumentError, "`#{k}` is not a valid attribute in `Appnigma::Generated::CrmDeal`. Please check the name to make sure it's valid. List of attributes: " + acceptable_attribute_map.keys.inspect
179
+ end
180
+ h[k.to_sym] = v
181
+ }
182
+
183
+ if attributes.key?(:'id')
184
+ self.id = attributes[:'id']
185
+ else
186
+ self.id = nil
187
+ end
188
+
189
+ if attributes.key?(:'platform')
190
+ self.platform = attributes[:'platform']
191
+ else
192
+ self.platform = nil
193
+ end
194
+
195
+ if attributes.key?(:'created_at')
196
+ self.created_at = attributes[:'created_at']
197
+ else
198
+ self.created_at = nil
199
+ end
200
+
201
+ if attributes.key?(:'updated_at')
202
+ self.updated_at = attributes[:'updated_at']
203
+ else
204
+ self.updated_at = nil
205
+ end
206
+
207
+ if attributes.key?(:'custom_fields')
208
+ if (value = attributes[:'custom_fields']).is_a?(Hash)
209
+ self.custom_fields = value
210
+ end
211
+ else
212
+ self.custom_fields = nil
213
+ end
214
+
215
+ if attributes.key?(:'raw')
216
+ self.raw = attributes[:'raw']
217
+ else
218
+ self.raw = nil
219
+ end
220
+
221
+ if attributes.key?(:'name')
222
+ self.name = attributes[:'name']
223
+ else
224
+ self.name = nil
225
+ end
226
+
227
+ if attributes.key?(:'amount')
228
+ self.amount = attributes[:'amount']
229
+ else
230
+ self.amount = nil
231
+ end
232
+
233
+ if attributes.key?(:'currency')
234
+ self.currency = attributes[:'currency']
235
+ else
236
+ self.currency = nil
237
+ end
238
+
239
+ if attributes.key?(:'status')
240
+ self.status = attributes[:'status']
241
+ else
242
+ self.status = nil
243
+ end
244
+
245
+ if attributes.key?(:'stage')
246
+ self.stage = attributes[:'stage']
247
+ else
248
+ self.stage = nil
249
+ end
250
+
251
+ if attributes.key?(:'pipeline')
252
+ self.pipeline = attributes[:'pipeline']
253
+ else
254
+ self.pipeline = nil
255
+ end
256
+
257
+ if attributes.key?(:'probability')
258
+ self.probability = attributes[:'probability']
259
+ else
260
+ self.probability = nil
261
+ end
262
+
263
+ if attributes.key?(:'close_date')
264
+ self.close_date = attributes[:'close_date']
265
+ else
266
+ self.close_date = nil
267
+ end
268
+
269
+ if attributes.key?(:'closed_at')
270
+ self.closed_at = attributes[:'closed_at']
271
+ else
272
+ self.closed_at = nil
273
+ end
274
+
275
+ if attributes.key?(:'company_id')
276
+ self.company_id = attributes[:'company_id']
277
+ else
278
+ self.company_id = nil
279
+ end
280
+
281
+ if attributes.key?(:'owner_id')
282
+ self.owner_id = attributes[:'owner_id']
283
+ else
284
+ self.owner_id = nil
285
+ end
286
+ end
287
+
288
+ # Show invalid properties with the reasons. Usually used together with valid?
289
+ # @return Array for valid properties with the reasons
290
+ def list_invalid_properties
291
+ warn '[DEPRECATED] the `list_invalid_properties` method is obsolete'
292
+ invalid_properties = Array.new
293
+ if @id.nil?
294
+ invalid_properties.push('invalid value for "id", id cannot be nil.')
295
+ end
296
+
297
+ if @platform.nil?
298
+ invalid_properties.push('invalid value for "platform", platform cannot be nil.')
299
+ end
300
+
301
+ if @custom_fields.nil?
302
+ invalid_properties.push('invalid value for "custom_fields", custom_fields cannot be nil.')
303
+ end
304
+
305
+ if @raw.nil?
306
+ invalid_properties.push('invalid value for "raw", raw cannot be nil.')
307
+ end
308
+
309
+ if @probability > 100
310
+ invalid_properties.push('invalid value for "probability", must be smaller than or equal to 100.')
311
+ end
312
+
313
+ if @probability < 0
314
+ invalid_properties.push('invalid value for "probability", must be greater than or equal to 0.')
315
+ end
316
+
317
+ invalid_properties
318
+ end
319
+
320
+ # Check to see if the all the properties in the model are valid
321
+ # @return true if the model is valid
322
+ def valid?
323
+ warn '[DEPRECATED] the `valid?` method is obsolete'
324
+ return false if @id.nil?
325
+ return false if @platform.nil?
326
+ return false if @custom_fields.nil?
327
+ return false if @raw.nil?
328
+ status_validator = EnumAttributeValidator.new('String', ["open", "won", "lost"])
329
+ return false unless status_validator.valid?(@status)
330
+ return false if @probability > 100
331
+ return false if @probability < 0
332
+ true
333
+ end
334
+
335
+ # Custom attribute writer method with validation
336
+ # @param [Object] id Value to be assigned
337
+ def id=(id)
338
+ if id.nil?
339
+ fail ArgumentError, 'id cannot be nil'
340
+ end
341
+
342
+ @id = id
343
+ end
344
+
345
+ # Custom attribute writer method with validation
346
+ # @param [Object] platform Value to be assigned
347
+ def platform=(platform)
348
+ if platform.nil?
349
+ fail ArgumentError, 'platform cannot be nil'
350
+ end
351
+
352
+ @platform = platform
353
+ end
354
+
355
+ # Custom attribute writer method with validation
356
+ # @param [Object] custom_fields Value to be assigned
357
+ def custom_fields=(custom_fields)
358
+ if custom_fields.nil?
359
+ fail ArgumentError, 'custom_fields cannot be nil'
360
+ end
361
+
362
+ @custom_fields = custom_fields
363
+ end
364
+
365
+ # Custom attribute writer method with validation
366
+ # @param [Object] raw Value to be assigned
367
+ def raw=(raw)
368
+ if raw.nil?
369
+ fail ArgumentError, 'raw cannot be nil'
370
+ end
371
+
372
+ @raw = raw
373
+ end
374
+
375
+ # Custom attribute writer method checking allowed values (enum).
376
+ # @param [Object] status Object to be assigned
377
+ def status=(status)
378
+ validator = EnumAttributeValidator.new('String', ["open", "won", "lost"])
379
+ unless validator.valid?(status)
380
+ fail ArgumentError, "invalid value for \"status\", must be one of #{validator.allowable_values}."
381
+ end
382
+ @status = status
383
+ end
384
+
385
+ # Custom attribute writer method with validation
386
+ # @param [Object] probability Value to be assigned
387
+ def probability=(probability)
388
+ if !probability.nil? && probability > 100
389
+ fail ArgumentError, 'invalid value for "probability", must be smaller than or equal to 100.'
390
+ end
391
+
392
+ if !probability.nil? && probability < 0
393
+ fail ArgumentError, 'invalid value for "probability", must be greater than or equal to 0.'
394
+ end
395
+
396
+ @probability = probability
397
+ end
398
+
399
+ # Checks equality by comparing each attribute.
400
+ # @param [Object] Object to be compared
401
+ def ==(o)
402
+ return true if self.equal?(o)
403
+ self.class == o.class &&
404
+ id == o.id &&
405
+ platform == o.platform &&
406
+ created_at == o.created_at &&
407
+ updated_at == o.updated_at &&
408
+ custom_fields == o.custom_fields &&
409
+ raw == o.raw &&
410
+ name == o.name &&
411
+ amount == o.amount &&
412
+ currency == o.currency &&
413
+ status == o.status &&
414
+ stage == o.stage &&
415
+ pipeline == o.pipeline &&
416
+ probability == o.probability &&
417
+ close_date == o.close_date &&
418
+ closed_at == o.closed_at &&
419
+ company_id == o.company_id &&
420
+ owner_id == o.owner_id
421
+ end
422
+
423
+ # @see the `==` method
424
+ # @param [Object] Object to be compared
425
+ def eql?(o)
426
+ self == o
427
+ end
428
+
429
+ # Calculates hash code according to all attributes.
430
+ # @return [Integer] Hash code
431
+ def hash
432
+ [id, platform, created_at, updated_at, custom_fields, raw, name, amount, currency, status, stage, pipeline, probability, close_date, closed_at, company_id, owner_id].hash
433
+ end
434
+
435
+ # Builds the object from hash
436
+ # @param [Hash] attributes Model attributes in the form of hash
437
+ # @return [Object] Returns the model itself
438
+ def self.build_from_hash(attributes)
439
+ return nil unless attributes.is_a?(Hash)
440
+ attributes = attributes.transform_keys(&:to_sym)
441
+ # include attributes inherited from allOf parents (the nearest declaration wins)
442
+ map = acceptable_attribute_map
443
+ transformed_hash = {}
444
+ acceptable_openapi_types.each_pair do |key, type|
445
+ if attributes.key?(map[key]) && attributes[map[key]].nil?
446
+ transformed_hash["#{key}"] = nil
447
+ elsif type =~ /\AArray<(.*)>/i
448
+ # check to ensure the input is an array given that the attribute
449
+ # is documented as an array but the input is not
450
+ if attributes[map[key]].is_a?(Array)
451
+ transformed_hash["#{key}"] = attributes[map[key]].map { |v| _deserialize($1, v) }
452
+ end
453
+ elsif !attributes[map[key]].nil?
454
+ transformed_hash["#{key}"] = _deserialize(type, attributes[map[key]])
455
+ end
456
+ end
457
+ new(transformed_hash)
458
+ end
459
+
460
+ # Returns the object in the form of hash
461
+ # @return [Hash] Returns the object in the form of hash
462
+ def to_hash
463
+ hash = {}
464
+ # include attributes inherited from allOf parents (the nearest declaration wins)
465
+ self.class.acceptable_attribute_map.each_pair do |attr, param|
466
+ value = self.send(attr)
467
+ if value.nil?
468
+ is_nullable = self.class.acceptable_openapi_nullable.include?(attr)
469
+ next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
470
+ end
471
+
472
+ hash[param] = _to_hash(value)
473
+ end
474
+ hash
475
+ end
476
+
477
+ end
478
+
479
+ end
@@ -0,0 +1,177 @@
1
+ =begin
2
+ #Appnigma SDK API
3
+
4
+ #The routes a customer's product calls through an Appnigma SDK. Every answer carries a request id in X-Request-Id; quote it when you write to support.
5
+
6
+ The version of the OpenAPI document: 1.0.0
7
+
8
+ Generated by: https://openapi-generator.tech
9
+ Generator version: 7.26.0
10
+
11
+ =end
12
+
13
+ require 'date'
14
+ require 'time'
15
+
16
+ module Appnigma::Generated
17
+ class CrmDealGetOutput < ApiModelBase
18
+ attr_accessor :record
19
+
20
+ # Attribute mapping from ruby-style variable name to JSON key.
21
+ def self.attribute_map
22
+ {
23
+ :'record' => :'record'
24
+ }
25
+ end
26
+
27
+ # Returns attribute mapping this model knows about
28
+ def self.acceptable_attribute_map
29
+ attribute_map
30
+ end
31
+
32
+ # Returns all the JSON keys this model knows about
33
+ def self.acceptable_attributes
34
+ acceptable_attribute_map.values
35
+ end
36
+
37
+ # Attribute type mapping.
38
+ def self.openapi_types
39
+ {
40
+ :'record' => :'CrmDeal'
41
+ }
42
+ end
43
+
44
+ # List of attributes with nullable: true
45
+ def self.openapi_nullable
46
+ Set.new([
47
+ ])
48
+ end
49
+
50
+ # Returns attribute type mapping
51
+ def self.acceptable_openapi_types
52
+ openapi_types
53
+ end
54
+
55
+ # Returns the nullable attributes
56
+ def self.acceptable_openapi_nullable
57
+ openapi_nullable
58
+ end
59
+
60
+ # Initializes the object
61
+ # @param [Hash] attributes Model attributes in the form of hash
62
+ def initialize(attributes = {})
63
+ if (!attributes.is_a?(Hash))
64
+ fail ArgumentError, "The input argument (attributes) must be a hash in `Appnigma::Generated::CrmDealGetOutput` initialize method"
65
+ end
66
+
67
+ # check to see if the attribute exists and convert string to symbol for hash key
68
+ acceptable_attribute_map = self.class.acceptable_attribute_map
69
+ attributes = attributes.each_with_object({}) { |(k, v), h|
70
+ if (!acceptable_attribute_map.key?(k.to_sym))
71
+ fail ArgumentError, "`#{k}` is not a valid attribute in `Appnigma::Generated::CrmDealGetOutput`. Please check the name to make sure it's valid. List of attributes: " + acceptable_attribute_map.keys.inspect
72
+ end
73
+ h[k.to_sym] = v
74
+ }
75
+
76
+ if attributes.key?(:'record')
77
+ self.record = attributes[:'record']
78
+ else
79
+ self.record = nil
80
+ end
81
+ end
82
+
83
+ # Show invalid properties with the reasons. Usually used together with valid?
84
+ # @return Array for valid properties with the reasons
85
+ def list_invalid_properties
86
+ warn '[DEPRECATED] the `list_invalid_properties` method is obsolete'
87
+ invalid_properties = Array.new
88
+ if @record.nil?
89
+ invalid_properties.push('invalid value for "record", record cannot be nil.')
90
+ end
91
+
92
+ invalid_properties
93
+ end
94
+
95
+ # Check to see if the all the properties in the model are valid
96
+ # @return true if the model is valid
97
+ def valid?
98
+ warn '[DEPRECATED] the `valid?` method is obsolete'
99
+ return false if @record.nil?
100
+ true
101
+ end
102
+
103
+ # Custom attribute writer method with validation
104
+ # @param [Object] record Value to be assigned
105
+ def record=(record)
106
+ if record.nil?
107
+ fail ArgumentError, 'record cannot be nil'
108
+ end
109
+
110
+ @record = record
111
+ end
112
+
113
+ # Checks equality by comparing each attribute.
114
+ # @param [Object] Object to be compared
115
+ def ==(o)
116
+ return true if self.equal?(o)
117
+ self.class == o.class &&
118
+ record == o.record
119
+ end
120
+
121
+ # @see the `==` method
122
+ # @param [Object] Object to be compared
123
+ def eql?(o)
124
+ self == o
125
+ end
126
+
127
+ # Calculates hash code according to all attributes.
128
+ # @return [Integer] Hash code
129
+ def hash
130
+ [record].hash
131
+ end
132
+
133
+ # Builds the object from hash
134
+ # @param [Hash] attributes Model attributes in the form of hash
135
+ # @return [Object] Returns the model itself
136
+ def self.build_from_hash(attributes)
137
+ return nil unless attributes.is_a?(Hash)
138
+ attributes = attributes.transform_keys(&:to_sym)
139
+ # include attributes inherited from allOf parents (the nearest declaration wins)
140
+ map = acceptable_attribute_map
141
+ transformed_hash = {}
142
+ acceptable_openapi_types.each_pair do |key, type|
143
+ if attributes.key?(map[key]) && attributes[map[key]].nil?
144
+ transformed_hash["#{key}"] = nil
145
+ elsif type =~ /\AArray<(.*)>/i
146
+ # check to ensure the input is an array given that the attribute
147
+ # is documented as an array but the input is not
148
+ if attributes[map[key]].is_a?(Array)
149
+ transformed_hash["#{key}"] = attributes[map[key]].map { |v| _deserialize($1, v) }
150
+ end
151
+ elsif !attributes[map[key]].nil?
152
+ transformed_hash["#{key}"] = _deserialize(type, attributes[map[key]])
153
+ end
154
+ end
155
+ new(transformed_hash)
156
+ end
157
+
158
+ # Returns the object in the form of hash
159
+ # @return [Hash] Returns the object in the form of hash
160
+ def to_hash
161
+ hash = {}
162
+ # include attributes inherited from allOf parents (the nearest declaration wins)
163
+ self.class.acceptable_attribute_map.each_pair do |attr, param|
164
+ value = self.send(attr)
165
+ if value.nil?
166
+ is_nullable = self.class.acceptable_openapi_nullable.include?(attr)
167
+ next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
168
+ end
169
+
170
+ hash[param] = _to_hash(value)
171
+ end
172
+ hash
173
+ end
174
+
175
+ end
176
+
177
+ end