plainrouter-sdk 0.1.0 → 0.2.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 (127) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +2 -2
  3. data/lib/plainrouter/client.rb +73 -1
  4. data/lib/plainrouter/openapi/api/action_dry_run_api_api.rb +96 -0
  5. data/lib/plainrouter/openapi/api/action_proposal_api_api.rb +96 -0
  6. data/lib/plainrouter/openapi/api/action_read_api_api.rb +404 -0
  7. data/lib/plainrouter/openapi/api/event_api.rb +15 -15
  8. data/lib/plainrouter/openapi/api/operations_api.rb +24 -28
  9. data/lib/plainrouter/openapi/api/sandbox_api.rb +74 -17
  10. data/lib/plainrouter/openapi/api_client.rb +2 -2
  11. data/lib/plainrouter/openapi/api_error.rb +2 -2
  12. data/lib/plainrouter/openapi/api_model_base.rb +2 -2
  13. data/lib/plainrouter/openapi/configuration.rb +10 -3
  14. data/lib/plainrouter/openapi/models/action_batch_read.rb +164 -0
  15. data/lib/plainrouter/openapi/models/action_batch_read_data.rb +450 -0
  16. data/lib/plainrouter/openapi/models/action_current_disposition.rb +294 -0
  17. data/lib/plainrouter/openapi/models/action_decision_receipt_read.rb +244 -0
  18. data/lib/plainrouter/openapi/models/action_decision_receipt_read_chain_entry.rb +190 -0
  19. data/lib/plainrouter/openapi/models/action_detail_read.rb +164 -0
  20. data/lib/plainrouter/openapi/models/action_dry_run_read.rb +164 -0
  21. data/lib/plainrouter/openapi/models/action_dry_run_read_dry_run.rb +166 -0
  22. data/lib/plainrouter/openapi/models/action_dry_run_read_dry_run_actions_inner.rb +103 -0
  23. data/lib/plainrouter/openapi/models/action_dry_run_read_dry_run_actions_inner_any_of.rb +376 -0
  24. data/lib/plainrouter/openapi/models/action_dry_run_read_dry_run_actions_inner_any_of1.rb +268 -0
  25. data/lib/plainrouter/openapi/models/action_dry_run_read_dry_run_actions_inner_any_of_diff.rb +162 -0
  26. data/lib/plainrouter/openapi/models/action_dry_run_read_dry_run_actions_inner_any_of_target_entity.rb +199 -0
  27. data/lib/plainrouter/openapi/models/action_list_read.rb +192 -0
  28. data/lib/plainrouter/openapi/models/action_list_read_meta.rb +242 -0
  29. data/lib/plainrouter/openapi/models/action_policy_read.rb +164 -0
  30. data/lib/plainrouter/openapi/models/action_policy_read_data.rb +380 -0
  31. data/lib/plainrouter/openapi/models/action_proposal_input.rb +378 -0
  32. data/lib/plainrouter/openapi/models/action_proposal_input_actions_inner.rb +115 -0
  33. data/lib/plainrouter/openapi/models/action_proposal_input_actions_inner_any_of.rb +303 -0
  34. data/lib/plainrouter/openapi/models/action_proposal_input_actions_inner_any_of1.rb +303 -0
  35. data/lib/plainrouter/openapi/models/action_proposal_input_actions_inner_any_of10.rb +303 -0
  36. data/lib/plainrouter/openapi/models/action_proposal_input_actions_inner_any_of10_params.rb +356 -0
  37. data/lib/plainrouter/openapi/models/action_proposal_input_actions_inner_any_of11.rb +303 -0
  38. data/lib/plainrouter/openapi/models/action_proposal_input_actions_inner_any_of11_params.rb +173 -0
  39. data/lib/plainrouter/openapi/models/action_proposal_input_actions_inner_any_of12.rb +303 -0
  40. data/lib/plainrouter/openapi/models/action_proposal_input_actions_inner_any_of12_params.rb +188 -0
  41. data/lib/plainrouter/openapi/models/action_proposal_input_actions_inner_any_of13.rb +303 -0
  42. data/lib/plainrouter/openapi/models/action_proposal_input_actions_inner_any_of13_params.rb +259 -0
  43. data/lib/plainrouter/openapi/models/action_proposal_input_actions_inner_any_of2.rb +303 -0
  44. data/lib/plainrouter/openapi/models/action_proposal_input_actions_inner_any_of3.rb +303 -0
  45. data/lib/plainrouter/openapi/models/action_proposal_input_actions_inner_any_of4.rb +303 -0
  46. data/lib/plainrouter/openapi/models/action_proposal_input_actions_inner_any_of4_target_entity.rb +253 -0
  47. data/lib/plainrouter/openapi/models/action_proposal_input_actions_inner_any_of5.rb +303 -0
  48. data/lib/plainrouter/openapi/models/action_proposal_input_actions_inner_any_of6.rb +303 -0
  49. data/lib/plainrouter/openapi/models/action_proposal_input_actions_inner_any_of7.rb +303 -0
  50. data/lib/plainrouter/openapi/models/action_proposal_input_actions_inner_any_of8.rb +303 -0
  51. data/lib/plainrouter/openapi/models/action_proposal_input_actions_inner_any_of9.rb +303 -0
  52. data/lib/plainrouter/openapi/models/action_proposal_input_actions_inner_any_of_params.rb +173 -0
  53. data/lib/plainrouter/openapi/models/action_proposal_input_actions_inner_any_of_target_entity.rb +264 -0
  54. data/lib/plainrouter/openapi/models/action_proposal_input_evidence_inner.rb +262 -0
  55. data/lib/plainrouter/openapi/models/action_proposal_read.rb +164 -0
  56. data/lib/plainrouter/openapi/models/action_proposal_read_proposal.rb +452 -0
  57. data/lib/plainrouter/openapi/models/action_proposal_read_proposal_actions_inner.rb +386 -0
  58. data/lib/plainrouter/openapi/models/action_proposal_read_proposal_actions_inner_params.rb +103 -0
  59. data/lib/plainrouter/openapi/models/action_proposal_read_proposal_proposed_by.rb +202 -0
  60. data/lib/plainrouter/openapi/models/action_read_item.rb +516 -0
  61. data/lib/plainrouter/openapi/models/create_event200_response.rb +2 -2
  62. data/lib/plainrouter/openapi/models/create_event202_response.rb +218 -0
  63. data/lib/plainrouter/openapi/models/create_event202_response_warnings_inner.rb +240 -0
  64. data/lib/plainrouter/openapi/models/create_event_request.rb +2 -2
  65. data/lib/plainrouter/openapi/models/create_event_request_any_of.rb +2 -2
  66. data/lib/plainrouter/openapi/models/create_event_request_any_of1.rb +2 -2
  67. data/lib/plainrouter/openapi/models/create_event_request_any_of_event_time.rb +2 -2
  68. data/lib/plainrouter/openapi/models/create_event_request_any_of_value_data.rb +2 -2
  69. data/lib/plainrouter/openapi/models/delete_user_data200_response.rb +2 -2
  70. data/lib/plainrouter/openapi/models/delete_user_data_request.rb +35 -36
  71. data/lib/plainrouter/openapi/models/delivery_status.rb +2 -2
  72. data/lib/plainrouter/openapi/models/destination.rb +30 -3
  73. data/lib/plainrouter/openapi/models/destination_credential_source.rb +3 -4
  74. data/lib/plainrouter/openapi/models/destination_status.rb +2 -2
  75. data/lib/plainrouter/openapi/models/destination_type.rb +2 -2
  76. data/lib/plainrouter/openapi/models/emq_snapshot.rb +30 -3
  77. data/lib/plainrouter/openapi/models/error_message.rb +2 -2
  78. data/lib/plainrouter/openapi/models/event.rb +89 -45
  79. data/lib/plainrouter/openapi/models/get_emq_report200_response.rb +2 -2
  80. data/lib/plainrouter/openapi/models/get_emq_report200_response_snapshots_inner.rb +30 -3
  81. data/lib/plainrouter/openapi/models/get_event200_response.rb +2 -2
  82. data/lib/plainrouter/openapi/models/get_event200_response_deliveries_inner.rb +30 -3
  83. data/lib/plainrouter/openapi/models/get_event200_response_event.rb +31 -4
  84. data/lib/plainrouter/openapi/models/get_event200_response_event_consent.rb +2 -2
  85. data/lib/plainrouter/openapi/models/get_event200_response_event_deliveries_inner.rb +30 -3
  86. data/lib/plainrouter/openapi/models/get_event200_response_event_user_data_hashed.rb +104 -0
  87. data/lib/plainrouter/openapi/models/get_event200_response_lineage.rb +2 -2
  88. data/lib/plainrouter/openapi/models/get_event200_response_lineage_children_inner.rb +31 -4
  89. data/lib/plainrouter/openapi/models/get_event200_response_lineage_parent.rb +31 -4
  90. data/lib/plainrouter/openapi/models/get_reconciliation_report200_response.rb +2 -2
  91. data/lib/plainrouter/openapi/models/get_reconciliation_report200_response_reports_inner.rb +30 -3
  92. data/lib/plainrouter/openapi/models/get_reconciliation_report200_response_reports_inner_buckets_value.rb +2 -2
  93. data/lib/plainrouter/openapi/models/get_reconciliation_report200_response_reports_inner_event_counts.rb +2 -2
  94. data/lib/plainrouter/openapi/models/get_reconciliation_report200_response_reports_inner_event_counts_accepted.rb +2 -2
  95. data/lib/plainrouter/openapi/models/get_sandbox200_response.rb +2 -2
  96. data/lib/plainrouter/openapi/models/get_sandbox200_response_self_serve_key.rb +32 -6
  97. data/lib/plainrouter/openapi/models/{create_sandbox_key201_response.rb → get_sandbox200_response_self_serve_key_issued_key.rb} +6 -6
  98. data/lib/plainrouter/openapi/models/{create_sandbox_key201_response_use.rb → get_sandbox200_response_self_serve_key_issued_key_use.rb} +5 -5
  99. data/lib/plainrouter/openapi/models/get_sandbox200_response_try.rb +2 -2
  100. data/lib/plainrouter/openapi/models/get_sandbox200_response_try_body.rb +2 -2
  101. data/lib/plainrouter/openapi/models/get_sandbox200_response_try_body_value_data.rb +2 -2
  102. data/lib/plainrouter/openapi/models/ingestion_warning_code.rb +39 -0
  103. data/lib/plainrouter/openapi/models/jurisdiction_policy_class.rb +2 -2
  104. data/lib/plainrouter/openapi/models/list_events200_response.rb +2 -2
  105. data/lib/plainrouter/openapi/models/list_events200_response_events.rb +2 -2
  106. data/lib/plainrouter/openapi/models/list_events200_response_events_links_inner.rb +2 -2
  107. data/lib/plainrouter/openapi/models/list_events200_response_metrics.rb +2 -2
  108. data/lib/plainrouter/openapi/models/list_events_by_cursor200_response.rb +2 -2
  109. data/lib/plainrouter/openapi/models/list_events_by_cursor200_response_events.rb +2 -2
  110. data/lib/plainrouter/openapi/models/reconciliation_report.rb +31 -3
  111. data/lib/plainrouter/openapi/models/replay_deliveries202_response.rb +2 -2
  112. data/lib/plainrouter/openapi/models/replay_deliveries_request.rb +2 -2
  113. data/lib/plainrouter/openapi/models/send_test_purchase200_response.rb +2 -2
  114. data/lib/plainrouter/openapi/models/send_test_purchase422_response.rb +2 -2
  115. data/lib/plainrouter/openapi/models/send_test_purchase_request.rb +2 -2
  116. data/lib/plainrouter/openapi/models/set_destination_test_mode200_response.rb +2 -2
  117. data/lib/plainrouter/openapi/models/set_destination_test_mode200_response_destination.rb +30 -3
  118. data/lib/plainrouter/openapi/models/set_destination_test_mode_request.rb +2 -2
  119. data/lib/plainrouter/openapi/models/traffic_class.rb +2 -2
  120. data/lib/plainrouter/openapi/models/validate_sandbox_event200_response.rb +2 -2
  121. data/lib/plainrouter/openapi/models/validate_sandbox_event_request.rb +2 -2
  122. data/lib/plainrouter/openapi/models/validate_sandbox_event_request_value_data.rb +2 -2
  123. data/lib/plainrouter/openapi/models/validation_error.rb +2 -2
  124. data/lib/plainrouter/openapi/version.rb +3 -3
  125. data/lib/plainrouter/openapi.rb +58 -4
  126. data/lib/plainrouter/version.rb +1 -1
  127. metadata +64 -10
@@ -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 ActionDryRunReadDryRunActionsInner
18
+ class << self
19
+ # List of class defined in anyOf (OpenAPI v3)
20
+ def openapi_any_of
21
+ [
22
+ :'ActionDryRunReadDryRunActionsInnerAnyOf',
23
+ :'ActionDryRunReadDryRunActionsInnerAnyOf1'
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,376 @@
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 ActionDryRunReadDryRunActionsInnerAnyOf < ApiModelBase
18
+ attr_accessor :type
19
+
20
+ attr_accessor :target_entity
21
+
22
+ attr_accessor :status
23
+
24
+ attr_accessor :policy_decision
25
+
26
+ attr_accessor :policy_reasons
27
+
28
+ attr_accessor :approval_required
29
+
30
+ attr_accessor :would_auto_execute
31
+
32
+ attr_accessor :diff
33
+
34
+ class EnumAttributeValidator
35
+ attr_reader :datatype
36
+ attr_reader :allowable_values
37
+
38
+ def initialize(datatype, allowable_values)
39
+ @allowable_values = allowable_values.map do |value|
40
+ case datatype.to_s
41
+ when /Integer/i
42
+ value.to_i
43
+ when /Float/i
44
+ value.to_f
45
+ else
46
+ value
47
+ end
48
+ end
49
+ end
50
+
51
+ def valid?(value)
52
+ !value || allowable_values.include?(value)
53
+ end
54
+ end
55
+
56
+ # Attribute mapping from ruby-style variable name to JSON key.
57
+ def self.attribute_map
58
+ {
59
+ :'type' => :'type',
60
+ :'target_entity' => :'target_entity',
61
+ :'status' => :'status',
62
+ :'policy_decision' => :'policy_decision',
63
+ :'policy_reasons' => :'policy_reasons',
64
+ :'approval_required' => :'approval_required',
65
+ :'would_auto_execute' => :'would_auto_execute',
66
+ :'diff' => :'diff'
67
+ }
68
+ end
69
+
70
+ # Returns attribute mapping this model knows about
71
+ def self.acceptable_attribute_map
72
+ attribute_map
73
+ end
74
+
75
+ # Returns all the JSON keys this model knows about
76
+ def self.acceptable_attributes
77
+ acceptable_attribute_map.values
78
+ end
79
+
80
+ # Attribute type mapping.
81
+ def self.openapi_types
82
+ {
83
+ :'type' => :'String',
84
+ :'target_entity' => :'ActionDryRunReadDryRunActionsInnerAnyOfTargetEntity',
85
+ :'status' => :'String',
86
+ :'policy_decision' => :'String',
87
+ :'policy_reasons' => :'Array<String>',
88
+ :'approval_required' => :'Boolean',
89
+ :'would_auto_execute' => :'Boolean',
90
+ :'diff' => :'ActionDryRunReadDryRunActionsInnerAnyOfDiff'
91
+ }
92
+ end
93
+
94
+ # List of attributes with nullable: true
95
+ def self.openapi_nullable
96
+ Set.new([
97
+ ])
98
+ end
99
+
100
+ # Initializes the object
101
+ # @param [Hash] attributes Model attributes in the form of hash
102
+ def initialize(attributes = {})
103
+ if (!attributes.is_a?(Hash))
104
+ fail ArgumentError, "The input argument (attributes) must be a hash in `PlainRouter::OpenAPI::ActionDryRunReadDryRunActionsInnerAnyOf` initialize method"
105
+ end
106
+
107
+ # check to see if the attribute exists and convert string to symbol for hash key
108
+ acceptable_attribute_map = self.class.acceptable_attribute_map
109
+ attributes = attributes.each_with_object({}) { |(k, v), h|
110
+ if (!acceptable_attribute_map.key?(k.to_sym))
111
+ fail ArgumentError, "`#{k}` is not a valid attribute in `PlainRouter::OpenAPI::ActionDryRunReadDryRunActionsInnerAnyOf`. Please check the name to make sure it's valid. List of attributes: " + acceptable_attribute_map.keys.inspect
112
+ end
113
+ h[k.to_sym] = v
114
+ }
115
+
116
+ if attributes.key?(:'type')
117
+ self.type = attributes[:'type']
118
+ else
119
+ self.type = nil
120
+ end
121
+
122
+ if attributes.key?(:'target_entity')
123
+ self.target_entity = attributes[:'target_entity']
124
+ else
125
+ self.target_entity = nil
126
+ end
127
+
128
+ if attributes.key?(:'status')
129
+ self.status = attributes[:'status']
130
+ else
131
+ self.status = nil
132
+ end
133
+
134
+ if attributes.key?(:'policy_decision')
135
+ self.policy_decision = attributes[:'policy_decision']
136
+ else
137
+ self.policy_decision = nil
138
+ end
139
+
140
+ if attributes.key?(:'policy_reasons')
141
+ if (value = attributes[:'policy_reasons']).is_a?(Array)
142
+ self.policy_reasons = value
143
+ end
144
+ else
145
+ self.policy_reasons = nil
146
+ end
147
+
148
+ if attributes.key?(:'approval_required')
149
+ self.approval_required = attributes[:'approval_required']
150
+ else
151
+ self.approval_required = nil
152
+ end
153
+
154
+ if attributes.key?(:'would_auto_execute')
155
+ self.would_auto_execute = attributes[:'would_auto_execute']
156
+ else
157
+ self.would_auto_execute = nil
158
+ end
159
+
160
+ if attributes.key?(:'diff')
161
+ self.diff = attributes[:'diff']
162
+ else
163
+ self.diff = nil
164
+ end
165
+ end
166
+
167
+ # Show invalid properties with the reasons. Usually used together with valid?
168
+ # @return Array for valid properties with the reasons
169
+ def list_invalid_properties
170
+ warn '[DEPRECATED] the `list_invalid_properties` method is obsolete'
171
+ invalid_properties = Array.new
172
+ if @type.nil?
173
+ invalid_properties.push('invalid value for "type", type cannot be nil.')
174
+ end
175
+
176
+ if @target_entity.nil?
177
+ invalid_properties.push('invalid value for "target_entity", target_entity cannot be nil.')
178
+ end
179
+
180
+ if @status.nil?
181
+ invalid_properties.push('invalid value for "status", status cannot be nil.')
182
+ end
183
+
184
+ if @policy_decision.nil?
185
+ invalid_properties.push('invalid value for "policy_decision", policy_decision cannot be nil.')
186
+ end
187
+
188
+ if @policy_reasons.nil?
189
+ invalid_properties.push('invalid value for "policy_reasons", policy_reasons cannot be nil.')
190
+ end
191
+
192
+ if @approval_required.nil?
193
+ invalid_properties.push('invalid value for "approval_required", approval_required cannot be nil.')
194
+ end
195
+
196
+ if @would_auto_execute.nil?
197
+ invalid_properties.push('invalid value for "would_auto_execute", would_auto_execute cannot be nil.')
198
+ end
199
+
200
+ if @diff.nil?
201
+ invalid_properties.push('invalid value for "diff", diff cannot be nil.')
202
+ end
203
+
204
+ invalid_properties
205
+ end
206
+
207
+ # Check to see if the all the properties in the model are valid
208
+ # @return true if the model is valid
209
+ def valid?
210
+ warn '[DEPRECATED] the `valid?` method is obsolete'
211
+ return false if @type.nil?
212
+ type_validator = EnumAttributeValidator.new('String', ["increase_budget", "decrease_budget", "pause", "resume", "replace_creative", "shift_spend", "rollback", "create_campaign", "create_ad_set", "create_ad", "upload_asset", "adjust_budget", "set_status", "duplicate_ad_with_creative", "duplicate_adset", "duplicate_ad_with_creative_v2"])
213
+ return false unless type_validator.valid?(@type)
214
+ return false if @target_entity.nil?
215
+ return false if @status.nil?
216
+ status_validator = EnumAttributeValidator.new('String', ["evaluated"])
217
+ return false unless status_validator.valid?(@status)
218
+ return false if @policy_decision.nil?
219
+ policy_decision_validator = EnumAttributeValidator.new('String', ["allow", "require_approval", "block"])
220
+ return false unless policy_decision_validator.valid?(@policy_decision)
221
+ return false if @policy_reasons.nil?
222
+ return false if @approval_required.nil?
223
+ return false if @would_auto_execute.nil?
224
+ return false if @diff.nil?
225
+ true
226
+ end
227
+
228
+ # Custom attribute writer method checking allowed values (enum).
229
+ # @param [Object] type Object to be assigned
230
+ def type=(type)
231
+ validator = EnumAttributeValidator.new('String', ["increase_budget", "decrease_budget", "pause", "resume", "replace_creative", "shift_spend", "rollback", "create_campaign", "create_ad_set", "create_ad", "upload_asset", "adjust_budget", "set_status", "duplicate_ad_with_creative", "duplicate_adset", "duplicate_ad_with_creative_v2"])
232
+ unless validator.valid?(type)
233
+ fail ArgumentError, "invalid value for \"type\", must be one of #{validator.allowable_values}."
234
+ end
235
+ @type = type
236
+ end
237
+
238
+ # Custom attribute writer method with validation
239
+ # @param [Object] target_entity Value to be assigned
240
+ def target_entity=(target_entity)
241
+ if target_entity.nil?
242
+ fail ArgumentError, 'target_entity cannot be nil'
243
+ end
244
+
245
+ @target_entity = target_entity
246
+ end
247
+
248
+ # Custom attribute writer method checking allowed values (enum).
249
+ # @param [Object] status Object to be assigned
250
+ def status=(status)
251
+ validator = EnumAttributeValidator.new('String', ["evaluated"])
252
+ unless validator.valid?(status)
253
+ fail ArgumentError, "invalid value for \"status\", must be one of #{validator.allowable_values}."
254
+ end
255
+ @status = status
256
+ end
257
+
258
+ # Custom attribute writer method checking allowed values (enum).
259
+ # @param [Object] policy_decision Object to be assigned
260
+ def policy_decision=(policy_decision)
261
+ validator = EnumAttributeValidator.new('String', ["allow", "require_approval", "block"])
262
+ unless validator.valid?(policy_decision)
263
+ fail ArgumentError, "invalid value for \"policy_decision\", must be one of #{validator.allowable_values}."
264
+ end
265
+ @policy_decision = policy_decision
266
+ end
267
+
268
+ # Custom attribute writer method with validation
269
+ # @param [Object] policy_reasons Value to be assigned
270
+ def policy_reasons=(policy_reasons)
271
+ if policy_reasons.nil?
272
+ fail ArgumentError, 'policy_reasons cannot be nil'
273
+ end
274
+
275
+ @policy_reasons = policy_reasons
276
+ end
277
+
278
+ # Custom attribute writer method with validation
279
+ # @param [Object] approval_required Value to be assigned
280
+ def approval_required=(approval_required)
281
+ if approval_required.nil?
282
+ fail ArgumentError, 'approval_required cannot be nil'
283
+ end
284
+
285
+ @approval_required = approval_required
286
+ end
287
+
288
+ # Custom attribute writer method with validation
289
+ # @param [Object] would_auto_execute Value to be assigned
290
+ def would_auto_execute=(would_auto_execute)
291
+ if would_auto_execute.nil?
292
+ fail ArgumentError, 'would_auto_execute cannot be nil'
293
+ end
294
+
295
+ @would_auto_execute = would_auto_execute
296
+ end
297
+
298
+ # Custom attribute writer method with validation
299
+ # @param [Object] diff Value to be assigned
300
+ def diff=(diff)
301
+ if diff.nil?
302
+ fail ArgumentError, 'diff cannot be nil'
303
+ end
304
+
305
+ @diff = diff
306
+ end
307
+
308
+ # Checks equality by comparing each attribute.
309
+ # @param [Object] Object to be compared
310
+ def ==(o)
311
+ return true if self.equal?(o)
312
+ self.class == o.class &&
313
+ type == o.type &&
314
+ target_entity == o.target_entity &&
315
+ status == o.status &&
316
+ policy_decision == o.policy_decision &&
317
+ policy_reasons == o.policy_reasons &&
318
+ approval_required == o.approval_required &&
319
+ would_auto_execute == o.would_auto_execute &&
320
+ diff == o.diff
321
+ end
322
+
323
+ # @see the `==` method
324
+ # @param [Object] Object to be compared
325
+ def eql?(o)
326
+ self == o
327
+ end
328
+
329
+ # Calculates hash code according to all attributes.
330
+ # @return [Integer] Hash code
331
+ def hash
332
+ [type, target_entity, status, policy_decision, policy_reasons, approval_required, would_auto_execute, diff].hash
333
+ end
334
+
335
+ # Builds the object from hash
336
+ # @param [Hash] attributes Model attributes in the form of hash
337
+ # @return [Object] Returns the model itself
338
+ def self.build_from_hash(attributes)
339
+ return nil unless attributes.is_a?(Hash)
340
+ attributes = attributes.transform_keys(&:to_sym)
341
+ transformed_hash = {}
342
+ openapi_types.each_pair do |key, type|
343
+ if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil?
344
+ transformed_hash["#{key}"] = nil
345
+ elsif type =~ /\AArray<(.*)>/i
346
+ # check to ensure the input is an array given that the attribute
347
+ # is documented as an array but the input is not
348
+ if attributes[attribute_map[key]].is_a?(Array)
349
+ transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) }
350
+ end
351
+ elsif !attributes[attribute_map[key]].nil?
352
+ transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]])
353
+ end
354
+ end
355
+ new(transformed_hash)
356
+ end
357
+
358
+ # Returns the object in the form of hash
359
+ # @return [Hash] Returns the object in the form of hash
360
+ def to_hash
361
+ hash = {}
362
+ self.class.attribute_map.each_pair do |attr, param|
363
+ value = self.send(attr)
364
+ if value.nil?
365
+ is_nullable = self.class.openapi_nullable.include?(attr)
366
+ next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
367
+ end
368
+
369
+ hash[param] = _to_hash(value)
370
+ end
371
+ hash
372
+ end
373
+
374
+ end
375
+
376
+ end