plainrouter-sdk 0.5.0 → 0.6.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 (148) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +7 -0
  3. data/lib/plainrouter/client.rb +337 -3
  4. data/lib/plainrouter/closed_input_objects.json +3896 -0
  5. data/lib/plainrouter/closed_input_validator.rb +246 -0
  6. data/lib/plainrouter/integer_input_fields.json +579 -0
  7. data/lib/plainrouter/openapi/api/action_read_api_api.rb +71 -31
  8. data/lib/plainrouter/openapi/api/action_rule_api_api.rb +350 -0
  9. data/lib/plainrouter/openapi/api/ad_test_api_api.rb +13 -9
  10. data/lib/plainrouter/openapi/api/agent_context_api.rb +93 -0
  11. data/lib/plainrouter/openapi/api/creative_api.rb +241 -0
  12. data/lib/plainrouter/openapi/api/deployment_plan_api.rb +257 -2
  13. data/lib/plainrouter/openapi/api/draft_batch_file_import_api.rb +142 -0
  14. data/lib/plainrouter/openapi/api/launch_policy_api.rb +242 -0
  15. data/lib/plainrouter/openapi/api/meta_inventory_exposure_api.rb +133 -0
  16. data/lib/plainrouter/openapi/api_client.rb +3 -0
  17. data/lib/plainrouter/openapi/api_model_base.rb +2 -0
  18. data/lib/plainrouter/openapi/configuration.rb +34 -0
  19. data/lib/plainrouter/openapi/models/action_batch_read_data.rb +42 -4
  20. data/lib/plainrouter/openapi/models/action_dry_run_read_dry_run.rb +42 -4
  21. data/lib/plainrouter/openapi/models/action_list_read_meta.rb +33 -4
  22. data/lib/plainrouter/openapi/models/action_proposal_input.rb +72 -1
  23. data/lib/plainrouter/openapi/models/action_proposal_input_actions_inner.rb +1 -0
  24. data/lib/plainrouter/openapi/models/action_proposal_input_actions_inner_any_of.rb +2 -0
  25. data/lib/plainrouter/openapi/models/action_proposal_input_actions_inner_any_of1.rb +2 -0
  26. data/lib/plainrouter/openapi/models/action_proposal_input_actions_inner_any_of10.rb +2 -0
  27. data/lib/plainrouter/openapi/models/action_proposal_input_actions_inner_any_of10_params.rb +2 -0
  28. data/lib/plainrouter/openapi/models/action_proposal_input_actions_inner_any_of11.rb +3 -1
  29. data/lib/plainrouter/openapi/models/action_proposal_input_actions_inner_any_of12.rb +2 -0
  30. data/lib/plainrouter/openapi/models/action_proposal_input_actions_inner_any_of12_params.rb +2 -0
  31. data/lib/plainrouter/openapi/models/action_proposal_input_actions_inner_any_of13.rb +2 -0
  32. data/lib/plainrouter/openapi/models/action_proposal_input_actions_inner_any_of13_params.rb +2 -0
  33. data/lib/plainrouter/openapi/models/action_proposal_input_actions_inner_any_of2.rb +2 -0
  34. data/lib/plainrouter/openapi/models/action_proposal_input_actions_inner_any_of3.rb +2 -0
  35. data/lib/plainrouter/openapi/models/action_proposal_input_actions_inner_any_of4.rb +2 -0
  36. data/lib/plainrouter/openapi/models/action_proposal_input_actions_inner_any_of4_target_entity.rb +2 -0
  37. data/lib/plainrouter/openapi/models/action_proposal_input_actions_inner_any_of5.rb +2 -0
  38. data/lib/plainrouter/openapi/models/action_proposal_input_actions_inner_any_of6.rb +2 -0
  39. data/lib/plainrouter/openapi/models/action_proposal_input_actions_inner_any_of7.rb +2 -0
  40. data/lib/plainrouter/openapi/models/action_proposal_input_actions_inner_any_of8.rb +2 -0
  41. data/lib/plainrouter/openapi/models/action_proposal_input_actions_inner_any_of9.rb +2 -0
  42. data/lib/plainrouter/openapi/models/action_proposal_input_actions_inner_any_of_params.rb +2 -0
  43. data/lib/plainrouter/openapi/models/action_proposal_input_actions_inner_any_of_target_entity.rb +2 -0
  44. data/lib/plainrouter/openapi/models/action_proposal_input_evidence_inner.rb +4 -2
  45. data/lib/plainrouter/openapi/models/action_proposal_read_proposal.rb +42 -4
  46. data/lib/plainrouter/openapi/models/action_read_item.rb +11 -1
  47. data/lib/plainrouter/openapi/models/action_read_item_counted_evidence.rb +319 -0
  48. data/lib/plainrouter/openapi/models/action_read_item_counted_evidence_counted.rb +174 -0
  49. data/lib/plainrouter/openapi/models/action_read_item_counted_evidence_coverage.rb +162 -0
  50. data/lib/plainrouter/openapi/models/action_read_item_counted_evidence_meta_reported.rb +198 -0
  51. data/lib/plainrouter/openapi/models/{action_proposal_input_actions_inner_any_of11_params.rb → action_read_item_counted_evidence_target.rb} +41 -24
  52. data/lib/plainrouter/openapi/models/action_read_item_counted_evidence_window.rb +225 -0
  53. data/lib/plainrouter/openapi/models/action_receipt_unavailable.rb +164 -0
  54. data/lib/plainrouter/openapi/models/action_receipt_unavailable_error.rb +214 -0
  55. data/lib/plainrouter/openapi/models/action_rule_detail_read.rb +164 -0
  56. data/lib/plainrouter/openapi/models/action_rule_detail_read_rule.rb +402 -0
  57. data/lib/plainrouter/openapi/models/action_rule_detail_read_rule_current_revision.rb +388 -0
  58. data/lib/plainrouter/openapi/models/action_rule_detail_read_rule_runs_inner.rb +396 -0
  59. data/lib/plainrouter/openapi/models/action_rule_detail_read_rule_runs_inner_decisions_inner.rb +382 -0
  60. data/lib/plainrouter/openapi/models/action_rule_detail_read_rule_window.rb +242 -0
  61. data/lib/plainrouter/openapi/models/action_rule_write_read.rb +164 -0
  62. data/lib/plainrouter/openapi/models/action_rule_write_read_rule.rb +373 -0
  63. data/lib/plainrouter/openapi/models/actions_api_decision_receipt404_response.rb +103 -0
  64. data/lib/plainrouter/openapi/models/actions_rules_index200_response.rb +164 -0
  65. data/lib/plainrouter/openapi/models/actions_rules_index200_response_rules.rb +196 -0
  66. data/lib/plainrouter/openapi/models/actions_rules_index200_response_rules_data_inner.rb +344 -0
  67. data/lib/plainrouter/openapi/models/actions_rules_index200_response_rules_data_inner_account.rb +157 -0
  68. data/lib/plainrouter/openapi/models/actions_rules_index200_response_rules_data_inner_counts.rb +156 -0
  69. data/lib/plainrouter/openapi/models/actions_rules_index403_response.rb +103 -0
  70. data/lib/plainrouter/openapi/models/actions_rules_index403_response_any_of.rb +214 -0
  71. data/lib/plainrouter/openapi/models/actions_rules_store_request.rb +317 -0
  72. data/lib/plainrouter/openapi/models/actions_rules_store_request_definition.rb +105 -0
  73. data/lib/plainrouter/openapi/models/actions_rules_store_request_definition_any_of.rb +317 -0
  74. data/lib/plainrouter/openapi/models/actions_rules_store_request_definition_any_of1.rb +361 -0
  75. data/lib/plainrouter/openapi/models/actions_rules_store_request_definition_any_of2.rb +361 -0
  76. data/lib/plainrouter/openapi/models/actions_rules_store_request_definition_any_of_cost_ratio.rb +104 -0
  77. data/lib/plainrouter/openapi/models/actions_rules_store_request_window.rb +103 -0
  78. data/lib/plainrouter/openapi/models/actions_rules_update_request.rb +267 -0
  79. data/lib/plainrouter/openapi/models/actions_rules_update_request_definition.rb +105 -0
  80. data/lib/plainrouter/openapi/models/actions_rules_update_request_definition_any_of.rb +317 -0
  81. data/lib/plainrouter/openapi/models/actions_rules_update_request_definition_any_of1.rb +361 -0
  82. data/lib/plainrouter/openapi/models/actions_rules_update_request_definition_any_of2.rb +361 -0
  83. data/lib/plainrouter/openapi/models/ad_test_list_read_tests.rb +1 -1
  84. data/lib/plainrouter/openapi/models/agent_context200_response.rb +214 -0
  85. data/lib/plainrouter/openapi/models/agent_context200_response_agent.rb +268 -0
  86. data/lib/plainrouter/openapi/models/agent_context200_response_platform_ad_account.rb +292 -0
  87. data/lib/plainrouter/openapi/models/agent_context200_response_platform_ad_account_workspace.rb +190 -0
  88. data/lib/plainrouter/openapi/models/agent_context401_response.rb +103 -0
  89. data/lib/plainrouter/openapi/models/agent_context_auth_error.rb +190 -0
  90. data/lib/plainrouter/openapi/models/creative_intake_read.rb +1 -1
  91. data/lib/plainrouter/openapi/models/creative_mcp_grant_operation.rb +44 -0
  92. data/lib/plainrouter/openapi/models/creative_mcp_preview.rb +283 -0
  93. data/lib/plainrouter/openapi/models/creative_mcp_refusal.rb +45 -0
  94. data/lib/plainrouter/openapi/models/creative_mcp_tool.rb +44 -0
  95. data/lib/plainrouter/openapi/models/delivery_status.rb +2 -1
  96. data/lib/plainrouter/openapi/models/deployment_plan_read.rb +42 -4
  97. data/lib/plainrouter/openapi/models/destination.rb +73 -9
  98. data/lib/plainrouter/openapi/models/destination_config.rb +103 -0
  99. data/lib/plainrouter/openapi/models/destination_status.rb +2 -1
  100. data/lib/plainrouter/openapi/models/draft_batch_mode.rb +41 -0
  101. data/lib/plainrouter/openapi/models/get_account_inventory200_response.rb +341 -0
  102. data/lib/plainrouter/openapi/models/get_account_inventory200_response_summary.rb +158 -0
  103. data/lib/plainrouter/openapi/models/get_account_inventory404_response.rb +188 -0
  104. data/lib/plainrouter/openapi/models/get_event200_response_deliveries_inner.rb +25 -1
  105. data/lib/plainrouter/openapi/models/get_event200_response_event_deliveries_inner.rb +25 -1
  106. data/lib/plainrouter/openapi/models/get_inventory_metrics200_response.rb +26 -5
  107. data/lib/plainrouter/openapi/models/get_inventory_metrics200_response_pagination_value.rb +202 -0
  108. data/lib/plainrouter/openapi/models/launch_creatives_index200_response.rb +164 -0
  109. data/lib/plainrouter/openapi/models/launch_creatives_index200_response_creatives.rb +196 -0
  110. data/lib/plainrouter/openapi/models/{creative_intake_read_creative.rb → launch_creatives_index200_response_creatives_data_inner.rb} +4 -4
  111. data/lib/plainrouter/openapi/models/{creative_intake_read_creative_tags.rb → launch_creatives_index200_response_creatives_data_inner_tags.rb} +1 -1
  112. data/lib/plainrouter/openapi/models/launch_creatives_status200_response.rb +166 -0
  113. data/lib/plainrouter/openapi/models/launch_plans_copy422_response.rb +103 -0
  114. data/lib/plainrouter/openapi/models/launch_plans_index200_response_plans.rb +107 -4
  115. data/lib/plainrouter/openapi/models/launch_plans_index200_response_plans_next_page_arguments.rb +104 -0
  116. data/lib/plainrouter/openapi/models/launch_plans_index200_response_plans_next_page_arguments_any_of.rb +190 -0
  117. data/lib/plainrouter/openapi/models/launch_plans_index200_response_plans_next_page_arguments_any_of1.rb +190 -0
  118. data/lib/plainrouter/openapi/models/launch_plans_store201_response.rb +166 -0
  119. data/lib/plainrouter/openapi/models/launch_plans_validate422_response.rb +103 -0
  120. data/lib/plainrouter/openapi/models/launch_policies_index200_response.rb +164 -0
  121. data/lib/plainrouter/openapi/models/launch_policies_index200_response_policies.rb +453 -0
  122. data/lib/plainrouter/openapi/models/{list_events200_response_events_links_inner.rb → launch_policies_index200_response_policies_links_inner.rb} +3 -3
  123. data/lib/plainrouter/openapi/models/launch_policies_store201_response.rb +166 -0
  124. data/lib/plainrouter/openapi/models/launch_policy.rb +346 -0
  125. data/lib/plainrouter/openapi/models/launcher_file_import403_response.rb +216 -0
  126. data/lib/plainrouter/openapi/models/launcher_file_import422_response.rb +103 -0
  127. data/lib/plainrouter/openapi/models/launcher_file_import422_response_any_of.rb +242 -0
  128. data/lib/plainrouter/openapi/models/launcher_file_import422_response_any_of_syntactic_row_failures_inner.rb +190 -0
  129. data/lib/plainrouter/openapi/models/list_events200_response_events.rb +1 -1
  130. data/lib/plainrouter/openapi/models/plan_execute_rejected_error.rb +2 -2
  131. data/lib/plainrouter/openapi/models/plan_validate_rejected.rb +164 -0
  132. data/lib/plainrouter/openapi/models/plan_validate_rejected_error.rb +191 -0
  133. data/lib/plainrouter/openapi/models/proposal_unavailable.rb +164 -0
  134. data/lib/plainrouter/openapi/models/proposal_unavailable_error.rb +214 -0
  135. data/lib/plainrouter/openapi/models/set_destination_test_mode200_response_destination.rb +67 -1
  136. data/lib/plainrouter/openapi/models/{deployment_plan.rb → store_deployment_plan_request.rb} +185 -208
  137. data/lib/plainrouter/openapi/models/store_deployment_plan_request_ad_set_spec.rb +220 -0
  138. data/lib/plainrouter/openapi/models/store_deployment_plan_request_copy.rb +266 -0
  139. data/lib/plainrouter/openapi/models/store_deployment_plan_request_creative_overrides_inner.rb +217 -0
  140. data/lib/plainrouter/openapi/models/store_launch_policy_request.rb +260 -0
  141. data/lib/plainrouter/openapi/models/update_creative_status_request.rb +188 -0
  142. data/lib/plainrouter/openapi/models/update_deployment_plan_request.rb +511 -0
  143. data/lib/plainrouter/openapi/version.rb +1 -1
  144. data/lib/plainrouter/openapi.rb +87 -5
  145. data/lib/plainrouter/proposal_errors.rb +31 -0
  146. data/lib/plainrouter/version.rb +1 -1
  147. data/lib/plainrouter.rb +1 -0
  148. metadata +93 -7
@@ -23,13 +23,29 @@ module PlainRouter::OpenAPI
23
23
 
24
24
  attr_accessor :total
25
25
 
26
+ attr_accessor :last_page
27
+
28
+ # Always present. The next row offset, or null when the list is complete.
29
+ attr_accessor :next_cursor
30
+
31
+ attr_accessor :truncated
32
+
33
+ attr_accessor :next_page_arguments
34
+
35
+ attr_accessor :continuation
36
+
26
37
  # Attribute mapping from ruby-style variable name to JSON key.
27
38
  def self.attribute_map
28
39
  {
29
40
  :'data' => :'data',
30
41
  :'current_page' => :'current_page',
31
42
  :'per_page' => :'per_page',
32
- :'total' => :'total'
43
+ :'total' => :'total',
44
+ :'last_page' => :'last_page',
45
+ :'next_cursor' => :'next_cursor',
46
+ :'truncated' => :'truncated',
47
+ :'next_page_arguments' => :'next_page_arguments',
48
+ :'continuation' => :'continuation'
33
49
  }
34
50
  end
35
51
 
@@ -49,13 +65,20 @@ module PlainRouter::OpenAPI
49
65
  :'data' => :'Array<DeploymentPlanRead>',
50
66
  :'current_page' => :'Integer',
51
67
  :'per_page' => :'Integer',
52
- :'total' => :'Integer'
68
+ :'total' => :'Integer',
69
+ :'last_page' => :'Integer',
70
+ :'next_cursor' => :'Integer',
71
+ :'truncated' => :'Boolean',
72
+ :'next_page_arguments' => :'LaunchPlansIndex200ResponsePlansNextPageArguments',
73
+ :'continuation' => :'String'
53
74
  }
54
75
  end
55
76
 
56
77
  # List of attributes with nullable: true
57
78
  def self.openapi_nullable
58
79
  Set.new([
80
+ :'next_cursor',
81
+ :'next_page_arguments',
59
82
  ])
60
83
  end
61
84
 
@@ -100,6 +123,36 @@ module PlainRouter::OpenAPI
100
123
  else
101
124
  self.total = nil
102
125
  end
126
+
127
+ if attributes.key?(:'last_page')
128
+ self.last_page = attributes[:'last_page']
129
+ else
130
+ self.last_page = nil
131
+ end
132
+
133
+ if attributes.key?(:'next_cursor')
134
+ self.next_cursor = attributes[:'next_cursor']
135
+ else
136
+ self.next_cursor = nil
137
+ end
138
+
139
+ if attributes.key?(:'truncated')
140
+ self.truncated = attributes[:'truncated']
141
+ else
142
+ self.truncated = nil
143
+ end
144
+
145
+ if attributes.key?(:'next_page_arguments')
146
+ self.next_page_arguments = attributes[:'next_page_arguments']
147
+ else
148
+ self.next_page_arguments = nil
149
+ end
150
+
151
+ if attributes.key?(:'continuation')
152
+ self.continuation = attributes[:'continuation']
153
+ else
154
+ self.continuation = nil
155
+ end
103
156
  end
104
157
 
105
158
  # Show invalid properties with the reasons. Usually used together with valid?
@@ -123,6 +176,18 @@ module PlainRouter::OpenAPI
123
176
  invalid_properties.push('invalid value for "total", total cannot be nil.')
124
177
  end
125
178
 
179
+ if @last_page.nil?
180
+ invalid_properties.push('invalid value for "last_page", last_page cannot be nil.')
181
+ end
182
+
183
+ if @truncated.nil?
184
+ invalid_properties.push('invalid value for "truncated", truncated cannot be nil.')
185
+ end
186
+
187
+ if @continuation.nil?
188
+ invalid_properties.push('invalid value for "continuation", continuation cannot be nil.')
189
+ end
190
+
126
191
  invalid_properties
127
192
  end
128
193
 
@@ -134,6 +199,9 @@ module PlainRouter::OpenAPI
134
199
  return false if @current_page.nil?
135
200
  return false if @per_page.nil?
136
201
  return false if @total.nil?
202
+ return false if @last_page.nil?
203
+ return false if @truncated.nil?
204
+ return false if @continuation.nil?
137
205
  true
138
206
  end
139
207
 
@@ -177,6 +245,36 @@ module PlainRouter::OpenAPI
177
245
  @total = total
178
246
  end
179
247
 
248
+ # Custom attribute writer method with validation
249
+ # @param [Object] last_page Value to be assigned
250
+ def last_page=(last_page)
251
+ if last_page.nil?
252
+ fail ArgumentError, 'last_page cannot be nil'
253
+ end
254
+
255
+ @last_page = last_page
256
+ end
257
+
258
+ # Custom attribute writer method with validation
259
+ # @param [Object] truncated Value to be assigned
260
+ def truncated=(truncated)
261
+ if truncated.nil?
262
+ fail ArgumentError, 'truncated cannot be nil'
263
+ end
264
+
265
+ @truncated = truncated
266
+ end
267
+
268
+ # Custom attribute writer method with validation
269
+ # @param [Object] continuation Value to be assigned
270
+ def continuation=(continuation)
271
+ if continuation.nil?
272
+ fail ArgumentError, 'continuation cannot be nil'
273
+ end
274
+
275
+ @continuation = continuation
276
+ end
277
+
180
278
  # Checks equality by comparing each attribute.
181
279
  # @param [Object] Object to be compared
182
280
  def ==(o)
@@ -185,7 +283,12 @@ module PlainRouter::OpenAPI
185
283
  data == o.data &&
186
284
  current_page == o.current_page &&
187
285
  per_page == o.per_page &&
188
- total == o.total
286
+ total == o.total &&
287
+ last_page == o.last_page &&
288
+ next_cursor == o.next_cursor &&
289
+ truncated == o.truncated &&
290
+ next_page_arguments == o.next_page_arguments &&
291
+ continuation == o.continuation
189
292
  end
190
293
 
191
294
  # @see the `==` method
@@ -197,7 +300,7 @@ module PlainRouter::OpenAPI
197
300
  # Calculates hash code according to all attributes.
198
301
  # @return [Integer] Hash code
199
302
  def hash
200
- [data, current_page, per_page, total].hash
303
+ [data, current_page, per_page, total, last_page, next_cursor, truncated, next_page_arguments, continuation].hash
201
304
  end
202
305
 
203
306
  # Builds the object from hash
@@ -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
+ # Always present. Page and per_page for aligned offsets, cursor and per_page after a byte-limited page, or null when complete.
18
+ module LaunchPlansIndex200ResponsePlansNextPageArguments
19
+ class << self
20
+ # List of class defined in anyOf (OpenAPI v3)
21
+ def openapi_any_of
22
+ [
23
+ :'LaunchPlansIndex200ResponsePlansNextPageArgumentsAnyOf',
24
+ :'LaunchPlansIndex200ResponsePlansNextPageArgumentsAnyOf1'
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
@@ -0,0 +1,190 @@
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 LaunchPlansIndex200ResponsePlansNextPageArgumentsAnyOf < ApiModelBase
18
+ attr_accessor :page
19
+
20
+ attr_accessor :per_page
21
+
22
+ # Attribute mapping from ruby-style variable name to JSON key.
23
+ def self.attribute_map
24
+ {
25
+ :'page' => :'page',
26
+ :'per_page' => :'per_page'
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
+ :'page' => :'Integer',
44
+ :'per_page' => :'Integer'
45
+ }
46
+ end
47
+
48
+ # List of attributes with nullable: true
49
+ def self.openapi_nullable
50
+ Set.new([
51
+ ])
52
+ end
53
+
54
+ # Initializes the object
55
+ # @param [Hash] attributes Model attributes in the form of hash
56
+ def initialize(attributes = {})
57
+ if (!attributes.is_a?(Hash))
58
+ fail ArgumentError, "The input argument (attributes) must be a hash in `PlainRouter::OpenAPI::LaunchPlansIndex200ResponsePlansNextPageArgumentsAnyOf` initialize method"
59
+ end
60
+
61
+ # check to see if the attribute exists and convert string to symbol for hash key
62
+ acceptable_attribute_map = self.class.acceptable_attribute_map
63
+ attributes = attributes.each_with_object({}) { |(k, v), h|
64
+ if (!acceptable_attribute_map.key?(k.to_sym))
65
+ fail ArgumentError, "`#{k}` is not a valid attribute in `PlainRouter::OpenAPI::LaunchPlansIndex200ResponsePlansNextPageArgumentsAnyOf`. Please check the name to make sure it's valid. List of attributes: " + acceptable_attribute_map.keys.inspect
66
+ end
67
+ h[k.to_sym] = v
68
+ }
69
+
70
+ if attributes.key?(:'page')
71
+ self.page = attributes[:'page']
72
+ else
73
+ self.page = nil
74
+ end
75
+
76
+ if attributes.key?(:'per_page')
77
+ self.per_page = attributes[:'per_page']
78
+ else
79
+ self.per_page = 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 @page.nil?
89
+ invalid_properties.push('invalid value for "page", page cannot be nil.')
90
+ end
91
+
92
+ if @per_page.nil?
93
+ invalid_properties.push('invalid value for "per_page", per_page cannot be nil.')
94
+ end
95
+
96
+ invalid_properties
97
+ end
98
+
99
+ # Check to see if the all the properties in the model are valid
100
+ # @return true if the model is valid
101
+ def valid?
102
+ warn '[DEPRECATED] the `valid?` method is obsolete'
103
+ return false if @page.nil?
104
+ return false if @per_page.nil?
105
+ true
106
+ end
107
+
108
+ # Custom attribute writer method with validation
109
+ # @param [Object] page Value to be assigned
110
+ def page=(page)
111
+ if page.nil?
112
+ fail ArgumentError, 'page cannot be nil'
113
+ end
114
+
115
+ @page = page
116
+ end
117
+
118
+ # Custom attribute writer method with validation
119
+ # @param [Object] per_page Value to be assigned
120
+ def per_page=(per_page)
121
+ if per_page.nil?
122
+ fail ArgumentError, 'per_page cannot be nil'
123
+ end
124
+
125
+ @per_page = per_page
126
+ end
127
+
128
+ # Checks equality by comparing each attribute.
129
+ # @param [Object] Object to be compared
130
+ def ==(o)
131
+ return true if self.equal?(o)
132
+ self.class == o.class &&
133
+ page == o.page &&
134
+ per_page == o.per_page
135
+ end
136
+
137
+ # @see the `==` method
138
+ # @param [Object] Object to be compared
139
+ def eql?(o)
140
+ self == o
141
+ end
142
+
143
+ # Calculates hash code according to all attributes.
144
+ # @return [Integer] Hash code
145
+ def hash
146
+ [page, per_page].hash
147
+ end
148
+
149
+ # Builds the object from hash
150
+ # @param [Hash] attributes Model attributes in the form of hash
151
+ # @return [Object] Returns the model itself
152
+ def self.build_from_hash(attributes)
153
+ return nil unless attributes.is_a?(Hash)
154
+ attributes = attributes.transform_keys(&:to_sym)
155
+ transformed_hash = {}
156
+ openapi_types.each_pair do |key, type|
157
+ if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil?
158
+ transformed_hash["#{key}"] = nil
159
+ elsif type =~ /\AArray<(.*)>/i
160
+ # check to ensure the input is an array given that the attribute
161
+ # is documented as an array but the input is not
162
+ if attributes[attribute_map[key]].is_a?(Array)
163
+ transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) }
164
+ end
165
+ elsif !attributes[attribute_map[key]].nil?
166
+ transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]])
167
+ end
168
+ end
169
+ new(transformed_hash)
170
+ end
171
+
172
+ # Returns the object in the form of hash
173
+ # @return [Hash] Returns the object in the form of hash
174
+ def to_hash
175
+ hash = {}
176
+ self.class.attribute_map.each_pair do |attr, param|
177
+ value = self.send(attr)
178
+ if value.nil?
179
+ is_nullable = self.class.openapi_nullable.include?(attr)
180
+ next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
181
+ end
182
+
183
+ hash[param] = _to_hash(value)
184
+ end
185
+ hash
186
+ end
187
+
188
+ end
189
+
190
+ end
@@ -0,0 +1,190 @@
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 LaunchPlansIndex200ResponsePlansNextPageArgumentsAnyOf1 < ApiModelBase
18
+ attr_accessor :cursor
19
+
20
+ attr_accessor :per_page
21
+
22
+ # Attribute mapping from ruby-style variable name to JSON key.
23
+ def self.attribute_map
24
+ {
25
+ :'cursor' => :'cursor',
26
+ :'per_page' => :'per_page'
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
+ :'cursor' => :'Integer',
44
+ :'per_page' => :'Integer'
45
+ }
46
+ end
47
+
48
+ # List of attributes with nullable: true
49
+ def self.openapi_nullable
50
+ Set.new([
51
+ ])
52
+ end
53
+
54
+ # Initializes the object
55
+ # @param [Hash] attributes Model attributes in the form of hash
56
+ def initialize(attributes = {})
57
+ if (!attributes.is_a?(Hash))
58
+ fail ArgumentError, "The input argument (attributes) must be a hash in `PlainRouter::OpenAPI::LaunchPlansIndex200ResponsePlansNextPageArgumentsAnyOf1` initialize method"
59
+ end
60
+
61
+ # check to see if the attribute exists and convert string to symbol for hash key
62
+ acceptable_attribute_map = self.class.acceptable_attribute_map
63
+ attributes = attributes.each_with_object({}) { |(k, v), h|
64
+ if (!acceptable_attribute_map.key?(k.to_sym))
65
+ fail ArgumentError, "`#{k}` is not a valid attribute in `PlainRouter::OpenAPI::LaunchPlansIndex200ResponsePlansNextPageArgumentsAnyOf1`. Please check the name to make sure it's valid. List of attributes: " + acceptable_attribute_map.keys.inspect
66
+ end
67
+ h[k.to_sym] = v
68
+ }
69
+
70
+ if attributes.key?(:'cursor')
71
+ self.cursor = attributes[:'cursor']
72
+ else
73
+ self.cursor = nil
74
+ end
75
+
76
+ if attributes.key?(:'per_page')
77
+ self.per_page = attributes[:'per_page']
78
+ else
79
+ self.per_page = 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 @cursor.nil?
89
+ invalid_properties.push('invalid value for "cursor", cursor cannot be nil.')
90
+ end
91
+
92
+ if @per_page.nil?
93
+ invalid_properties.push('invalid value for "per_page", per_page cannot be nil.')
94
+ end
95
+
96
+ invalid_properties
97
+ end
98
+
99
+ # Check to see if the all the properties in the model are valid
100
+ # @return true if the model is valid
101
+ def valid?
102
+ warn '[DEPRECATED] the `valid?` method is obsolete'
103
+ return false if @cursor.nil?
104
+ return false if @per_page.nil?
105
+ true
106
+ end
107
+
108
+ # Custom attribute writer method with validation
109
+ # @param [Object] cursor Value to be assigned
110
+ def cursor=(cursor)
111
+ if cursor.nil?
112
+ fail ArgumentError, 'cursor cannot be nil'
113
+ end
114
+
115
+ @cursor = cursor
116
+ end
117
+
118
+ # Custom attribute writer method with validation
119
+ # @param [Object] per_page Value to be assigned
120
+ def per_page=(per_page)
121
+ if per_page.nil?
122
+ fail ArgumentError, 'per_page cannot be nil'
123
+ end
124
+
125
+ @per_page = per_page
126
+ end
127
+
128
+ # Checks equality by comparing each attribute.
129
+ # @param [Object] Object to be compared
130
+ def ==(o)
131
+ return true if self.equal?(o)
132
+ self.class == o.class &&
133
+ cursor == o.cursor &&
134
+ per_page == o.per_page
135
+ end
136
+
137
+ # @see the `==` method
138
+ # @param [Object] Object to be compared
139
+ def eql?(o)
140
+ self == o
141
+ end
142
+
143
+ # Calculates hash code according to all attributes.
144
+ # @return [Integer] Hash code
145
+ def hash
146
+ [cursor, per_page].hash
147
+ end
148
+
149
+ # Builds the object from hash
150
+ # @param [Hash] attributes Model attributes in the form of hash
151
+ # @return [Object] Returns the model itself
152
+ def self.build_from_hash(attributes)
153
+ return nil unless attributes.is_a?(Hash)
154
+ attributes = attributes.transform_keys(&:to_sym)
155
+ transformed_hash = {}
156
+ openapi_types.each_pair do |key, type|
157
+ if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil?
158
+ transformed_hash["#{key}"] = nil
159
+ elsif type =~ /\AArray<(.*)>/i
160
+ # check to ensure the input is an array given that the attribute
161
+ # is documented as an array but the input is not
162
+ if attributes[attribute_map[key]].is_a?(Array)
163
+ transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) }
164
+ end
165
+ elsif !attributes[attribute_map[key]].nil?
166
+ transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]])
167
+ end
168
+ end
169
+ new(transformed_hash)
170
+ end
171
+
172
+ # Returns the object in the form of hash
173
+ # @return [Hash] Returns the object in the form of hash
174
+ def to_hash
175
+ hash = {}
176
+ self.class.attribute_map.each_pair do |attr, param|
177
+ value = self.send(attr)
178
+ if value.nil?
179
+ is_nullable = self.class.openapi_nullable.include?(attr)
180
+ next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
181
+ end
182
+
183
+ hash[param] = _to_hash(value)
184
+ end
185
+ hash
186
+ end
187
+
188
+ end
189
+
190
+ end