plainrouter-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 (75) hide show
  1. checksums.yaml +7 -0
  2. data/LICENSE +202 -0
  3. data/README.md +59 -0
  4. data/lib/plainrouter/client.rb +44 -0
  5. data/lib/plainrouter/openapi/api/event_api.rb +213 -0
  6. data/lib/plainrouter/openapi/api/operations_api.rb +542 -0
  7. data/lib/plainrouter/openapi/api/sandbox_api.rb +272 -0
  8. data/lib/plainrouter/openapi/api_client.rb +441 -0
  9. data/lib/plainrouter/openapi/api_error.rb +58 -0
  10. data/lib/plainrouter/openapi/api_model_base.rb +88 -0
  11. data/lib/plainrouter/openapi/configuration.rb +399 -0
  12. data/lib/plainrouter/openapi/models/create_event200_response.rb +190 -0
  13. data/lib/plainrouter/openapi/models/create_event_request.rb +103 -0
  14. data/lib/plainrouter/openapi/models/create_event_request_any_of.rb +344 -0
  15. data/lib/plainrouter/openapi/models/create_event_request_any_of1.rb +346 -0
  16. data/lib/plainrouter/openapi/models/create_event_request_any_of_event_time.rb +104 -0
  17. data/lib/plainrouter/openapi/models/create_event_request_any_of_value_data.rb +186 -0
  18. data/lib/plainrouter/openapi/models/create_sandbox_key201_response.rb +320 -0
  19. data/lib/plainrouter/openapi/models/create_sandbox_key201_response_use.rb +216 -0
  20. data/lib/plainrouter/openapi/models/delete_user_data200_response.rb +268 -0
  21. data/lib/plainrouter/openapi/models/delete_user_data_request.rb +225 -0
  22. data/lib/plainrouter/openapi/models/delivery_status.rb +49 -0
  23. data/lib/plainrouter/openapi/models/destination.rb +354 -0
  24. data/lib/plainrouter/openapi/models/destination_credential_source.rb +40 -0
  25. data/lib/plainrouter/openapi/models/destination_status.rb +40 -0
  26. data/lib/plainrouter/openapi/models/destination_type.rb +39 -0
  27. data/lib/plainrouter/openapi/models/emq_snapshot.rb +344 -0
  28. data/lib/plainrouter/openapi/models/error_message.rb +164 -0
  29. data/lib/plainrouter/openapi/models/event.rb +782 -0
  30. data/lib/plainrouter/openapi/models/get_emq_report200_response.rb +166 -0
  31. data/lib/plainrouter/openapi/models/get_emq_report200_response_snapshots_inner.rb +342 -0
  32. data/lib/plainrouter/openapi/models/get_event200_response.rb +218 -0
  33. data/lib/plainrouter/openapi/models/get_event200_response_deliveries_inner.rb +440 -0
  34. data/lib/plainrouter/openapi/models/get_event200_response_event.rb +624 -0
  35. data/lib/plainrouter/openapi/models/get_event200_response_event_consent.rb +103 -0
  36. data/lib/plainrouter/openapi/models/get_event200_response_event_deliveries_inner.rb +414 -0
  37. data/lib/plainrouter/openapi/models/get_event200_response_lineage.rb +178 -0
  38. data/lib/plainrouter/openapi/models/get_event200_response_lineage_children_inner.rb +596 -0
  39. data/lib/plainrouter/openapi/models/get_event200_response_lineage_parent.rb +596 -0
  40. data/lib/plainrouter/openapi/models/get_reconciliation_report200_response.rb +192 -0
  41. data/lib/plainrouter/openapi/models/get_reconciliation_report200_response_reports_inner.rb +476 -0
  42. data/lib/plainrouter/openapi/models/get_reconciliation_report200_response_reports_inner_buckets_value.rb +216 -0
  43. data/lib/plainrouter/openapi/models/get_reconciliation_report200_response_reports_inner_event_counts.rb +190 -0
  44. data/lib/plainrouter/openapi/models/get_reconciliation_report200_response_reports_inner_event_counts_accepted.rb +103 -0
  45. data/lib/plainrouter/openapi/models/get_sandbox200_response.rb +372 -0
  46. data/lib/plainrouter/openapi/models/get_sandbox200_response_self_serve_key.rb +242 -0
  47. data/lib/plainrouter/openapi/models/get_sandbox200_response_try.rb +242 -0
  48. data/lib/plainrouter/openapi/models/get_sandbox200_response_try_body.rb +242 -0
  49. data/lib/plainrouter/openapi/models/get_sandbox200_response_try_body_value_data.rb +216 -0
  50. data/lib/plainrouter/openapi/models/jurisdiction_policy_class.rb +40 -0
  51. data/lib/plainrouter/openapi/models/list_events200_response.rb +190 -0
  52. data/lib/plainrouter/openapi/models/list_events200_response_events.rb +382 -0
  53. data/lib/plainrouter/openapi/models/list_events200_response_events_links_inner.rb +202 -0
  54. data/lib/plainrouter/openapi/models/list_events200_response_metrics.rb +228 -0
  55. data/lib/plainrouter/openapi/models/list_events_by_cursor200_response.rb +190 -0
  56. data/lib/plainrouter/openapi/models/list_events_by_cursor200_response_events.rb +252 -0
  57. data/lib/plainrouter/openapi/models/reconciliation_report.rb +464 -0
  58. data/lib/plainrouter/openapi/models/replay_deliveries202_response.rb +242 -0
  59. data/lib/plainrouter/openapi/models/replay_deliveries_request.rb +199 -0
  60. data/lib/plainrouter/openapi/models/send_test_purchase200_response.rb +224 -0
  61. data/lib/plainrouter/openapi/models/send_test_purchase422_response.rb +103 -0
  62. data/lib/plainrouter/openapi/models/send_test_purchase_request.rb +224 -0
  63. data/lib/plainrouter/openapi/models/set_destination_test_mode200_response.rb +190 -0
  64. data/lib/plainrouter/openapi/models/set_destination_test_mode200_response_destination.rb +338 -0
  65. data/lib/plainrouter/openapi/models/set_destination_test_mode_request.rb +189 -0
  66. data/lib/plainrouter/openapi/models/traffic_class.rb +40 -0
  67. data/lib/plainrouter/openapi/models/validate_sandbox_event200_response.rb +320 -0
  68. data/lib/plainrouter/openapi/models/validate_sandbox_event_request.rb +194 -0
  69. data/lib/plainrouter/openapi/models/validate_sandbox_event_request_value_data.rb +166 -0
  70. data/lib/plainrouter/openapi/models/validation_error.rb +192 -0
  71. data/lib/plainrouter/openapi/version.rb +15 -0
  72. data/lib/plainrouter/openapi.rb +102 -0
  73. data/lib/plainrouter/version.rb +6 -0
  74. data/lib/plainrouter.rb +10 -0
  75. metadata +176 -0
@@ -0,0 +1,103 @@
1
+ =begin
2
+ #PlainRouter Conversion API
3
+
4
+ #PlainRouter public Signals Conversion API.
5
+
6
+ The version of the OpenAPI document: 0.5.0
7
+
8
+ Generated by: https://openapi-generator.tech
9
+ Generator version: 7.25.0
10
+
11
+ =end
12
+
13
+ require 'date'
14
+ require 'time'
15
+
16
+ module PlainRouter::OpenAPI
17
+ module GetEvent200ResponseEventConsent
18
+ class << self
19
+ # List of class defined in anyOf (OpenAPI v3)
20
+ def openapi_any_of
21
+ [
22
+ :'Array<Object>',
23
+ :'Hash<String, Object>'
24
+ ]
25
+ end
26
+
27
+ # Builds the object
28
+ # @param [Mixed] Data to be matched against the list of anyOf items
29
+ # @return [Object] Returns the model or the data itself
30
+ def build(data)
31
+ # Go through the list of anyOf items and attempt to identify the appropriate one.
32
+ # Note:
33
+ # - No advanced validation of types in some cases (e.g. "x: { type: string }" will happily match { x: 123 })
34
+ # due to the way the deserialization is made in the base_object template (it just casts without verifying).
35
+ # - TODO: scalar values are de facto behaving as if they were nullable.
36
+ # - TODO: logging when debugging is set.
37
+ openapi_any_of.each do |klass|
38
+ begin
39
+ next if klass == :AnyType # "nullable: true"
40
+ return find_and_cast_into_type(klass, data)
41
+ rescue # rescue all errors so we keep iterating even if the current item lookup raises
42
+ end
43
+ end
44
+
45
+ openapi_any_of.include?(:AnyType) ? data : nil
46
+ end
47
+
48
+ private
49
+
50
+ SchemaMismatchError = Class.new(StandardError)
51
+
52
+ # Note: 'File' is missing here because in the regular case we get the data _after_ a call to JSON.parse.
53
+ def find_and_cast_into_type(klass, data)
54
+ return if data.nil?
55
+
56
+ case klass.to_s
57
+ when 'Boolean'
58
+ return data if data.instance_of?(TrueClass) || data.instance_of?(FalseClass)
59
+ when 'Float'
60
+ return data if data.instance_of?(Float)
61
+ when 'Integer'
62
+ return data if data.instance_of?(Integer)
63
+ when 'Time'
64
+ return Time.parse(data)
65
+ when 'Date'
66
+ return Date.iso8601(data)
67
+ when 'String'
68
+ return data if data.instance_of?(String)
69
+ when 'Object' # "type: object"
70
+ return data if data.instance_of?(Hash)
71
+ when /\AArray<(?<sub_type>.+)>\z/ # "type: array"
72
+ if data.instance_of?(Array)
73
+ sub_type = Regexp.last_match[:sub_type]
74
+ return data.map { |item| find_and_cast_into_type(sub_type, item) }
75
+ end
76
+ when /\AHash<String, (?<sub_type>.+)>\z/ # "type: object" with "additionalProperties: { ... }"
77
+ if data.instance_of?(Hash) && data.keys.all? { |k| k.instance_of?(Symbol) || k.instance_of?(String) }
78
+ sub_type = Regexp.last_match[:sub_type]
79
+ return data.each_with_object({}) { |(k, v), hsh| hsh[k] = find_and_cast_into_type(sub_type, v) }
80
+ end
81
+ else # model
82
+ const = PlainRouter::OpenAPI.const_get(klass)
83
+ if const
84
+ if const.respond_to?(:openapi_any_of) # nested anyOf model
85
+ model = const.build(data)
86
+ return model if model
87
+ else
88
+ # raise if data contains keys that are not known to the model
89
+ raise if const.respond_to?(:acceptable_attributes) && !(data.keys - const.acceptable_attributes).empty?
90
+ model = const.build_from_hash(data)
91
+ return model if model
92
+ end
93
+ end
94
+ end
95
+
96
+ raise # if no match by now, raise
97
+ rescue
98
+ raise SchemaMismatchError, "#{data} doesn't match the #{klass} type"
99
+ end
100
+ end
101
+ end
102
+
103
+ end
@@ -0,0 +1,414 @@
1
+ =begin
2
+ #PlainRouter Conversion API
3
+
4
+ #PlainRouter public Signals Conversion API.
5
+
6
+ The version of the OpenAPI document: 0.5.0
7
+
8
+ Generated by: https://openapi-generator.tech
9
+ Generator version: 7.25.0
10
+
11
+ =end
12
+
13
+ require 'date'
14
+ require 'time'
15
+
16
+ module PlainRouter::OpenAPI
17
+ class GetEvent200ResponseEventDeliveriesInner < ApiModelBase
18
+ attr_accessor :id
19
+
20
+ attr_accessor :signal_tracker_id
21
+
22
+ attr_accessor :event_id
23
+
24
+ attr_accessor :destination_id
25
+
26
+ attr_accessor :status
27
+
28
+ attr_accessor :is_test
29
+
30
+ attr_accessor :attempt_count
31
+
32
+ attr_accessor :last_error
33
+
34
+ attr_accessor :platform_response
35
+
36
+ attr_accessor :platform_trace_id
37
+
38
+ attr_accessor :next_attempt_at
39
+
40
+ attr_accessor :created_at
41
+
42
+ attr_accessor :updated_at
43
+
44
+ class EnumAttributeValidator
45
+ attr_reader :datatype
46
+ attr_reader :allowable_values
47
+
48
+ def initialize(datatype, allowable_values)
49
+ @allowable_values = allowable_values.map do |value|
50
+ case datatype.to_s
51
+ when /Integer/i
52
+ value.to_i
53
+ when /Float/i
54
+ value.to_f
55
+ else
56
+ value
57
+ end
58
+ end
59
+ end
60
+
61
+ def valid?(value)
62
+ !value || allowable_values.include?(value)
63
+ end
64
+ end
65
+
66
+ # Attribute mapping from ruby-style variable name to JSON key.
67
+ def self.attribute_map
68
+ {
69
+ :'id' => :'id',
70
+ :'signal_tracker_id' => :'signal_tracker_id',
71
+ :'event_id' => :'event_id',
72
+ :'destination_id' => :'destination_id',
73
+ :'status' => :'status',
74
+ :'is_test' => :'is_test',
75
+ :'attempt_count' => :'attempt_count',
76
+ :'last_error' => :'last_error',
77
+ :'platform_response' => :'platform_response',
78
+ :'platform_trace_id' => :'platform_trace_id',
79
+ :'next_attempt_at' => :'next_attempt_at',
80
+ :'created_at' => :'created_at',
81
+ :'updated_at' => :'updated_at'
82
+ }
83
+ end
84
+
85
+ # Returns attribute mapping this model knows about
86
+ def self.acceptable_attribute_map
87
+ attribute_map
88
+ end
89
+
90
+ # Returns all the JSON keys this model knows about
91
+ def self.acceptable_attributes
92
+ acceptable_attribute_map.values
93
+ end
94
+
95
+ # Attribute type mapping.
96
+ def self.openapi_types
97
+ {
98
+ :'id' => :'Integer',
99
+ :'signal_tracker_id' => :'String',
100
+ :'event_id' => :'String',
101
+ :'destination_id' => :'String',
102
+ :'status' => :'DeliveryStatus',
103
+ :'is_test' => :'Boolean',
104
+ :'attempt_count' => :'Integer',
105
+ :'last_error' => :'GetEvent200ResponseEventConsent',
106
+ :'platform_response' => :'GetEvent200ResponseEventConsent',
107
+ :'platform_trace_id' => :'String',
108
+ :'next_attempt_at' => :'String',
109
+ :'created_at' => :'String',
110
+ :'updated_at' => :'String'
111
+ }
112
+ end
113
+
114
+ # List of attributes with nullable: true
115
+ def self.openapi_nullable
116
+ Set.new([
117
+ :'destination_id',
118
+ :'last_error',
119
+ :'platform_response',
120
+ :'platform_trace_id',
121
+ :'next_attempt_at',
122
+ :'updated_at'
123
+ ])
124
+ end
125
+
126
+ # Initializes the object
127
+ # @param [Hash] attributes Model attributes in the form of hash
128
+ def initialize(attributes = {})
129
+ if (!attributes.is_a?(Hash))
130
+ fail ArgumentError, "The input argument (attributes) must be a hash in `PlainRouter::OpenAPI::GetEvent200ResponseEventDeliveriesInner` initialize method"
131
+ end
132
+
133
+ # check to see if the attribute exists and convert string to symbol for hash key
134
+ acceptable_attribute_map = self.class.acceptable_attribute_map
135
+ attributes = attributes.each_with_object({}) { |(k, v), h|
136
+ if (!acceptable_attribute_map.key?(k.to_sym))
137
+ fail ArgumentError, "`#{k}` is not a valid attribute in `PlainRouter::OpenAPI::GetEvent200ResponseEventDeliveriesInner`. Please check the name to make sure it's valid. List of attributes: " + acceptable_attribute_map.keys.inspect
138
+ end
139
+ h[k.to_sym] = v
140
+ }
141
+
142
+ if attributes.key?(:'id')
143
+ self.id = attributes[:'id']
144
+ else
145
+ self.id = nil
146
+ end
147
+
148
+ if attributes.key?(:'signal_tracker_id')
149
+ self.signal_tracker_id = attributes[:'signal_tracker_id']
150
+ else
151
+ self.signal_tracker_id = nil
152
+ end
153
+
154
+ if attributes.key?(:'event_id')
155
+ self.event_id = attributes[:'event_id']
156
+ else
157
+ self.event_id = nil
158
+ end
159
+
160
+ if attributes.key?(:'destination_id')
161
+ self.destination_id = attributes[:'destination_id']
162
+ else
163
+ self.destination_id = nil
164
+ end
165
+
166
+ if attributes.key?(:'status')
167
+ self.status = attributes[:'status']
168
+ else
169
+ self.status = nil
170
+ end
171
+
172
+ if attributes.key?(:'is_test')
173
+ self.is_test = attributes[:'is_test']
174
+ else
175
+ self.is_test = nil
176
+ end
177
+
178
+ if attributes.key?(:'attempt_count')
179
+ self.attempt_count = attributes[:'attempt_count']
180
+ else
181
+ self.attempt_count = nil
182
+ end
183
+
184
+ if attributes.key?(:'last_error')
185
+ self.last_error = attributes[:'last_error']
186
+ else
187
+ self.last_error = nil
188
+ end
189
+
190
+ if attributes.key?(:'platform_response')
191
+ self.platform_response = attributes[:'platform_response']
192
+ else
193
+ self.platform_response = nil
194
+ end
195
+
196
+ if attributes.key?(:'platform_trace_id')
197
+ self.platform_trace_id = attributes[:'platform_trace_id']
198
+ else
199
+ self.platform_trace_id = nil
200
+ end
201
+
202
+ if attributes.key?(:'next_attempt_at')
203
+ self.next_attempt_at = attributes[:'next_attempt_at']
204
+ else
205
+ self.next_attempt_at = nil
206
+ end
207
+
208
+ if attributes.key?(:'created_at')
209
+ self.created_at = attributes[:'created_at']
210
+ else
211
+ self.created_at = nil
212
+ end
213
+
214
+ if attributes.key?(:'updated_at')
215
+ self.updated_at = attributes[:'updated_at']
216
+ else
217
+ self.updated_at = nil
218
+ end
219
+ end
220
+
221
+ # Show invalid properties with the reasons. Usually used together with valid?
222
+ # @return Array for valid properties with the reasons
223
+ def list_invalid_properties
224
+ warn '[DEPRECATED] the `list_invalid_properties` method is obsolete'
225
+ invalid_properties = Array.new
226
+ if @id.nil?
227
+ invalid_properties.push('invalid value for "id", id cannot be nil.')
228
+ end
229
+
230
+ if @signal_tracker_id.nil?
231
+ invalid_properties.push('invalid value for "signal_tracker_id", signal_tracker_id cannot be nil.')
232
+ end
233
+
234
+ if @event_id.nil?
235
+ invalid_properties.push('invalid value for "event_id", event_id cannot be nil.')
236
+ end
237
+
238
+ if @status.nil?
239
+ invalid_properties.push('invalid value for "status", status cannot be nil.')
240
+ end
241
+
242
+ if @is_test.nil?
243
+ invalid_properties.push('invalid value for "is_test", is_test cannot be nil.')
244
+ end
245
+
246
+ if @attempt_count.nil?
247
+ invalid_properties.push('invalid value for "attempt_count", attempt_count cannot be nil.')
248
+ end
249
+
250
+ if @created_at.nil?
251
+ invalid_properties.push('invalid value for "created_at", created_at cannot be nil.')
252
+ end
253
+
254
+ invalid_properties
255
+ end
256
+
257
+ # Check to see if the all the properties in the model are valid
258
+ # @return true if the model is valid
259
+ def valid?
260
+ warn '[DEPRECATED] the `valid?` method is obsolete'
261
+ return false if @id.nil?
262
+ return false if @signal_tracker_id.nil?
263
+ return false if @event_id.nil?
264
+ return false if @status.nil?
265
+ return false if @is_test.nil?
266
+ return false if @attempt_count.nil?
267
+ return false if @created_at.nil?
268
+ true
269
+ end
270
+
271
+ # Custom attribute writer method with validation
272
+ # @param [Object] id Value to be assigned
273
+ def id=(id)
274
+ if id.nil?
275
+ fail ArgumentError, 'id cannot be nil'
276
+ end
277
+
278
+ @id = id
279
+ end
280
+
281
+ # Custom attribute writer method with validation
282
+ # @param [Object] signal_tracker_id Value to be assigned
283
+ def signal_tracker_id=(signal_tracker_id)
284
+ if signal_tracker_id.nil?
285
+ fail ArgumentError, 'signal_tracker_id cannot be nil'
286
+ end
287
+
288
+ @signal_tracker_id = signal_tracker_id
289
+ end
290
+
291
+ # Custom attribute writer method with validation
292
+ # @param [Object] event_id Value to be assigned
293
+ def event_id=(event_id)
294
+ if event_id.nil?
295
+ fail ArgumentError, 'event_id cannot be nil'
296
+ end
297
+
298
+ @event_id = event_id
299
+ end
300
+
301
+ # Custom attribute writer method with validation
302
+ # @param [Object] status Value to be assigned
303
+ def status=(status)
304
+ if status.nil?
305
+ fail ArgumentError, 'status cannot be nil'
306
+ end
307
+
308
+ @status = status
309
+ end
310
+
311
+ # Custom attribute writer method with validation
312
+ # @param [Object] is_test Value to be assigned
313
+ def is_test=(is_test)
314
+ if is_test.nil?
315
+ fail ArgumentError, 'is_test cannot be nil'
316
+ end
317
+
318
+ @is_test = is_test
319
+ end
320
+
321
+ # Custom attribute writer method with validation
322
+ # @param [Object] attempt_count Value to be assigned
323
+ def attempt_count=(attempt_count)
324
+ if attempt_count.nil?
325
+ fail ArgumentError, 'attempt_count cannot be nil'
326
+ end
327
+
328
+ @attempt_count = attempt_count
329
+ end
330
+
331
+ # Custom attribute writer method with validation
332
+ # @param [Object] created_at Value to be assigned
333
+ def created_at=(created_at)
334
+ if created_at.nil?
335
+ fail ArgumentError, 'created_at cannot be nil'
336
+ end
337
+
338
+ @created_at = created_at
339
+ end
340
+
341
+ # Checks equality by comparing each attribute.
342
+ # @param [Object] Object to be compared
343
+ def ==(o)
344
+ return true if self.equal?(o)
345
+ self.class == o.class &&
346
+ id == o.id &&
347
+ signal_tracker_id == o.signal_tracker_id &&
348
+ event_id == o.event_id &&
349
+ destination_id == o.destination_id &&
350
+ status == o.status &&
351
+ is_test == o.is_test &&
352
+ attempt_count == o.attempt_count &&
353
+ last_error == o.last_error &&
354
+ platform_response == o.platform_response &&
355
+ platform_trace_id == o.platform_trace_id &&
356
+ next_attempt_at == o.next_attempt_at &&
357
+ created_at == o.created_at &&
358
+ updated_at == o.updated_at
359
+ end
360
+
361
+ # @see the `==` method
362
+ # @param [Object] Object to be compared
363
+ def eql?(o)
364
+ self == o
365
+ end
366
+
367
+ # Calculates hash code according to all attributes.
368
+ # @return [Integer] Hash code
369
+ def hash
370
+ [id, signal_tracker_id, event_id, destination_id, status, is_test, attempt_count, last_error, platform_response, platform_trace_id, next_attempt_at, created_at, updated_at].hash
371
+ end
372
+
373
+ # Builds the object from hash
374
+ # @param [Hash] attributes Model attributes in the form of hash
375
+ # @return [Object] Returns the model itself
376
+ def self.build_from_hash(attributes)
377
+ return nil unless attributes.is_a?(Hash)
378
+ attributes = attributes.transform_keys(&:to_sym)
379
+ transformed_hash = {}
380
+ openapi_types.each_pair do |key, type|
381
+ if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil?
382
+ transformed_hash["#{key}"] = nil
383
+ elsif type =~ /\AArray<(.*)>/i
384
+ # check to ensure the input is an array given that the attribute
385
+ # is documented as an array but the input is not
386
+ if attributes[attribute_map[key]].is_a?(Array)
387
+ transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) }
388
+ end
389
+ elsif !attributes[attribute_map[key]].nil?
390
+ transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]])
391
+ end
392
+ end
393
+ new(transformed_hash)
394
+ end
395
+
396
+ # Returns the object in the form of hash
397
+ # @return [Hash] Returns the object in the form of hash
398
+ def to_hash
399
+ hash = {}
400
+ self.class.attribute_map.each_pair do |attr, param|
401
+ value = self.send(attr)
402
+ if value.nil?
403
+ is_nullable = self.class.openapi_nullable.include?(attr)
404
+ next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
405
+ end
406
+
407
+ hash[param] = _to_hash(value)
408
+ end
409
+ hash
410
+ end
411
+
412
+ end
413
+
414
+ end
@@ -0,0 +1,178 @@
1
+ =begin
2
+ #PlainRouter Conversion API
3
+
4
+ #PlainRouter public Signals Conversion API.
5
+
6
+ The version of the OpenAPI document: 0.5.0
7
+
8
+ Generated by: https://openapi-generator.tech
9
+ Generator version: 7.25.0
10
+
11
+ =end
12
+
13
+ require 'date'
14
+ require 'time'
15
+
16
+ module PlainRouter::OpenAPI
17
+ class GetEvent200ResponseLineage < ApiModelBase
18
+ attr_accessor :parent
19
+
20
+ attr_accessor :children
21
+
22
+ # Attribute mapping from ruby-style variable name to JSON key.
23
+ def self.attribute_map
24
+ {
25
+ :'parent' => :'parent',
26
+ :'children' => :'children'
27
+ }
28
+ end
29
+
30
+ # Returns attribute mapping this model knows about
31
+ def self.acceptable_attribute_map
32
+ attribute_map
33
+ end
34
+
35
+ # Returns all the JSON keys this model knows about
36
+ def self.acceptable_attributes
37
+ acceptable_attribute_map.values
38
+ end
39
+
40
+ # Attribute type mapping.
41
+ def self.openapi_types
42
+ {
43
+ :'parent' => :'GetEvent200ResponseLineageParent',
44
+ :'children' => :'Array<GetEvent200ResponseLineageChildrenInner>'
45
+ }
46
+ end
47
+
48
+ # List of attributes with nullable: true
49
+ def self.openapi_nullable
50
+ Set.new([
51
+ :'parent',
52
+ ])
53
+ end
54
+
55
+ # Initializes the object
56
+ # @param [Hash] attributes Model attributes in the form of hash
57
+ def initialize(attributes = {})
58
+ if (!attributes.is_a?(Hash))
59
+ fail ArgumentError, "The input argument (attributes) must be a hash in `PlainRouter::OpenAPI::GetEvent200ResponseLineage` initialize method"
60
+ end
61
+
62
+ # check to see if the attribute exists and convert string to symbol for hash key
63
+ acceptable_attribute_map = self.class.acceptable_attribute_map
64
+ attributes = attributes.each_with_object({}) { |(k, v), h|
65
+ if (!acceptable_attribute_map.key?(k.to_sym))
66
+ fail ArgumentError, "`#{k}` is not a valid attribute in `PlainRouter::OpenAPI::GetEvent200ResponseLineage`. Please check the name to make sure it's valid. List of attributes: " + acceptable_attribute_map.keys.inspect
67
+ end
68
+ h[k.to_sym] = v
69
+ }
70
+
71
+ if attributes.key?(:'parent')
72
+ self.parent = attributes[:'parent']
73
+ else
74
+ self.parent = nil
75
+ end
76
+
77
+ if attributes.key?(:'children')
78
+ if (value = attributes[:'children']).is_a?(Array)
79
+ self.children = value
80
+ end
81
+ else
82
+ self.children = nil
83
+ end
84
+ end
85
+
86
+ # Show invalid properties with the reasons. Usually used together with valid?
87
+ # @return Array for valid properties with the reasons
88
+ def list_invalid_properties
89
+ warn '[DEPRECATED] the `list_invalid_properties` method is obsolete'
90
+ invalid_properties = Array.new
91
+ if @children.nil?
92
+ invalid_properties.push('invalid value for "children", children cannot be nil.')
93
+ end
94
+
95
+ invalid_properties
96
+ end
97
+
98
+ # Check to see if the all the properties in the model are valid
99
+ # @return true if the model is valid
100
+ def valid?
101
+ warn '[DEPRECATED] the `valid?` method is obsolete'
102
+ return false if @children.nil?
103
+ true
104
+ end
105
+
106
+ # Custom attribute writer method with validation
107
+ # @param [Object] children Value to be assigned
108
+ def children=(children)
109
+ if children.nil?
110
+ fail ArgumentError, 'children cannot be nil'
111
+ end
112
+
113
+ @children = children
114
+ end
115
+
116
+ # Checks equality by comparing each attribute.
117
+ # @param [Object] Object to be compared
118
+ def ==(o)
119
+ return true if self.equal?(o)
120
+ self.class == o.class &&
121
+ parent == o.parent &&
122
+ children == o.children
123
+ end
124
+
125
+ # @see the `==` method
126
+ # @param [Object] Object to be compared
127
+ def eql?(o)
128
+ self == o
129
+ end
130
+
131
+ # Calculates hash code according to all attributes.
132
+ # @return [Integer] Hash code
133
+ def hash
134
+ [parent, children].hash
135
+ end
136
+
137
+ # Builds the object from hash
138
+ # @param [Hash] attributes Model attributes in the form of hash
139
+ # @return [Object] Returns the model itself
140
+ def self.build_from_hash(attributes)
141
+ return nil unless attributes.is_a?(Hash)
142
+ attributes = attributes.transform_keys(&:to_sym)
143
+ transformed_hash = {}
144
+ openapi_types.each_pair do |key, type|
145
+ if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil?
146
+ transformed_hash["#{key}"] = nil
147
+ elsif type =~ /\AArray<(.*)>/i
148
+ # check to ensure the input is an array given that the attribute
149
+ # is documented as an array but the input is not
150
+ if attributes[attribute_map[key]].is_a?(Array)
151
+ transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) }
152
+ end
153
+ elsif !attributes[attribute_map[key]].nil?
154
+ transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]])
155
+ end
156
+ end
157
+ new(transformed_hash)
158
+ end
159
+
160
+ # Returns the object in the form of hash
161
+ # @return [Hash] Returns the object in the form of hash
162
+ def to_hash
163
+ hash = {}
164
+ self.class.attribute_map.each_pair do |attr, param|
165
+ value = self.send(attr)
166
+ if value.nil?
167
+ is_nullable = self.class.openapi_nullable.include?(attr)
168
+ next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
169
+ end
170
+
171
+ hash[param] = _to_hash(value)
172
+ end
173
+ hash
174
+ end
175
+
176
+ end
177
+
178
+ end