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
@@ -0,0 +1,317 @@
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
+ # Only target_level, action, budget_change_percent, minimum_counted_arrivals, cost_comparison and cost_ratio are accepted.
18
+ class ActionsRulesStoreRequestDefinitionAnyOf < ApiModelBase
19
+ attr_accessor :target_level
20
+
21
+ attr_accessor :action
22
+
23
+ attr_accessor :minimum_counted_arrivals
24
+
25
+ attr_accessor :cost_comparison
26
+
27
+ attr_accessor :cost_ratio
28
+
29
+ class EnumAttributeValidator
30
+ attr_reader :datatype
31
+ attr_reader :allowable_values
32
+
33
+ def initialize(datatype, allowable_values)
34
+ @allowable_values = allowable_values.map do |value|
35
+ case datatype.to_s
36
+ when /Integer/i
37
+ value.to_i
38
+ when /Float/i
39
+ value.to_f
40
+ else
41
+ value
42
+ end
43
+ end
44
+ end
45
+
46
+ def valid?(value)
47
+ !value || allowable_values.include?(value)
48
+ end
49
+ end
50
+
51
+ # Attribute mapping from ruby-style variable name to JSON key.
52
+ def self.attribute_map
53
+ {
54
+ :'target_level' => :'target_level',
55
+ :'action' => :'action',
56
+ :'minimum_counted_arrivals' => :'minimum_counted_arrivals',
57
+ :'cost_comparison' => :'cost_comparison',
58
+ :'cost_ratio' => :'cost_ratio'
59
+ }
60
+ end
61
+
62
+ # Returns attribute mapping this model knows about
63
+ def self.acceptable_attribute_map
64
+ attribute_map
65
+ end
66
+
67
+ # Returns all the JSON keys this model knows about
68
+ def self.acceptable_attributes
69
+ acceptable_attribute_map.values
70
+ end
71
+
72
+ # Attribute type mapping.
73
+ def self.openapi_types
74
+ {
75
+ :'target_level' => :'String',
76
+ :'action' => :'String',
77
+ :'minimum_counted_arrivals' => :'Integer',
78
+ :'cost_comparison' => :'String',
79
+ :'cost_ratio' => :'ActionsRulesStoreRequestDefinitionAnyOfCostRatio'
80
+ }
81
+ end
82
+
83
+ # List of attributes with nullable: true
84
+ def self.openapi_nullable
85
+ Set.new([
86
+ ])
87
+ end
88
+
89
+ # Initializes the object
90
+ # @param [Hash] attributes Model attributes in the form of hash
91
+ def initialize(attributes = {})
92
+ ClosedInputValidator.validate_model!(self, attributes)
93
+ if (!attributes.is_a?(Hash))
94
+ fail ArgumentError, "The input argument (attributes) must be a hash in `PlainRouter::OpenAPI::ActionsRulesStoreRequestDefinitionAnyOf` initialize method"
95
+ end
96
+
97
+ # check to see if the attribute exists and convert string to symbol for hash key
98
+ acceptable_attribute_map = self.class.acceptable_attribute_map
99
+ attributes = attributes.each_with_object({}) { |(k, v), h|
100
+ if (!acceptable_attribute_map.key?(k.to_sym))
101
+ fail ArgumentError, "`#{k}` is not a valid attribute in `PlainRouter::OpenAPI::ActionsRulesStoreRequestDefinitionAnyOf`. Please check the name to make sure it's valid. List of attributes: " + acceptable_attribute_map.keys.inspect
102
+ end
103
+ h[k.to_sym] = v
104
+ }
105
+
106
+ if attributes.key?(:'target_level')
107
+ self.target_level = attributes[:'target_level']
108
+ else
109
+ self.target_level = nil
110
+ end
111
+
112
+ if attributes.key?(:'action')
113
+ self.action = attributes[:'action']
114
+ else
115
+ self.action = nil
116
+ end
117
+
118
+ if attributes.key?(:'minimum_counted_arrivals')
119
+ self.minimum_counted_arrivals = attributes[:'minimum_counted_arrivals']
120
+ else
121
+ self.minimum_counted_arrivals = nil
122
+ end
123
+
124
+ if attributes.key?(:'cost_comparison')
125
+ self.cost_comparison = attributes[:'cost_comparison']
126
+ else
127
+ self.cost_comparison = nil
128
+ end
129
+
130
+ if attributes.key?(:'cost_ratio')
131
+ self.cost_ratio = attributes[:'cost_ratio']
132
+ else
133
+ self.cost_ratio = nil
134
+ end
135
+ end
136
+
137
+ # Show invalid properties with the reasons. Usually used together with valid?
138
+ # @return Array for valid properties with the reasons
139
+ def list_invalid_properties
140
+ warn '[DEPRECATED] the `list_invalid_properties` method is obsolete'
141
+ invalid_properties = Array.new
142
+ if @target_level.nil?
143
+ invalid_properties.push('invalid value for "target_level", target_level cannot be nil.')
144
+ end
145
+
146
+ if @action.nil?
147
+ invalid_properties.push('invalid value for "action", action cannot be nil.')
148
+ end
149
+
150
+ if @minimum_counted_arrivals.nil?
151
+ invalid_properties.push('invalid value for "minimum_counted_arrivals", minimum_counted_arrivals cannot be nil.')
152
+ end
153
+
154
+ if @minimum_counted_arrivals > 9223372036854776000
155
+ invalid_properties.push('invalid value for "minimum_counted_arrivals", must be smaller than or equal to 9223372036854776000.')
156
+ end
157
+
158
+ if @minimum_counted_arrivals < 50
159
+ invalid_properties.push('invalid value for "minimum_counted_arrivals", must be greater than or equal to 50.')
160
+ end
161
+
162
+ if @cost_comparison.nil?
163
+ invalid_properties.push('invalid value for "cost_comparison", cost_comparison cannot be nil.')
164
+ end
165
+
166
+ if @cost_ratio.nil?
167
+ invalid_properties.push('invalid value for "cost_ratio", cost_ratio cannot be nil.')
168
+ end
169
+
170
+ invalid_properties
171
+ end
172
+
173
+ # Check to see if the all the properties in the model are valid
174
+ # @return true if the model is valid
175
+ def valid?
176
+ warn '[DEPRECATED] the `valid?` method is obsolete'
177
+ return false if @target_level.nil?
178
+ target_level_validator = EnumAttributeValidator.new('String', ["ad", "ad_set"])
179
+ return false unless target_level_validator.valid?(@target_level)
180
+ return false if @action.nil?
181
+ action_validator = EnumAttributeValidator.new('String', ["pause"])
182
+ return false unless action_validator.valid?(@action)
183
+ return false if @minimum_counted_arrivals.nil?
184
+ return false if @minimum_counted_arrivals > 9223372036854776000
185
+ return false if @minimum_counted_arrivals < 50
186
+ return false if @cost_comparison.nil?
187
+ cost_comparison_validator = EnumAttributeValidator.new('String', ["at_least", "at_most"])
188
+ return false unless cost_comparison_validator.valid?(@cost_comparison)
189
+ return false if @cost_ratio.nil?
190
+ true
191
+ end
192
+
193
+ # Custom attribute writer method checking allowed values (enum).
194
+ # @param [Object] target_level Object to be assigned
195
+ def target_level=(target_level)
196
+ validator = EnumAttributeValidator.new('String', ["ad", "ad_set"])
197
+ unless validator.valid?(target_level)
198
+ fail ArgumentError, "invalid value for \"target_level\", must be one of #{validator.allowable_values}."
199
+ end
200
+ @target_level = target_level
201
+ end
202
+
203
+ # Custom attribute writer method checking allowed values (enum).
204
+ # @param [Object] action Object to be assigned
205
+ def action=(action)
206
+ validator = EnumAttributeValidator.new('String', ["pause"])
207
+ unless validator.valid?(action)
208
+ fail ArgumentError, "invalid value for \"action\", must be one of #{validator.allowable_values}."
209
+ end
210
+ @action = action
211
+ end
212
+
213
+ # Custom attribute writer method with validation
214
+ # @param [Object] minimum_counted_arrivals Value to be assigned
215
+ def minimum_counted_arrivals=(minimum_counted_arrivals)
216
+ if minimum_counted_arrivals.nil?
217
+ fail ArgumentError, 'minimum_counted_arrivals cannot be nil'
218
+ end
219
+
220
+ if minimum_counted_arrivals > 9223372036854776000
221
+ fail ArgumentError, 'invalid value for "minimum_counted_arrivals", must be smaller than or equal to 9223372036854776000.'
222
+ end
223
+
224
+ if minimum_counted_arrivals < 50
225
+ fail ArgumentError, 'invalid value for "minimum_counted_arrivals", must be greater than or equal to 50.'
226
+ end
227
+
228
+ @minimum_counted_arrivals = minimum_counted_arrivals
229
+ end
230
+
231
+ # Custom attribute writer method checking allowed values (enum).
232
+ # @param [Object] cost_comparison Object to be assigned
233
+ def cost_comparison=(cost_comparison)
234
+ validator = EnumAttributeValidator.new('String', ["at_least", "at_most"])
235
+ unless validator.valid?(cost_comparison)
236
+ fail ArgumentError, "invalid value for \"cost_comparison\", must be one of #{validator.allowable_values}."
237
+ end
238
+ @cost_comparison = cost_comparison
239
+ end
240
+
241
+ # Custom attribute writer method with validation
242
+ # @param [Object] cost_ratio Value to be assigned
243
+ def cost_ratio=(cost_ratio)
244
+ if cost_ratio.nil?
245
+ fail ArgumentError, 'cost_ratio cannot be nil'
246
+ end
247
+
248
+ @cost_ratio = cost_ratio
249
+ end
250
+
251
+ # Checks equality by comparing each attribute.
252
+ # @param [Object] Object to be compared
253
+ def ==(o)
254
+ return true if self.equal?(o)
255
+ self.class == o.class &&
256
+ target_level == o.target_level &&
257
+ action == o.action &&
258
+ minimum_counted_arrivals == o.minimum_counted_arrivals &&
259
+ cost_comparison == o.cost_comparison &&
260
+ cost_ratio == o.cost_ratio
261
+ end
262
+
263
+ # @see the `==` method
264
+ # @param [Object] Object to be compared
265
+ def eql?(o)
266
+ self == o
267
+ end
268
+
269
+ # Calculates hash code according to all attributes.
270
+ # @return [Integer] Hash code
271
+ def hash
272
+ [target_level, action, minimum_counted_arrivals, cost_comparison, cost_ratio].hash
273
+ end
274
+
275
+ # Builds the object from hash
276
+ # @param [Hash] attributes Model attributes in the form of hash
277
+ # @return [Object] Returns the model itself
278
+ def self.build_from_hash(attributes)
279
+ ClosedInputValidator.validate_model!(self, attributes)
280
+ return nil unless attributes.is_a?(Hash)
281
+ attributes = attributes.transform_keys(&:to_sym)
282
+ transformed_hash = {}
283
+ openapi_types.each_pair do |key, type|
284
+ if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil?
285
+ transformed_hash["#{key}"] = nil
286
+ elsif type =~ /\AArray<(.*)>/i
287
+ # check to ensure the input is an array given that the attribute
288
+ # is documented as an array but the input is not
289
+ if attributes[attribute_map[key]].is_a?(Array)
290
+ transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) }
291
+ end
292
+ elsif !attributes[attribute_map[key]].nil?
293
+ transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]])
294
+ end
295
+ end
296
+ new(transformed_hash)
297
+ end
298
+
299
+ # Returns the object in the form of hash
300
+ # @return [Hash] Returns the object in the form of hash
301
+ def to_hash
302
+ hash = {}
303
+ self.class.attribute_map.each_pair do |attr, param|
304
+ value = self.send(attr)
305
+ if value.nil?
306
+ is_nullable = self.class.openapi_nullable.include?(attr)
307
+ next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
308
+ end
309
+
310
+ hash[param] = _to_hash(value)
311
+ end
312
+ hash
313
+ end
314
+
315
+ end
316
+
317
+ end
@@ -0,0 +1,361 @@
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
+ # Only target_level, action, budget_change_percent, minimum_counted_arrivals, cost_comparison and cost_ratio are accepted.
18
+ class ActionsRulesStoreRequestDefinitionAnyOf1 < ApiModelBase
19
+ attr_accessor :target_level
20
+
21
+ attr_accessor :action
22
+
23
+ attr_accessor :minimum_counted_arrivals
24
+
25
+ attr_accessor :cost_comparison
26
+
27
+ attr_accessor :cost_ratio
28
+
29
+ attr_accessor :budget_change_percent
30
+
31
+ class EnumAttributeValidator
32
+ attr_reader :datatype
33
+ attr_reader :allowable_values
34
+
35
+ def initialize(datatype, allowable_values)
36
+ @allowable_values = allowable_values.map do |value|
37
+ case datatype.to_s
38
+ when /Integer/i
39
+ value.to_i
40
+ when /Float/i
41
+ value.to_f
42
+ else
43
+ value
44
+ end
45
+ end
46
+ end
47
+
48
+ def valid?(value)
49
+ !value || allowable_values.include?(value)
50
+ end
51
+ end
52
+
53
+ # Attribute mapping from ruby-style variable name to JSON key.
54
+ def self.attribute_map
55
+ {
56
+ :'target_level' => :'target_level',
57
+ :'action' => :'action',
58
+ :'minimum_counted_arrivals' => :'minimum_counted_arrivals',
59
+ :'cost_comparison' => :'cost_comparison',
60
+ :'cost_ratio' => :'cost_ratio',
61
+ :'budget_change_percent' => :'budget_change_percent'
62
+ }
63
+ end
64
+
65
+ # Returns attribute mapping this model knows about
66
+ def self.acceptable_attribute_map
67
+ attribute_map
68
+ end
69
+
70
+ # Returns all the JSON keys this model knows about
71
+ def self.acceptable_attributes
72
+ acceptable_attribute_map.values
73
+ end
74
+
75
+ # Attribute type mapping.
76
+ def self.openapi_types
77
+ {
78
+ :'target_level' => :'String',
79
+ :'action' => :'String',
80
+ :'minimum_counted_arrivals' => :'Integer',
81
+ :'cost_comparison' => :'String',
82
+ :'cost_ratio' => :'ActionsRulesStoreRequestDefinitionAnyOfCostRatio',
83
+ :'budget_change_percent' => :'Integer'
84
+ }
85
+ end
86
+
87
+ # List of attributes with nullable: true
88
+ def self.openapi_nullable
89
+ Set.new([
90
+ ])
91
+ end
92
+
93
+ # Initializes the object
94
+ # @param [Hash] attributes Model attributes in the form of hash
95
+ def initialize(attributes = {})
96
+ ClosedInputValidator.validate_model!(self, attributes)
97
+ if (!attributes.is_a?(Hash))
98
+ fail ArgumentError, "The input argument (attributes) must be a hash in `PlainRouter::OpenAPI::ActionsRulesStoreRequestDefinitionAnyOf1` initialize method"
99
+ end
100
+
101
+ # check to see if the attribute exists and convert string to symbol for hash key
102
+ acceptable_attribute_map = self.class.acceptable_attribute_map
103
+ attributes = attributes.each_with_object({}) { |(k, v), h|
104
+ if (!acceptable_attribute_map.key?(k.to_sym))
105
+ fail ArgumentError, "`#{k}` is not a valid attribute in `PlainRouter::OpenAPI::ActionsRulesStoreRequestDefinitionAnyOf1`. Please check the name to make sure it's valid. List of attributes: " + acceptable_attribute_map.keys.inspect
106
+ end
107
+ h[k.to_sym] = v
108
+ }
109
+
110
+ if attributes.key?(:'target_level')
111
+ self.target_level = attributes[:'target_level']
112
+ else
113
+ self.target_level = nil
114
+ end
115
+
116
+ if attributes.key?(:'action')
117
+ self.action = attributes[:'action']
118
+ else
119
+ self.action = nil
120
+ end
121
+
122
+ if attributes.key?(:'minimum_counted_arrivals')
123
+ self.minimum_counted_arrivals = attributes[:'minimum_counted_arrivals']
124
+ else
125
+ self.minimum_counted_arrivals = nil
126
+ end
127
+
128
+ if attributes.key?(:'cost_comparison')
129
+ self.cost_comparison = attributes[:'cost_comparison']
130
+ else
131
+ self.cost_comparison = nil
132
+ end
133
+
134
+ if attributes.key?(:'cost_ratio')
135
+ self.cost_ratio = attributes[:'cost_ratio']
136
+ else
137
+ self.cost_ratio = nil
138
+ end
139
+
140
+ if attributes.key?(:'budget_change_percent')
141
+ self.budget_change_percent = attributes[:'budget_change_percent']
142
+ else
143
+ self.budget_change_percent = nil
144
+ end
145
+ end
146
+
147
+ # Show invalid properties with the reasons. Usually used together with valid?
148
+ # @return Array for valid properties with the reasons
149
+ def list_invalid_properties
150
+ warn '[DEPRECATED] the `list_invalid_properties` method is obsolete'
151
+ invalid_properties = Array.new
152
+ if @target_level.nil?
153
+ invalid_properties.push('invalid value for "target_level", target_level cannot be nil.')
154
+ end
155
+
156
+ if @action.nil?
157
+ invalid_properties.push('invalid value for "action", action cannot be nil.')
158
+ end
159
+
160
+ if @minimum_counted_arrivals.nil?
161
+ invalid_properties.push('invalid value for "minimum_counted_arrivals", minimum_counted_arrivals cannot be nil.')
162
+ end
163
+
164
+ if @minimum_counted_arrivals > 9223372036854776000
165
+ invalid_properties.push('invalid value for "minimum_counted_arrivals", must be smaller than or equal to 9223372036854776000.')
166
+ end
167
+
168
+ if @minimum_counted_arrivals < 100
169
+ invalid_properties.push('invalid value for "minimum_counted_arrivals", must be greater than or equal to 100.')
170
+ end
171
+
172
+ if @cost_comparison.nil?
173
+ invalid_properties.push('invalid value for "cost_comparison", cost_comparison cannot be nil.')
174
+ end
175
+
176
+ if @cost_ratio.nil?
177
+ invalid_properties.push('invalid value for "cost_ratio", cost_ratio cannot be nil.')
178
+ end
179
+
180
+ if @budget_change_percent.nil?
181
+ invalid_properties.push('invalid value for "budget_change_percent", budget_change_percent cannot be nil.')
182
+ end
183
+
184
+ if @budget_change_percent > 50
185
+ invalid_properties.push('invalid value for "budget_change_percent", must be smaller than or equal to 50.')
186
+ end
187
+
188
+ if @budget_change_percent < 1
189
+ invalid_properties.push('invalid value for "budget_change_percent", must be greater than or equal to 1.')
190
+ end
191
+
192
+ invalid_properties
193
+ end
194
+
195
+ # Check to see if the all the properties in the model are valid
196
+ # @return true if the model is valid
197
+ def valid?
198
+ warn '[DEPRECATED] the `valid?` method is obsolete'
199
+ return false if @target_level.nil?
200
+ target_level_validator = EnumAttributeValidator.new('String', ["ad_set", "campaign"])
201
+ return false unless target_level_validator.valid?(@target_level)
202
+ return false if @action.nil?
203
+ action_validator = EnumAttributeValidator.new('String', ["increase_budget"])
204
+ return false unless action_validator.valid?(@action)
205
+ return false if @minimum_counted_arrivals.nil?
206
+ return false if @minimum_counted_arrivals > 9223372036854776000
207
+ return false if @minimum_counted_arrivals < 100
208
+ return false if @cost_comparison.nil?
209
+ cost_comparison_validator = EnumAttributeValidator.new('String', ["at_least", "at_most"])
210
+ return false unless cost_comparison_validator.valid?(@cost_comparison)
211
+ return false if @cost_ratio.nil?
212
+ return false if @budget_change_percent.nil?
213
+ return false if @budget_change_percent > 50
214
+ return false if @budget_change_percent < 1
215
+ true
216
+ end
217
+
218
+ # Custom attribute writer method checking allowed values (enum).
219
+ # @param [Object] target_level Object to be assigned
220
+ def target_level=(target_level)
221
+ validator = EnumAttributeValidator.new('String', ["ad_set", "campaign"])
222
+ unless validator.valid?(target_level)
223
+ fail ArgumentError, "invalid value for \"target_level\", must be one of #{validator.allowable_values}."
224
+ end
225
+ @target_level = target_level
226
+ end
227
+
228
+ # Custom attribute writer method checking allowed values (enum).
229
+ # @param [Object] action Object to be assigned
230
+ def action=(action)
231
+ validator = EnumAttributeValidator.new('String', ["increase_budget"])
232
+ unless validator.valid?(action)
233
+ fail ArgumentError, "invalid value for \"action\", must be one of #{validator.allowable_values}."
234
+ end
235
+ @action = action
236
+ end
237
+
238
+ # Custom attribute writer method with validation
239
+ # @param [Object] minimum_counted_arrivals Value to be assigned
240
+ def minimum_counted_arrivals=(minimum_counted_arrivals)
241
+ if minimum_counted_arrivals.nil?
242
+ fail ArgumentError, 'minimum_counted_arrivals cannot be nil'
243
+ end
244
+
245
+ if minimum_counted_arrivals > 9223372036854776000
246
+ fail ArgumentError, 'invalid value for "minimum_counted_arrivals", must be smaller than or equal to 9223372036854776000.'
247
+ end
248
+
249
+ if minimum_counted_arrivals < 100
250
+ fail ArgumentError, 'invalid value for "minimum_counted_arrivals", must be greater than or equal to 100.'
251
+ end
252
+
253
+ @minimum_counted_arrivals = minimum_counted_arrivals
254
+ end
255
+
256
+ # Custom attribute writer method checking allowed values (enum).
257
+ # @param [Object] cost_comparison Object to be assigned
258
+ def cost_comparison=(cost_comparison)
259
+ validator = EnumAttributeValidator.new('String', ["at_least", "at_most"])
260
+ unless validator.valid?(cost_comparison)
261
+ fail ArgumentError, "invalid value for \"cost_comparison\", must be one of #{validator.allowable_values}."
262
+ end
263
+ @cost_comparison = cost_comparison
264
+ end
265
+
266
+ # Custom attribute writer method with validation
267
+ # @param [Object] cost_ratio Value to be assigned
268
+ def cost_ratio=(cost_ratio)
269
+ if cost_ratio.nil?
270
+ fail ArgumentError, 'cost_ratio cannot be nil'
271
+ end
272
+
273
+ @cost_ratio = cost_ratio
274
+ end
275
+
276
+ # Custom attribute writer method with validation
277
+ # @param [Object] budget_change_percent Value to be assigned
278
+ def budget_change_percent=(budget_change_percent)
279
+ if budget_change_percent.nil?
280
+ fail ArgumentError, 'budget_change_percent cannot be nil'
281
+ end
282
+
283
+ if budget_change_percent > 50
284
+ fail ArgumentError, 'invalid value for "budget_change_percent", must be smaller than or equal to 50.'
285
+ end
286
+
287
+ if budget_change_percent < 1
288
+ fail ArgumentError, 'invalid value for "budget_change_percent", must be greater than or equal to 1.'
289
+ end
290
+
291
+ @budget_change_percent = budget_change_percent
292
+ end
293
+
294
+ # Checks equality by comparing each attribute.
295
+ # @param [Object] Object to be compared
296
+ def ==(o)
297
+ return true if self.equal?(o)
298
+ self.class == o.class &&
299
+ target_level == o.target_level &&
300
+ action == o.action &&
301
+ minimum_counted_arrivals == o.minimum_counted_arrivals &&
302
+ cost_comparison == o.cost_comparison &&
303
+ cost_ratio == o.cost_ratio &&
304
+ budget_change_percent == o.budget_change_percent
305
+ end
306
+
307
+ # @see the `==` method
308
+ # @param [Object] Object to be compared
309
+ def eql?(o)
310
+ self == o
311
+ end
312
+
313
+ # Calculates hash code according to all attributes.
314
+ # @return [Integer] Hash code
315
+ def hash
316
+ [target_level, action, minimum_counted_arrivals, cost_comparison, cost_ratio, budget_change_percent].hash
317
+ end
318
+
319
+ # Builds the object from hash
320
+ # @param [Hash] attributes Model attributes in the form of hash
321
+ # @return [Object] Returns the model itself
322
+ def self.build_from_hash(attributes)
323
+ ClosedInputValidator.validate_model!(self, attributes)
324
+ return nil unless attributes.is_a?(Hash)
325
+ attributes = attributes.transform_keys(&:to_sym)
326
+ transformed_hash = {}
327
+ openapi_types.each_pair do |key, type|
328
+ if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil?
329
+ transformed_hash["#{key}"] = nil
330
+ elsif type =~ /\AArray<(.*)>/i
331
+ # check to ensure the input is an array given that the attribute
332
+ # is documented as an array but the input is not
333
+ if attributes[attribute_map[key]].is_a?(Array)
334
+ transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) }
335
+ end
336
+ elsif !attributes[attribute_map[key]].nil?
337
+ transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]])
338
+ end
339
+ end
340
+ new(transformed_hash)
341
+ end
342
+
343
+ # Returns the object in the form of hash
344
+ # @return [Hash] Returns the object in the form of hash
345
+ def to_hash
346
+ hash = {}
347
+ self.class.attribute_map.each_pair do |attr, param|
348
+ value = self.send(attr)
349
+ if value.nil?
350
+ is_nullable = self.class.openapi_nullable.include?(attr)
351
+ next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
352
+ end
353
+
354
+ hash[param] = _to_hash(value)
355
+ end
356
+ hash
357
+ end
358
+
359
+ end
360
+
361
+ end