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,238 @@
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
+ # Write-once outcome. Management comparisons use PlainRouter counted arrivals and Inventory spend. Resume compares the target after the change with the rest of the same account over those same days. Pause is not judged. Missing data never yields a verdict. Other action types retain their existing payloads.
18
+ class ActionCurrentDispositionOutcomePayload < ApiModelBase
19
+ attr_accessor :status
20
+
21
+ attr_accessor :observed_at
22
+
23
+ attr_accessor :reason_code
24
+
25
+ attr_accessor :reason
26
+
27
+ attr_accessor :baseline
28
+
29
+ attr_accessor :metrics
30
+
31
+ attr_accessor :inverse
32
+
33
+ class EnumAttributeValidator
34
+ attr_reader :datatype
35
+ attr_reader :allowable_values
36
+
37
+ def initialize(datatype, allowable_values)
38
+ @allowable_values = allowable_values.map do |value|
39
+ case datatype.to_s
40
+ when /Integer/i
41
+ value.to_i
42
+ when /Float/i
43
+ value.to_f
44
+ else
45
+ value
46
+ end
47
+ end
48
+ end
49
+
50
+ def valid?(value)
51
+ !value || allowable_values.include?(value)
52
+ end
53
+ end
54
+
55
+ # Attribute mapping from ruby-style variable name to JSON key.
56
+ def self.attribute_map
57
+ {
58
+ :'status' => :'status',
59
+ :'observed_at' => :'observed_at',
60
+ :'reason_code' => :'reason_code',
61
+ :'reason' => :'reason',
62
+ :'baseline' => :'baseline',
63
+ :'metrics' => :'metrics',
64
+ :'inverse' => :'inverse'
65
+ }
66
+ end
67
+
68
+ # Returns attribute mapping this model knows about
69
+ def self.acceptable_attribute_map
70
+ attribute_map
71
+ end
72
+
73
+ # Returns all the JSON keys this model knows about
74
+ def self.acceptable_attributes
75
+ acceptable_attribute_map.values
76
+ end
77
+
78
+ # Attribute type mapping.
79
+ def self.openapi_types
80
+ {
81
+ :'status' => :'String',
82
+ :'observed_at' => :'Time',
83
+ :'reason_code' => :'String',
84
+ :'reason' => :'String',
85
+ :'baseline' => :'ActionCurrentDispositionOutcomePayloadBaseline',
86
+ :'metrics' => :'ActionCurrentDispositionOutcomePayloadMetrics',
87
+ :'inverse' => :'ActionCurrentDispositionOutcomePayloadInverse'
88
+ }
89
+ end
90
+
91
+ # List of attributes with nullable: true
92
+ def self.openapi_nullable
93
+ Set.new([
94
+ :'reason_code',
95
+ :'reason',
96
+ ])
97
+ end
98
+
99
+ # Initializes the object
100
+ # @param [Hash] attributes Model attributes in the form of hash
101
+ def initialize(attributes = {})
102
+ if (!attributes.is_a?(Hash))
103
+ fail ArgumentError, "The input argument (attributes) must be a hash in `PlainRouter::OpenAPI::ActionCurrentDispositionOutcomePayload` initialize method"
104
+ end
105
+
106
+ # check to see if the attribute exists and convert string to symbol for hash key
107
+ acceptable_attribute_map = self.class.acceptable_attribute_map
108
+ attributes = attributes.each_with_object({}) { |(k, v), h|
109
+ if (!acceptable_attribute_map.key?(k.to_sym))
110
+ fail ArgumentError, "`#{k}` is not a valid attribute in `PlainRouter::OpenAPI::ActionCurrentDispositionOutcomePayload`. Please check the name to make sure it's valid. List of attributes: " + acceptable_attribute_map.keys.inspect
111
+ end
112
+ h[k.to_sym] = v
113
+ }
114
+
115
+ if attributes.key?(:'status')
116
+ self.status = attributes[:'status']
117
+ end
118
+
119
+ if attributes.key?(:'observed_at')
120
+ self.observed_at = attributes[:'observed_at']
121
+ end
122
+
123
+ if attributes.key?(:'reason_code')
124
+ self.reason_code = attributes[:'reason_code']
125
+ end
126
+
127
+ if attributes.key?(:'reason')
128
+ self.reason = attributes[:'reason']
129
+ end
130
+
131
+ if attributes.key?(:'baseline')
132
+ self.baseline = attributes[:'baseline']
133
+ end
134
+
135
+ if attributes.key?(:'metrics')
136
+ self.metrics = attributes[:'metrics']
137
+ end
138
+
139
+ if attributes.key?(:'inverse')
140
+ self.inverse = attributes[:'inverse']
141
+ end
142
+ end
143
+
144
+ # Show invalid properties with the reasons. Usually used together with valid?
145
+ # @return Array for valid properties with the reasons
146
+ def list_invalid_properties
147
+ warn '[DEPRECATED] the `list_invalid_properties` method is obsolete'
148
+ invalid_properties = Array.new
149
+ invalid_properties
150
+ end
151
+
152
+ # Check to see if the all the properties in the model are valid
153
+ # @return true if the model is valid
154
+ def valid?
155
+ warn '[DEPRECATED] the `valid?` method is obsolete'
156
+ status_validator = EnumAttributeValidator.new('String', ["measurable", "not_measurable", "unavailable"])
157
+ return false unless status_validator.valid?(@status)
158
+ true
159
+ end
160
+
161
+ # Custom attribute writer method checking allowed values (enum).
162
+ # @param [Object] status Object to be assigned
163
+ def status=(status)
164
+ validator = EnumAttributeValidator.new('String', ["measurable", "not_measurable", "unavailable"])
165
+ unless validator.valid?(status)
166
+ fail ArgumentError, "invalid value for \"status\", must be one of #{validator.allowable_values}."
167
+ end
168
+ @status = status
169
+ end
170
+
171
+ # Checks equality by comparing each attribute.
172
+ # @param [Object] Object to be compared
173
+ def ==(o)
174
+ return true if self.equal?(o)
175
+ self.class == o.class &&
176
+ status == o.status &&
177
+ observed_at == o.observed_at &&
178
+ reason_code == o.reason_code &&
179
+ reason == o.reason &&
180
+ baseline == o.baseline &&
181
+ metrics == o.metrics &&
182
+ inverse == o.inverse
183
+ end
184
+
185
+ # @see the `==` method
186
+ # @param [Object] Object to be compared
187
+ def eql?(o)
188
+ self == o
189
+ end
190
+
191
+ # Calculates hash code according to all attributes.
192
+ # @return [Integer] Hash code
193
+ def hash
194
+ [status, observed_at, reason_code, reason, baseline, metrics, inverse].hash
195
+ end
196
+
197
+ # Builds the object from hash
198
+ # @param [Hash] attributes Model attributes in the form of hash
199
+ # @return [Object] Returns the model itself
200
+ def self.build_from_hash(attributes)
201
+ return nil unless attributes.is_a?(Hash)
202
+ attributes = attributes.transform_keys(&:to_sym)
203
+ transformed_hash = {}
204
+ openapi_types.each_pair do |key, type|
205
+ if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil?
206
+ transformed_hash["#{key}"] = nil
207
+ elsif type =~ /\AArray<(.*)>/i
208
+ # check to ensure the input is an array given that the attribute
209
+ # is documented as an array but the input is not
210
+ if attributes[attribute_map[key]].is_a?(Array)
211
+ transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) }
212
+ end
213
+ elsif !attributes[attribute_map[key]].nil?
214
+ transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]])
215
+ end
216
+ end
217
+ new(transformed_hash)
218
+ end
219
+
220
+ # Returns the object in the form of hash
221
+ # @return [Hash] Returns the object in the form of hash
222
+ def to_hash
223
+ hash = {}
224
+ self.class.attribute_map.each_pair do |attr, param|
225
+ value = self.send(attr)
226
+ if value.nil?
227
+ is_nullable = self.class.openapi_nullable.include?(attr)
228
+ next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
229
+ end
230
+
231
+ hash[param] = _to_hash(value)
232
+ end
233
+ hash
234
+ end
235
+
236
+ end
237
+
238
+ end
@@ -0,0 +1,103 @@
1
+ =begin
2
+ #Plainrouter Conversion API
3
+
4
+ #Plainrouter public Signals Conversion API.
5
+
6
+ The version of the OpenAPI document: 0.5.0
7
+
8
+ Generated by: https://openapi-generator.tech
9
+ Generator version: 7.25.0
10
+
11
+ =end
12
+
13
+ require 'date'
14
+ require 'time'
15
+
16
+ module PlainRouter::OpenAPI
17
+ module ActionCurrentDispositionOutcomePayloadBaseline
18
+ class << self
19
+ # List of class defined in anyOf (OpenAPI v3)
20
+ def openapi_any_of
21
+ [
22
+ :'ActionCurrentDispositionOutcomePayloadBaselineAnyOf',
23
+ :'Array<String>'
24
+ ]
25
+ end
26
+
27
+ # Builds the object
28
+ # @param [Mixed] Data to be matched against the list of anyOf items
29
+ # @return [Object] Returns the model or the data itself
30
+ def build(data)
31
+ # Go through the list of anyOf items and attempt to identify the appropriate one.
32
+ # Note:
33
+ # - No advanced validation of types in some cases (e.g. "x: { type: string }" will happily match { x: 123 })
34
+ # due to the way the deserialization is made in the base_object template (it just casts without verifying).
35
+ # - TODO: scalar values are de facto behaving as if they were nullable.
36
+ # - TODO: logging when debugging is set.
37
+ openapi_any_of.each do |klass|
38
+ begin
39
+ next if klass == :AnyType # "nullable: true"
40
+ return find_and_cast_into_type(klass, data)
41
+ rescue # rescue all errors so we keep iterating even if the current item lookup raises
42
+ end
43
+ end
44
+
45
+ openapi_any_of.include?(:AnyType) ? data : nil
46
+ end
47
+
48
+ private
49
+
50
+ SchemaMismatchError = Class.new(StandardError)
51
+
52
+ # Note: 'File' is missing here because in the regular case we get the data _after_ a call to JSON.parse.
53
+ def find_and_cast_into_type(klass, data)
54
+ return if data.nil?
55
+
56
+ case klass.to_s
57
+ when 'Boolean'
58
+ return data if data.instance_of?(TrueClass) || data.instance_of?(FalseClass)
59
+ when 'Float'
60
+ return data if data.instance_of?(Float)
61
+ when 'Integer'
62
+ return data if data.instance_of?(Integer)
63
+ when 'Time'
64
+ return Time.parse(data)
65
+ when 'Date'
66
+ return Date.iso8601(data)
67
+ when 'String'
68
+ return data if data.instance_of?(String)
69
+ when 'Object' # "type: object"
70
+ return data if data.instance_of?(Hash)
71
+ when /\AArray<(?<sub_type>.+)>\z/ # "type: array"
72
+ if data.instance_of?(Array)
73
+ sub_type = Regexp.last_match[:sub_type]
74
+ return data.map { |item| find_and_cast_into_type(sub_type, item) }
75
+ end
76
+ when /\AHash<String, (?<sub_type>.+)>\z/ # "type: object" with "additionalProperties: { ... }"
77
+ if data.instance_of?(Hash) && data.keys.all? { |k| k.instance_of?(Symbol) || k.instance_of?(String) }
78
+ sub_type = Regexp.last_match[:sub_type]
79
+ return data.each_with_object({}) { |(k, v), hsh| hsh[k] = find_and_cast_into_type(sub_type, v) }
80
+ end
81
+ else # model
82
+ const = PlainRouter::OpenAPI.const_get(klass)
83
+ if const
84
+ if const.respond_to?(:openapi_any_of) # nested anyOf model
85
+ model = const.build(data)
86
+ return model if model
87
+ else
88
+ # raise if data contains keys that are not known to the model
89
+ raise if const.respond_to?(:acceptable_attributes) && !(data.keys - const.acceptable_attributes).empty?
90
+ model = const.build_from_hash(data)
91
+ return model if model
92
+ end
93
+ end
94
+ end
95
+
96
+ raise # if no match by now, raise
97
+ rescue
98
+ raise SchemaMismatchError, "#{data} doesn't match the #{klass} type"
99
+ end
100
+ end
101
+ end
102
+
103
+ end
@@ -0,0 +1,245 @@
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 ActionCurrentDispositionOutcomePayloadBaselineAnyOf < ApiModelBase
18
+ attr_accessor :scope
19
+
20
+ # Three whole days in the ad account timezone; excludes the change day.
21
+ attr_accessor :days
22
+
23
+ attr_accessor :currency
24
+
25
+ attr_accessor :timezone
26
+
27
+ # Decimal spend in ISO currency minor units; null when daily mirror data is missing.
28
+ attr_accessor :spend_minor
29
+
30
+ # Arrivals counted by PlainRouter through Signals, never provider conversions.
31
+ attr_accessor :counted_arrivals
32
+
33
+ # Spend divided by counted arrivals, in ISO currency minor units, displayed to six decimal places.
34
+ attr_accessor :cost_per_counted_arrival_minor
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
+ :'scope' => :'scope',
62
+ :'days' => :'days',
63
+ :'currency' => :'currency',
64
+ :'timezone' => :'timezone',
65
+ :'spend_minor' => :'spend_minor',
66
+ :'counted_arrivals' => :'counted_arrivals',
67
+ :'cost_per_counted_arrival_minor' => :'cost_per_counted_arrival_minor'
68
+ }
69
+ end
70
+
71
+ # Returns attribute mapping this model knows about
72
+ def self.acceptable_attribute_map
73
+ attribute_map
74
+ end
75
+
76
+ # Returns all the JSON keys this model knows about
77
+ def self.acceptable_attributes
78
+ acceptable_attribute_map.values
79
+ end
80
+
81
+ # Attribute type mapping.
82
+ def self.openapi_types
83
+ {
84
+ :'scope' => :'String',
85
+ :'days' => :'Array<Date>',
86
+ :'currency' => :'String',
87
+ :'timezone' => :'String',
88
+ :'spend_minor' => :'String',
89
+ :'counted_arrivals' => :'Integer',
90
+ :'cost_per_counted_arrival_minor' => :'String'
91
+ }
92
+ end
93
+
94
+ # List of attributes with nullable: true
95
+ def self.openapi_nullable
96
+ Set.new([
97
+ :'currency',
98
+ :'spend_minor',
99
+ :'counted_arrivals',
100
+ :'cost_per_counted_arrival_minor'
101
+ ])
102
+ end
103
+
104
+ # Initializes the object
105
+ # @param [Hash] attributes Model attributes in the form of hash
106
+ def initialize(attributes = {})
107
+ if (!attributes.is_a?(Hash))
108
+ fail ArgumentError, "The input argument (attributes) must be a hash in `PlainRouter::OpenAPI::ActionCurrentDispositionOutcomePayloadBaselineAnyOf` initialize method"
109
+ end
110
+
111
+ # check to see if the attribute exists and convert string to symbol for hash key
112
+ acceptable_attribute_map = self.class.acceptable_attribute_map
113
+ attributes = attributes.each_with_object({}) { |(k, v), h|
114
+ if (!acceptable_attribute_map.key?(k.to_sym))
115
+ fail ArgumentError, "`#{k}` is not a valid attribute in `PlainRouter::OpenAPI::ActionCurrentDispositionOutcomePayloadBaselineAnyOf`. Please check the name to make sure it's valid. List of attributes: " + acceptable_attribute_map.keys.inspect
116
+ end
117
+ h[k.to_sym] = v
118
+ }
119
+
120
+ if attributes.key?(:'scope')
121
+ self.scope = attributes[:'scope']
122
+ end
123
+
124
+ if attributes.key?(:'days')
125
+ if (value = attributes[:'days']).is_a?(Array)
126
+ self.days = value
127
+ end
128
+ end
129
+
130
+ if attributes.key?(:'currency')
131
+ self.currency = attributes[:'currency']
132
+ end
133
+
134
+ if attributes.key?(:'timezone')
135
+ self.timezone = attributes[:'timezone']
136
+ end
137
+
138
+ if attributes.key?(:'spend_minor')
139
+ self.spend_minor = attributes[:'spend_minor']
140
+ end
141
+
142
+ if attributes.key?(:'counted_arrivals')
143
+ self.counted_arrivals = attributes[:'counted_arrivals']
144
+ end
145
+
146
+ if attributes.key?(:'cost_per_counted_arrival_minor')
147
+ self.cost_per_counted_arrival_minor = attributes[:'cost_per_counted_arrival_minor']
148
+ end
149
+ end
150
+
151
+ # Show invalid properties with the reasons. Usually used together with valid?
152
+ # @return Array for valid properties with the reasons
153
+ def list_invalid_properties
154
+ warn '[DEPRECATED] the `list_invalid_properties` method is obsolete'
155
+ invalid_properties = Array.new
156
+ invalid_properties
157
+ end
158
+
159
+ # Check to see if the all the properties in the model are valid
160
+ # @return true if the model is valid
161
+ def valid?
162
+ warn '[DEPRECATED] the `valid?` method is obsolete'
163
+ scope_validator = EnumAttributeValidator.new('String', ["target", "rest_of_account"])
164
+ return false unless scope_validator.valid?(@scope)
165
+ true
166
+ end
167
+
168
+ # Custom attribute writer method checking allowed values (enum).
169
+ # @param [Object] scope Object to be assigned
170
+ def scope=(scope)
171
+ validator = EnumAttributeValidator.new('String', ["target", "rest_of_account"])
172
+ unless validator.valid?(scope)
173
+ fail ArgumentError, "invalid value for \"scope\", must be one of #{validator.allowable_values}."
174
+ end
175
+ @scope = scope
176
+ end
177
+
178
+ # Checks equality by comparing each attribute.
179
+ # @param [Object] Object to be compared
180
+ def ==(o)
181
+ return true if self.equal?(o)
182
+ self.class == o.class &&
183
+ scope == o.scope &&
184
+ days == o.days &&
185
+ currency == o.currency &&
186
+ timezone == o.timezone &&
187
+ spend_minor == o.spend_minor &&
188
+ counted_arrivals == o.counted_arrivals &&
189
+ cost_per_counted_arrival_minor == o.cost_per_counted_arrival_minor
190
+ end
191
+
192
+ # @see the `==` method
193
+ # @param [Object] Object to be compared
194
+ def eql?(o)
195
+ self == o
196
+ end
197
+
198
+ # Calculates hash code according to all attributes.
199
+ # @return [Integer] Hash code
200
+ def hash
201
+ [scope, days, currency, timezone, spend_minor, counted_arrivals, cost_per_counted_arrival_minor].hash
202
+ end
203
+
204
+ # Builds the object from hash
205
+ # @param [Hash] attributes Model attributes in the form of hash
206
+ # @return [Object] Returns the model itself
207
+ def self.build_from_hash(attributes)
208
+ return nil unless attributes.is_a?(Hash)
209
+ attributes = attributes.transform_keys(&:to_sym)
210
+ transformed_hash = {}
211
+ openapi_types.each_pair do |key, type|
212
+ if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil?
213
+ transformed_hash["#{key}"] = nil
214
+ elsif type =~ /\AArray<(.*)>/i
215
+ # check to ensure the input is an array given that the attribute
216
+ # is documented as an array but the input is not
217
+ if attributes[attribute_map[key]].is_a?(Array)
218
+ transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) }
219
+ end
220
+ elsif !attributes[attribute_map[key]].nil?
221
+ transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]])
222
+ end
223
+ end
224
+ new(transformed_hash)
225
+ end
226
+
227
+ # Returns the object in the form of hash
228
+ # @return [Hash] Returns the object in the form of hash
229
+ def to_hash
230
+ hash = {}
231
+ self.class.attribute_map.each_pair do |attr, param|
232
+ value = self.send(attr)
233
+ if value.nil?
234
+ is_nullable = self.class.openapi_nullable.include?(attr)
235
+ next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
236
+ end
237
+
238
+ hash[param] = _to_hash(value)
239
+ end
240
+ hash
241
+ end
242
+
243
+ end
244
+
245
+ end