plainrouter-sdk 0.2.0 → 0.5.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 (125) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +9 -2
  3. data/lib/plainrouter/client.rb +2 -1
  4. data/lib/plainrouter/openapi/api/action_dry_run_api_api.rb +2 -2
  5. data/lib/plainrouter/openapi/api/action_proposal_api_api.rb +2 -2
  6. data/lib/plainrouter/openapi/api/ad_test_api_api.rb +259 -0
  7. data/lib/plainrouter/openapi/api/cookie_declaration_api.rb +90 -0
  8. data/lib/plainrouter/openapi/api/creative_api.rb +181 -0
  9. data/lib/plainrouter/openapi/api/deployment_plan_api.rb +306 -0
  10. data/lib/plainrouter/openapi/api/meta_inventory_exposure_api.rb +121 -0
  11. data/lib/plainrouter/openapi/configuration.rb +42 -0
  12. data/lib/plainrouter/openapi/models/action_current_disposition.rb +13 -1
  13. data/lib/plainrouter/openapi/models/action_current_disposition_outcome_payload.rb +238 -0
  14. data/lib/plainrouter/openapi/models/action_current_disposition_outcome_payload_baseline.rb +103 -0
  15. data/lib/plainrouter/openapi/models/action_current_disposition_outcome_payload_baseline_any_of.rb +245 -0
  16. data/lib/plainrouter/openapi/models/action_current_disposition_outcome_payload_inverse.rb +206 -0
  17. data/lib/plainrouter/openapi/models/action_current_disposition_outcome_payload_metrics.rb +103 -0
  18. data/lib/plainrouter/openapi/models/action_current_disposition_outcome_payload_metrics_any_of.rb +276 -0
  19. data/lib/plainrouter/openapi/models/action_policy_read_data.rb +3 -105
  20. data/lib/plainrouter/openapi/models/action_policy_result.rb +374 -0
  21. data/lib/plainrouter/openapi/models/action_proposal_input.rb +32 -4
  22. data/lib/plainrouter/openapi/models/action_read_item.rb +62 -4
  23. data/lib/plainrouter/openapi/models/action_read_item_evidence.rb +105 -0
  24. data/lib/plainrouter/openapi/models/action_read_item_evidence_any_of.rb +190 -0
  25. data/lib/plainrouter/openapi/models/action_read_item_evidence_any_of1.rb +242 -0
  26. data/lib/plainrouter/openapi/models/action_read_item_evidence_any_of2.rb +217 -0
  27. data/lib/plainrouter/openapi/models/action_read_item_evidence_any_of_outcome.rb +238 -0
  28. data/lib/plainrouter/openapi/models/action_read_item_proposer.rb +198 -0
  29. data/lib/plainrouter/openapi/models/actions_api_dry_run401_response.rb +103 -0
  30. data/lib/plainrouter/openapi/models/actions_tests_api_index404_response.rb +103 -0
  31. data/lib/plainrouter/openapi/models/actions_tests_api_store_request.rb +467 -0
  32. data/lib/plainrouter/openapi/models/actions_tests_api_store_request_maximum_spend_minor.rb +104 -0
  33. data/lib/plainrouter/openapi/models/ad_test.rb +552 -0
  34. data/lib/plainrouter/openapi/models/ad_test_create_read.rb +164 -0
  35. data/lib/plainrouter/openapi/models/ad_test_create_read_test.rb +675 -0
  36. data/lib/plainrouter/openapi/models/ad_test_create_read_test_members_inner.rb +232 -0
  37. data/lib/plainrouter/openapi/models/ad_test_create_read_test_pause_proposals_inner.rb +286 -0
  38. data/lib/plainrouter/openapi/models/ad_test_create_read_test_verdict.rb +336 -0
  39. data/lib/plainrouter/openapi/models/ad_test_create_read_test_verdict_daily_facts_inner.rb +374 -0
  40. data/lib/plainrouter/openapi/models/ad_test_create_read_test_verdict_halt_details.rb +285 -0
  41. data/lib/plainrouter/openapi/models/ad_test_create_read_test_verdict_halt_details_baseline.rb +190 -0
  42. data/lib/plainrouter/openapi/models/ad_test_create_read_test_verdict_halt_details_observed_destinations_inner.rb +216 -0
  43. data/lib/plainrouter/openapi/models/ad_test_create_read_test_verdict_members_inner.rb +349 -0
  44. data/lib/plainrouter/openapi/models/ad_test_daily_fact_read.rb +374 -0
  45. data/lib/plainrouter/openapi/models/ad_test_event_choice.rb +190 -0
  46. data/lib/plainrouter/openapi/models/ad_test_list_read.rb +218 -0
  47. data/lib/plainrouter/openapi/models/ad_test_list_read_observed_conversion_events_inner.rb +190 -0
  48. data/lib/plainrouter/openapi/models/ad_test_list_read_tests.rb +396 -0
  49. data/lib/plainrouter/openapi/models/ad_test_read.rb +675 -0
  50. data/lib/plainrouter/openapi/models/ad_test_show_read.rb +164 -0
  51. data/lib/plainrouter/openapi/models/ad_test_verdict_member_read.rb +349 -0
  52. data/lib/plainrouter/openapi/models/ad_test_verdict_read.rb +336 -0
  53. data/lib/plainrouter/openapi/models/agent_credential_error.rb +214 -0
  54. data/lib/plainrouter/openapi/models/api_route_not_found.rb +216 -0
  55. data/lib/plainrouter/openapi/models/api_route_not_found_error.rb +240 -0
  56. data/lib/plainrouter/openapi/models/api_route_not_found_request.rb +190 -0
  57. data/lib/plainrouter/openapi/models/api_route_not_found_resources.rb +190 -0
  58. data/lib/plainrouter/openapi/models/cookie_declaration.rb +177 -0
  59. data/lib/plainrouter/openapi/models/cookie_declaration_categories.rb +268 -0
  60. data/lib/plainrouter/openapi/models/cookie_declaration_categories_necessary.rb +194 -0
  61. data/lib/plainrouter/openapi/models/cookie_declaration_item.rb +280 -0
  62. data/lib/plainrouter/openapi/models/create_event202_response_warnings_inner.rb +2 -2
  63. data/lib/plainrouter/openapi/models/create_event_request_any_of.rb +1 -1
  64. data/lib/plainrouter/openapi/models/create_event_request_any_of1.rb +1 -1
  65. data/lib/plainrouter/openapi/models/creative_intake_read.rb +164 -0
  66. data/lib/plainrouter/openapi/models/creative_intake_read_creative.rb +451 -0
  67. data/lib/plainrouter/openapi/models/creative_intake_read_creative_tags.rb +104 -0
  68. data/lib/plainrouter/openapi/models/creative_intake_rejected.rb +164 -0
  69. data/lib/plainrouter/openapi/models/creative_intake_rejected_error.rb +190 -0
  70. data/lib/plainrouter/openapi/models/creative_intake_tags.rb +257 -0
  71. data/lib/plainrouter/openapi/models/deployment_plan.rb +593 -0
  72. data/lib/plainrouter/openapi/models/deployment_plan_read.rb +268 -0
  73. data/lib/plainrouter/openapi/models/deployment_plan_read_copy.rb +266 -0
  74. data/lib/plainrouter/openapi/models/deployment_plan_read_creatives_inner.rb +320 -0
  75. data/lib/plainrouter/openapi/models/deployment_plan_read_creatives_inner_copy.rb +267 -0
  76. data/lib/plainrouter/openapi/models/destination_type.rb +2 -1
  77. data/lib/plainrouter/openapi/models/execute_deployment_plan_request.rb +200 -0
  78. data/lib/plainrouter/openapi/models/get_cookie_declaration404_response.rb +103 -0
  79. data/lib/plainrouter/openapi/models/get_inventory_metrics200_response.rb +324 -0
  80. data/lib/plainrouter/openapi/models/get_inventory_metrics200_response_account.rb +264 -0
  81. data/lib/plainrouter/openapi/models/get_inventory_metrics200_response_changes_inner.rb +304 -0
  82. data/lib/plainrouter/openapi/models/get_inventory_metrics200_response_effective_range.rb +190 -0
  83. data/lib/plainrouter/openapi/models/get_inventory_metrics200_response_metrics_inner.rb +492 -0
  84. data/lib/plainrouter/openapi/models/get_inventory_metrics200_response_object_metrics_inner.rb +304 -0
  85. data/lib/plainrouter/openapi/models/get_inventory_metrics200_response_object_metrics_inner_meta.rb +268 -0
  86. data/lib/plainrouter/openapi/models/get_inventory_metrics200_response_staleness.rb +200 -0
  87. data/lib/plainrouter/openapi/models/get_inventory_metrics200_response_sync.rb +186 -0
  88. data/lib/plainrouter/openapi/models/ingestion_warning_code.rb +2 -1
  89. data/lib/plainrouter/openapi/models/launch_intent_read.rb +164 -0
  90. data/lib/plainrouter/openapi/models/launch_intent_read_intent.rb +330 -0
  91. data/lib/plainrouter/openapi/models/launch_intent_read_intent_actions_inner.rb +238 -0
  92. data/lib/plainrouter/openapi/models/launch_intent_status.rb +46 -0
  93. data/lib/plainrouter/openapi/models/launch_plans_copy403_response.rb +103 -0
  94. data/lib/plainrouter/openapi/models/launch_plans_copy404_response.rb +103 -0
  95. data/lib/plainrouter/openapi/models/launch_plans_execute422_response.rb +103 -0
  96. data/lib/plainrouter/openapi/models/launch_plans_index200_response.rb +164 -0
  97. data/lib/plainrouter/openapi/models/launch_plans_index200_response_plans.rb +244 -0
  98. data/lib/plainrouter/openapi/models/launch_plans_show200_response.rb +164 -0
  99. data/lib/plainrouter/openapi/models/plan_copy_forbidden.rb +164 -0
  100. data/lib/plainrouter/openapi/models/plan_copy_forbidden_error.rb +214 -0
  101. data/lib/plainrouter/openapi/models/plan_copy_not_found.rb +164 -0
  102. data/lib/plainrouter/openapi/models/plan_copy_not_found_error.rb +214 -0
  103. data/lib/plainrouter/openapi/models/plan_copy_read.rb +164 -0
  104. data/lib/plainrouter/openapi/models/plan_copy_read_plan.rb +347 -0
  105. data/lib/plainrouter/openapi/models/plan_copy_rejected.rb +164 -0
  106. data/lib/plainrouter/openapi/models/plan_copy_rejected_error.rb +214 -0
  107. data/lib/plainrouter/openapi/models/plan_execute_conflict.rb +164 -0
  108. data/lib/plainrouter/openapi/models/plan_execute_conflict_error.rb +214 -0
  109. data/lib/plainrouter/openapi/models/plan_execute_rejected.rb +164 -0
  110. data/lib/plainrouter/openapi/models/plan_execute_rejected_error.rb +214 -0
  111. data/lib/plainrouter/openapi/models/proposal_replay_conflict.rb +214 -0
  112. data/lib/plainrouter/openapi/models/proposal_replay_conflict_errors.rb +178 -0
  113. data/lib/plainrouter/openapi/models/store_creative403_response.rb +103 -0
  114. data/lib/plainrouter/openapi/models/store_creative413_response.rb +103 -0
  115. data/lib/plainrouter/openapi/models/store_creative422_response.rb +103 -0
  116. data/lib/plainrouter/openapi/models/store_creative_from_url_request.rb +208 -0
  117. data/lib/plainrouter/openapi/models/store_creative_from_url_request_tags.rb +257 -0
  118. data/lib/plainrouter/openapi/models/store_creative_request.rb +219 -0
  119. data/lib/plainrouter/openapi/models/store_creative_request_tags.rb +257 -0
  120. data/lib/plainrouter/openapi/models/workspace_lock_timeout.rb +164 -0
  121. data/lib/plainrouter/openapi/models/workspace_lock_timeout_error.rb +214 -0
  122. data/lib/plainrouter/openapi/version.rb +1 -1
  123. data/lib/plainrouter/openapi.rb +106 -0
  124. data/lib/plainrouter/version.rb +1 -1
  125. metadata +108 -2
@@ -0,0 +1,451 @@
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 CreativeIntakeReadCreative < ApiModelBase
18
+ attr_accessor :id
19
+
20
+ attr_accessor :fingerprint
21
+
22
+ attr_accessor :type
23
+
24
+ attr_accessor :mime_type
25
+
26
+ attr_accessor :byte_size
27
+
28
+ attr_accessor :width
29
+
30
+ attr_accessor :height
31
+
32
+ attr_accessor :aspect_ratio
33
+
34
+ attr_accessor :duration_ms
35
+
36
+ attr_accessor :original_filename
37
+
38
+ attr_accessor :source_ref
39
+
40
+ attr_accessor :tags
41
+
42
+ attr_accessor :status
43
+
44
+ attr_accessor :created_at
45
+
46
+ attr_accessor :updated_at
47
+
48
+ class EnumAttributeValidator
49
+ attr_reader :datatype
50
+ attr_reader :allowable_values
51
+
52
+ def initialize(datatype, allowable_values)
53
+ @allowable_values = allowable_values.map do |value|
54
+ case datatype.to_s
55
+ when /Integer/i
56
+ value.to_i
57
+ when /Float/i
58
+ value.to_f
59
+ else
60
+ value
61
+ end
62
+ end
63
+ end
64
+
65
+ def valid?(value)
66
+ !value || allowable_values.include?(value)
67
+ end
68
+ end
69
+
70
+ # Attribute mapping from ruby-style variable name to JSON key.
71
+ def self.attribute_map
72
+ {
73
+ :'id' => :'id',
74
+ :'fingerprint' => :'fingerprint',
75
+ :'type' => :'type',
76
+ :'mime_type' => :'mime_type',
77
+ :'byte_size' => :'byte_size',
78
+ :'width' => :'width',
79
+ :'height' => :'height',
80
+ :'aspect_ratio' => :'aspect_ratio',
81
+ :'duration_ms' => :'duration_ms',
82
+ :'original_filename' => :'original_filename',
83
+ :'source_ref' => :'source_ref',
84
+ :'tags' => :'tags',
85
+ :'status' => :'status',
86
+ :'created_at' => :'created_at',
87
+ :'updated_at' => :'updated_at'
88
+ }
89
+ end
90
+
91
+ # Returns attribute mapping this model knows about
92
+ def self.acceptable_attribute_map
93
+ attribute_map
94
+ end
95
+
96
+ # Returns all the JSON keys this model knows about
97
+ def self.acceptable_attributes
98
+ acceptable_attribute_map.values
99
+ end
100
+
101
+ # Attribute type mapping.
102
+ def self.openapi_types
103
+ {
104
+ :'id' => :'String',
105
+ :'fingerprint' => :'String',
106
+ :'type' => :'String',
107
+ :'mime_type' => :'String',
108
+ :'byte_size' => :'Integer',
109
+ :'width' => :'Integer',
110
+ :'height' => :'Integer',
111
+ :'aspect_ratio' => :'Float',
112
+ :'duration_ms' => :'Integer',
113
+ :'original_filename' => :'String',
114
+ :'source_ref' => :'String',
115
+ :'tags' => :'CreativeIntakeReadCreativeTags',
116
+ :'status' => :'String',
117
+ :'created_at' => :'String',
118
+ :'updated_at' => :'String'
119
+ }
120
+ end
121
+
122
+ # List of attributes with nullable: true
123
+ def self.openapi_nullable
124
+ Set.new([
125
+ :'width',
126
+ :'height',
127
+ :'aspect_ratio',
128
+ :'duration_ms',
129
+ :'original_filename',
130
+ :'source_ref',
131
+ :'created_at',
132
+ :'updated_at'
133
+ ])
134
+ end
135
+
136
+ # Initializes the object
137
+ # @param [Hash] attributes Model attributes in the form of hash
138
+ def initialize(attributes = {})
139
+ if (!attributes.is_a?(Hash))
140
+ fail ArgumentError, "The input argument (attributes) must be a hash in `PlainRouter::OpenAPI::CreativeIntakeReadCreative` initialize method"
141
+ end
142
+
143
+ # check to see if the attribute exists and convert string to symbol for hash key
144
+ acceptable_attribute_map = self.class.acceptable_attribute_map
145
+ attributes = attributes.each_with_object({}) { |(k, v), h|
146
+ if (!acceptable_attribute_map.key?(k.to_sym))
147
+ fail ArgumentError, "`#{k}` is not a valid attribute in `PlainRouter::OpenAPI::CreativeIntakeReadCreative`. Please check the name to make sure it's valid. List of attributes: " + acceptable_attribute_map.keys.inspect
148
+ end
149
+ h[k.to_sym] = v
150
+ }
151
+
152
+ if attributes.key?(:'id')
153
+ self.id = attributes[:'id']
154
+ else
155
+ self.id = nil
156
+ end
157
+
158
+ if attributes.key?(:'fingerprint')
159
+ self.fingerprint = attributes[:'fingerprint']
160
+ else
161
+ self.fingerprint = nil
162
+ end
163
+
164
+ if attributes.key?(:'type')
165
+ self.type = attributes[:'type']
166
+ else
167
+ self.type = nil
168
+ end
169
+
170
+ if attributes.key?(:'mime_type')
171
+ self.mime_type = attributes[:'mime_type']
172
+ else
173
+ self.mime_type = nil
174
+ end
175
+
176
+ if attributes.key?(:'byte_size')
177
+ self.byte_size = attributes[:'byte_size']
178
+ else
179
+ self.byte_size = nil
180
+ end
181
+
182
+ if attributes.key?(:'width')
183
+ self.width = attributes[:'width']
184
+ else
185
+ self.width = nil
186
+ end
187
+
188
+ if attributes.key?(:'height')
189
+ self.height = attributes[:'height']
190
+ else
191
+ self.height = nil
192
+ end
193
+
194
+ if attributes.key?(:'aspect_ratio')
195
+ self.aspect_ratio = attributes[:'aspect_ratio']
196
+ else
197
+ self.aspect_ratio = nil
198
+ end
199
+
200
+ if attributes.key?(:'duration_ms')
201
+ self.duration_ms = attributes[:'duration_ms']
202
+ else
203
+ self.duration_ms = nil
204
+ end
205
+
206
+ if attributes.key?(:'original_filename')
207
+ self.original_filename = attributes[:'original_filename']
208
+ end
209
+
210
+ if attributes.key?(:'source_ref')
211
+ self.source_ref = attributes[:'source_ref']
212
+ else
213
+ self.source_ref = nil
214
+ end
215
+
216
+ if attributes.key?(:'tags')
217
+ self.tags = attributes[:'tags']
218
+ else
219
+ self.tags = nil
220
+ end
221
+
222
+ if attributes.key?(:'status')
223
+ self.status = attributes[:'status']
224
+ else
225
+ self.status = nil
226
+ end
227
+
228
+ if attributes.key?(:'created_at')
229
+ self.created_at = attributes[:'created_at']
230
+ else
231
+ self.created_at = nil
232
+ end
233
+
234
+ if attributes.key?(:'updated_at')
235
+ self.updated_at = attributes[:'updated_at']
236
+ else
237
+ self.updated_at = nil
238
+ end
239
+ end
240
+
241
+ # Show invalid properties with the reasons. Usually used together with valid?
242
+ # @return Array for valid properties with the reasons
243
+ def list_invalid_properties
244
+ warn '[DEPRECATED] the `list_invalid_properties` method is obsolete'
245
+ invalid_properties = Array.new
246
+ if @id.nil?
247
+ invalid_properties.push('invalid value for "id", id cannot be nil.')
248
+ end
249
+
250
+ pattern = Regexp.new(/^[0-7][0-9a-hjkmnp-tv-z]{25}$/)
251
+ if @id !~ pattern
252
+ invalid_properties.push("invalid value for \"id\", must conform to the pattern #{pattern}.")
253
+ end
254
+
255
+ if @fingerprint.nil?
256
+ invalid_properties.push('invalid value for "fingerprint", fingerprint cannot be nil.')
257
+ end
258
+
259
+ if @type.nil?
260
+ invalid_properties.push('invalid value for "type", type cannot be nil.')
261
+ end
262
+
263
+ if @mime_type.nil?
264
+ invalid_properties.push('invalid value for "mime_type", mime_type cannot be nil.')
265
+ end
266
+
267
+ if @byte_size.nil?
268
+ invalid_properties.push('invalid value for "byte_size", byte_size cannot be nil.')
269
+ end
270
+
271
+ if @tags.nil?
272
+ invalid_properties.push('invalid value for "tags", tags cannot be nil.')
273
+ end
274
+
275
+ if @status.nil?
276
+ invalid_properties.push('invalid value for "status", status cannot be nil.')
277
+ end
278
+
279
+ invalid_properties
280
+ end
281
+
282
+ # Check to see if the all the properties in the model are valid
283
+ # @return true if the model is valid
284
+ def valid?
285
+ warn '[DEPRECATED] the `valid?` method is obsolete'
286
+ return false if @id.nil?
287
+ return false if @id !~ Regexp.new(/^[0-7][0-9a-hjkmnp-tv-z]{25}$/)
288
+ return false if @fingerprint.nil?
289
+ return false if @type.nil?
290
+ type_validator = EnumAttributeValidator.new('String', ["image", "video"])
291
+ return false unless type_validator.valid?(@type)
292
+ return false if @mime_type.nil?
293
+ return false if @byte_size.nil?
294
+ return false if @tags.nil?
295
+ return false if @status.nil?
296
+ status_validator = EnumAttributeValidator.new('String', ["draft", "approved", "retired"])
297
+ return false unless status_validator.valid?(@status)
298
+ true
299
+ end
300
+
301
+ # Custom attribute writer method with validation
302
+ # @param [Object] id Value to be assigned
303
+ def id=(id)
304
+ if id.nil?
305
+ fail ArgumentError, 'id cannot be nil'
306
+ end
307
+
308
+ pattern = Regexp.new(/^[0-7][0-9a-hjkmnp-tv-z]{25}$/)
309
+ if id !~ pattern
310
+ fail ArgumentError, "invalid value for \"id\", must conform to the pattern #{pattern}."
311
+ end
312
+
313
+ @id = id
314
+ end
315
+
316
+ # Custom attribute writer method with validation
317
+ # @param [Object] fingerprint Value to be assigned
318
+ def fingerprint=(fingerprint)
319
+ if fingerprint.nil?
320
+ fail ArgumentError, 'fingerprint cannot be nil'
321
+ end
322
+
323
+ @fingerprint = fingerprint
324
+ end
325
+
326
+ # Custom attribute writer method checking allowed values (enum).
327
+ # @param [Object] type Object to be assigned
328
+ def type=(type)
329
+ validator = EnumAttributeValidator.new('String', ["image", "video"])
330
+ unless validator.valid?(type)
331
+ fail ArgumentError, "invalid value for \"type\", must be one of #{validator.allowable_values}."
332
+ end
333
+ @type = type
334
+ end
335
+
336
+ # Custom attribute writer method with validation
337
+ # @param [Object] mime_type Value to be assigned
338
+ def mime_type=(mime_type)
339
+ if mime_type.nil?
340
+ fail ArgumentError, 'mime_type cannot be nil'
341
+ end
342
+
343
+ @mime_type = mime_type
344
+ end
345
+
346
+ # Custom attribute writer method with validation
347
+ # @param [Object] byte_size Value to be assigned
348
+ def byte_size=(byte_size)
349
+ if byte_size.nil?
350
+ fail ArgumentError, 'byte_size cannot be nil'
351
+ end
352
+
353
+ @byte_size = byte_size
354
+ end
355
+
356
+ # Custom attribute writer method with validation
357
+ # @param [Object] tags Value to be assigned
358
+ def tags=(tags)
359
+ if tags.nil?
360
+ fail ArgumentError, 'tags cannot be nil'
361
+ end
362
+
363
+ @tags = tags
364
+ end
365
+
366
+ # Custom attribute writer method checking allowed values (enum).
367
+ # @param [Object] status Object to be assigned
368
+ def status=(status)
369
+ validator = EnumAttributeValidator.new('String', ["draft", "approved", "retired"])
370
+ unless validator.valid?(status)
371
+ fail ArgumentError, "invalid value for \"status\", must be one of #{validator.allowable_values}."
372
+ end
373
+ @status = status
374
+ end
375
+
376
+ # Checks equality by comparing each attribute.
377
+ # @param [Object] Object to be compared
378
+ def ==(o)
379
+ return true if self.equal?(o)
380
+ self.class == o.class &&
381
+ id == o.id &&
382
+ fingerprint == o.fingerprint &&
383
+ type == o.type &&
384
+ mime_type == o.mime_type &&
385
+ byte_size == o.byte_size &&
386
+ width == o.width &&
387
+ height == o.height &&
388
+ aspect_ratio == o.aspect_ratio &&
389
+ duration_ms == o.duration_ms &&
390
+ original_filename == o.original_filename &&
391
+ source_ref == o.source_ref &&
392
+ tags == o.tags &&
393
+ status == o.status &&
394
+ created_at == o.created_at &&
395
+ updated_at == o.updated_at
396
+ end
397
+
398
+ # @see the `==` method
399
+ # @param [Object] Object to be compared
400
+ def eql?(o)
401
+ self == o
402
+ end
403
+
404
+ # Calculates hash code according to all attributes.
405
+ # @return [Integer] Hash code
406
+ def hash
407
+ [id, fingerprint, type, mime_type, byte_size, width, height, aspect_ratio, duration_ms, original_filename, source_ref, tags, status, created_at, updated_at].hash
408
+ end
409
+
410
+ # Builds the object from hash
411
+ # @param [Hash] attributes Model attributes in the form of hash
412
+ # @return [Object] Returns the model itself
413
+ def self.build_from_hash(attributes)
414
+ return nil unless attributes.is_a?(Hash)
415
+ attributes = attributes.transform_keys(&:to_sym)
416
+ transformed_hash = {}
417
+ openapi_types.each_pair do |key, type|
418
+ if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil?
419
+ transformed_hash["#{key}"] = nil
420
+ elsif type =~ /\AArray<(.*)>/i
421
+ # check to ensure the input is an array given that the attribute
422
+ # is documented as an array but the input is not
423
+ if attributes[attribute_map[key]].is_a?(Array)
424
+ transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) }
425
+ end
426
+ elsif !attributes[attribute_map[key]].nil?
427
+ transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]])
428
+ end
429
+ end
430
+ new(transformed_hash)
431
+ end
432
+
433
+ # Returns the object in the form of hash
434
+ # @return [Hash] Returns the object in the form of hash
435
+ def to_hash
436
+ hash = {}
437
+ self.class.attribute_map.each_pair do |attr, param|
438
+ value = self.send(attr)
439
+ if value.nil?
440
+ is_nullable = self.class.openapi_nullable.include?(attr)
441
+ next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
442
+ end
443
+
444
+ hash[param] = _to_hash(value)
445
+ end
446
+ hash
447
+ end
448
+
449
+ end
450
+
451
+ end
@@ -0,0 +1,104 @@
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
+ # Stored tags, including provenance when supplied. An empty map is returned as an empty array. Existing creatives keep their original tags.
18
+ module CreativeIntakeReadCreativeTags
19
+ class << self
20
+ # List of class defined in anyOf (OpenAPI v3)
21
+ def openapi_any_of
22
+ [
23
+ :'Array<String>',
24
+ :'Hash<String, String>'
25
+ ]
26
+ end
27
+
28
+ # Builds the object
29
+ # @param [Mixed] Data to be matched against the list of anyOf items
30
+ # @return [Object] Returns the model or the data itself
31
+ def build(data)
32
+ # Go through the list of anyOf items and attempt to identify the appropriate one.
33
+ # Note:
34
+ # - No advanced validation of types in some cases (e.g. "x: { type: string }" will happily match { x: 123 })
35
+ # due to the way the deserialization is made in the base_object template (it just casts without verifying).
36
+ # - TODO: scalar values are de facto behaving as if they were nullable.
37
+ # - TODO: logging when debugging is set.
38
+ openapi_any_of.each do |klass|
39
+ begin
40
+ next if klass == :AnyType # "nullable: true"
41
+ return find_and_cast_into_type(klass, data)
42
+ rescue # rescue all errors so we keep iterating even if the current item lookup raises
43
+ end
44
+ end
45
+
46
+ openapi_any_of.include?(:AnyType) ? data : nil
47
+ end
48
+
49
+ private
50
+
51
+ SchemaMismatchError = Class.new(StandardError)
52
+
53
+ # Note: 'File' is missing here because in the regular case we get the data _after_ a call to JSON.parse.
54
+ def find_and_cast_into_type(klass, data)
55
+ return if data.nil?
56
+
57
+ case klass.to_s
58
+ when 'Boolean'
59
+ return data if data.instance_of?(TrueClass) || data.instance_of?(FalseClass)
60
+ when 'Float'
61
+ return data if data.instance_of?(Float)
62
+ when 'Integer'
63
+ return data if data.instance_of?(Integer)
64
+ when 'Time'
65
+ return Time.parse(data)
66
+ when 'Date'
67
+ return Date.iso8601(data)
68
+ when 'String'
69
+ return data if data.instance_of?(String)
70
+ when 'Object' # "type: object"
71
+ return data if data.instance_of?(Hash)
72
+ when /\AArray<(?<sub_type>.+)>\z/ # "type: array"
73
+ if data.instance_of?(Array)
74
+ sub_type = Regexp.last_match[:sub_type]
75
+ return data.map { |item| find_and_cast_into_type(sub_type, item) }
76
+ end
77
+ when /\AHash<String, (?<sub_type>.+)>\z/ # "type: object" with "additionalProperties: { ... }"
78
+ if data.instance_of?(Hash) && data.keys.all? { |k| k.instance_of?(Symbol) || k.instance_of?(String) }
79
+ sub_type = Regexp.last_match[:sub_type]
80
+ return data.each_with_object({}) { |(k, v), hsh| hsh[k] = find_and_cast_into_type(sub_type, v) }
81
+ end
82
+ else # model
83
+ const = PlainRouter::OpenAPI.const_get(klass)
84
+ if const
85
+ if const.respond_to?(:openapi_any_of) # nested anyOf model
86
+ model = const.build(data)
87
+ return model if model
88
+ else
89
+ # raise if data contains keys that are not known to the model
90
+ raise if const.respond_to?(:acceptable_attributes) && !(data.keys - const.acceptable_attributes).empty?
91
+ model = const.build_from_hash(data)
92
+ return model if model
93
+ end
94
+ end
95
+ end
96
+
97
+ raise # if no match by now, raise
98
+ rescue
99
+ raise SchemaMismatchError, "#{data} doesn't match the #{klass} type"
100
+ end
101
+ end
102
+ end
103
+
104
+ end