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