late-sdk 0.0.658 → 0.0.659
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.
- checksums.yaml +4 -4
- data/README.md +16 -0
- data/docs/AdAccountsApi.md +364 -0
- data/docs/AdCampaignsApi.md +1 -1
- data/docs/CreateStandaloneAdRequest.md +4 -0
- data/docs/CreateValueRuleSet201Response.md +20 -0
- data/docs/CreateValueRuleSetRequest.md +24 -0
- data/docs/DeleteValueRuleSet200Response.md +20 -0
- data/docs/GetValueRuleSet200Response.md +18 -0
- data/docs/ListValueRuleSets200Response.md +22 -0
- data/docs/ListValueRuleSets200ResponsePaging.md +18 -0
- data/docs/UpdateAdSetRequest.md +4 -0
- data/docs/UpdateValueRuleSet200Response.md +24 -0
- data/docs/UpdateValueRuleSetRequest.md +22 -0
- data/docs/ValueRule.md +28 -0
- data/docs/ValueRuleCriterion.md +26 -0
- data/docs/ValueRuleSet.md +22 -0
- data/lib/zernio-sdk/api/ad_accounts_api.rb +367 -0
- data/lib/zernio-sdk/api/ad_campaigns_api.rb +2 -2
- data/lib/zernio-sdk/models/create_standalone_ad_request.rb +42 -1
- data/lib/zernio-sdk/models/create_value_rule_set201_response.rb +158 -0
- data/lib/zernio-sdk/models/create_value_rule_set_request.rb +283 -0
- data/lib/zernio-sdk/models/delete_value_rule_set200_response.rb +156 -0
- data/lib/zernio-sdk/models/get_value_rule_set200_response.rb +147 -0
- data/lib/zernio-sdk/models/list_value_rule_sets200_response.rb +167 -0
- data/lib/zernio-sdk/models/list_value_rule_sets200_response_paging.rb +149 -0
- data/lib/zernio-sdk/models/update_ad_set_request.rb +42 -1
- data/lib/zernio-sdk/models/update_value_rule_set200_response.rb +176 -0
- data/lib/zernio-sdk/models/update_value_rule_set_request.rb +257 -0
- data/lib/zernio-sdk/models/value_rule.rb +346 -0
- data/lib/zernio-sdk/models/value_rule_criterion.rb +305 -0
- data/lib/zernio-sdk/models/value_rule_set.rb +221 -0
- data/lib/zernio-sdk/version.rb +1 -1
- data/lib/zernio-sdk.rb +11 -0
- data/openapi.yaml +395 -3
- data/spec/api/ad_accounts_api_spec.rb +66 -0
- data/spec/api/ad_campaigns_api_spec.rb +1 -1
- data/spec/models/create_standalone_ad_request_spec.rb +12 -0
- data/spec/models/create_value_rule_set201_response_spec.rb +42 -0
- data/spec/models/create_value_rule_set_request_spec.rb +54 -0
- data/spec/models/delete_value_rule_set200_response_spec.rb +42 -0
- data/spec/models/get_value_rule_set200_response_spec.rb +36 -0
- data/spec/models/list_value_rule_sets200_response_paging_spec.rb +36 -0
- data/spec/models/list_value_rule_sets200_response_spec.rb +48 -0
- data/spec/models/update_ad_set_request_spec.rb +12 -0
- data/spec/models/update_value_rule_set200_response_spec.rb +54 -0
- data/spec/models/update_value_rule_set_request_spec.rb +48 -0
- data/spec/models/value_rule_criterion_spec.rb +68 -0
- data/spec/models/value_rule_set_spec.rb +48 -0
- data/spec/models/value_rule_spec.rb +70 -0
- data/zernio-sdk-0.0.659.gem +0 -0
- metadata +46 -2
- data/zernio-sdk-0.0.658.gem +0 -0
|
@@ -0,0 +1,346 @@
|
|
|
1
|
+
=begin
|
|
2
|
+
#Zernio API
|
|
3
|
+
|
|
4
|
+
#API reference for Zernio. Authenticate with a Bearer API key. Base URL: https://zernio.com/api
|
|
5
|
+
|
|
6
|
+
The version of the OpenAPI document: 1.0.4
|
|
7
|
+
Contact: support@zernio.com
|
|
8
|
+
Generated by: https://openapi-generator.tech
|
|
9
|
+
Generator version: 7.19.0
|
|
10
|
+
|
|
11
|
+
=end
|
|
12
|
+
|
|
13
|
+
require 'date'
|
|
14
|
+
require 'time'
|
|
15
|
+
|
|
16
|
+
module Zernio
|
|
17
|
+
# One bid-adjustment rule. Rules are evaluated in ARRAY ORDER and only the first matching rule adjusts the bid for an overlapping audience, so the order is semantic.
|
|
18
|
+
class ValueRule < ApiModelBase
|
|
19
|
+
# Platform rule id. Echo it on `PUT` to KEEP this rule, omit it to CREATE a new one. A rule left out of the array entirely is DELETED.
|
|
20
|
+
attr_accessor :id
|
|
21
|
+
|
|
22
|
+
attr_accessor :name
|
|
23
|
+
|
|
24
|
+
# Direction of the adjustment. There is no signed value field.
|
|
25
|
+
attr_accessor :adjust_sign
|
|
26
|
+
|
|
27
|
+
# Unsigned percentage magnitude. `INCREASE` accepts 1-1000, `DECREASE` accepts 1-90. 0 is out of range on both.
|
|
28
|
+
attr_accessor :adjust_value
|
|
29
|
+
|
|
30
|
+
# Meta returns `ACTIVE` here but documents no enum for the field. Treat it as a passthrough: echo whatever the `GET` returned, and do not synthesize values.
|
|
31
|
+
attr_accessor :status
|
|
32
|
+
|
|
33
|
+
# All criteria on a rule must match for the rule to fire.
|
|
34
|
+
attr_accessor :criteria
|
|
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
|
+
:'id' => :'id',
|
|
62
|
+
:'name' => :'name',
|
|
63
|
+
:'adjust_sign' => :'adjustSign',
|
|
64
|
+
:'adjust_value' => :'adjustValue',
|
|
65
|
+
:'status' => :'status',
|
|
66
|
+
:'criteria' => :'criteria'
|
|
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
|
+
:'id' => :'String',
|
|
84
|
+
:'name' => :'String',
|
|
85
|
+
:'adjust_sign' => :'String',
|
|
86
|
+
:'adjust_value' => :'Integer',
|
|
87
|
+
:'status' => :'String',
|
|
88
|
+
:'criteria' => :'Array<ValueRuleCriterion>'
|
|
89
|
+
}
|
|
90
|
+
end
|
|
91
|
+
|
|
92
|
+
# List of attributes with nullable: true
|
|
93
|
+
def self.openapi_nullable
|
|
94
|
+
Set.new([
|
|
95
|
+
])
|
|
96
|
+
end
|
|
97
|
+
|
|
98
|
+
# Initializes the object
|
|
99
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
|
100
|
+
def initialize(attributes = {})
|
|
101
|
+
if (!attributes.is_a?(Hash))
|
|
102
|
+
fail ArgumentError, "The input argument (attributes) must be a hash in `Zernio::ValueRule` initialize method"
|
|
103
|
+
end
|
|
104
|
+
|
|
105
|
+
# check to see if the attribute exists and convert string to symbol for hash key
|
|
106
|
+
acceptable_attribute_map = self.class.acceptable_attribute_map
|
|
107
|
+
attributes = attributes.each_with_object({}) { |(k, v), h|
|
|
108
|
+
if (!acceptable_attribute_map.key?(k.to_sym))
|
|
109
|
+
fail ArgumentError, "`#{k}` is not a valid attribute in `Zernio::ValueRule`. Please check the name to make sure it's valid. List of attributes: " + acceptable_attribute_map.keys.inspect
|
|
110
|
+
end
|
|
111
|
+
h[k.to_sym] = v
|
|
112
|
+
}
|
|
113
|
+
|
|
114
|
+
if attributes.key?(:'id')
|
|
115
|
+
self.id = attributes[:'id']
|
|
116
|
+
end
|
|
117
|
+
|
|
118
|
+
if attributes.key?(:'name')
|
|
119
|
+
self.name = attributes[:'name']
|
|
120
|
+
else
|
|
121
|
+
self.name = nil
|
|
122
|
+
end
|
|
123
|
+
|
|
124
|
+
if attributes.key?(:'adjust_sign')
|
|
125
|
+
self.adjust_sign = attributes[:'adjust_sign']
|
|
126
|
+
else
|
|
127
|
+
self.adjust_sign = nil
|
|
128
|
+
end
|
|
129
|
+
|
|
130
|
+
if attributes.key?(:'adjust_value')
|
|
131
|
+
self.adjust_value = attributes[:'adjust_value']
|
|
132
|
+
else
|
|
133
|
+
self.adjust_value = nil
|
|
134
|
+
end
|
|
135
|
+
|
|
136
|
+
if attributes.key?(:'status')
|
|
137
|
+
self.status = attributes[:'status']
|
|
138
|
+
end
|
|
139
|
+
|
|
140
|
+
if attributes.key?(:'criteria')
|
|
141
|
+
if (value = attributes[:'criteria']).is_a?(Array)
|
|
142
|
+
self.criteria = value
|
|
143
|
+
end
|
|
144
|
+
else
|
|
145
|
+
self.criteria = nil
|
|
146
|
+
end
|
|
147
|
+
end
|
|
148
|
+
|
|
149
|
+
# Show invalid properties with the reasons. Usually used together with valid?
|
|
150
|
+
# @return Array for valid properties with the reasons
|
|
151
|
+
def list_invalid_properties
|
|
152
|
+
warn '[DEPRECATED] the `list_invalid_properties` method is obsolete'
|
|
153
|
+
invalid_properties = Array.new
|
|
154
|
+
if @name.nil?
|
|
155
|
+
invalid_properties.push('invalid value for "name", name cannot be nil.')
|
|
156
|
+
end
|
|
157
|
+
|
|
158
|
+
if @name.to_s.length > 255
|
|
159
|
+
invalid_properties.push('invalid value for "name", the character length must be smaller than or equal to 255.')
|
|
160
|
+
end
|
|
161
|
+
|
|
162
|
+
if @name.to_s.length < 1
|
|
163
|
+
invalid_properties.push('invalid value for "name", the character length must be greater than or equal to 1.')
|
|
164
|
+
end
|
|
165
|
+
|
|
166
|
+
if @adjust_sign.nil?
|
|
167
|
+
invalid_properties.push('invalid value for "adjust_sign", adjust_sign cannot be nil.')
|
|
168
|
+
end
|
|
169
|
+
|
|
170
|
+
if @adjust_value.nil?
|
|
171
|
+
invalid_properties.push('invalid value for "adjust_value", adjust_value cannot be nil.')
|
|
172
|
+
end
|
|
173
|
+
|
|
174
|
+
if @adjust_value > 1000
|
|
175
|
+
invalid_properties.push('invalid value for "adjust_value", must be smaller than or equal to 1000.')
|
|
176
|
+
end
|
|
177
|
+
|
|
178
|
+
if @adjust_value < 1
|
|
179
|
+
invalid_properties.push('invalid value for "adjust_value", must be greater than or equal to 1.')
|
|
180
|
+
end
|
|
181
|
+
|
|
182
|
+
if @criteria.nil?
|
|
183
|
+
invalid_properties.push('invalid value for "criteria", criteria cannot be nil.')
|
|
184
|
+
end
|
|
185
|
+
|
|
186
|
+
if @criteria.length > 4
|
|
187
|
+
invalid_properties.push('invalid value for "criteria", number of items must be less than or equal to 4.')
|
|
188
|
+
end
|
|
189
|
+
|
|
190
|
+
if @criteria.length < 1
|
|
191
|
+
invalid_properties.push('invalid value for "criteria", number of items must be greater than or equal to 1.')
|
|
192
|
+
end
|
|
193
|
+
|
|
194
|
+
invalid_properties
|
|
195
|
+
end
|
|
196
|
+
|
|
197
|
+
# Check to see if the all the properties in the model are valid
|
|
198
|
+
# @return true if the model is valid
|
|
199
|
+
def valid?
|
|
200
|
+
warn '[DEPRECATED] the `valid?` method is obsolete'
|
|
201
|
+
return false if @name.nil?
|
|
202
|
+
return false if @name.to_s.length > 255
|
|
203
|
+
return false if @name.to_s.length < 1
|
|
204
|
+
return false if @adjust_sign.nil?
|
|
205
|
+
adjust_sign_validator = EnumAttributeValidator.new('String', ["INCREASE", "DECREASE"])
|
|
206
|
+
return false unless adjust_sign_validator.valid?(@adjust_sign)
|
|
207
|
+
return false if @adjust_value.nil?
|
|
208
|
+
return false if @adjust_value > 1000
|
|
209
|
+
return false if @adjust_value < 1
|
|
210
|
+
return false if @criteria.nil?
|
|
211
|
+
return false if @criteria.length > 4
|
|
212
|
+
return false if @criteria.length < 1
|
|
213
|
+
true
|
|
214
|
+
end
|
|
215
|
+
|
|
216
|
+
# Custom attribute writer method with validation
|
|
217
|
+
# @param [Object] name Value to be assigned
|
|
218
|
+
def name=(name)
|
|
219
|
+
if name.nil?
|
|
220
|
+
fail ArgumentError, 'name cannot be nil'
|
|
221
|
+
end
|
|
222
|
+
|
|
223
|
+
if name.to_s.length > 255
|
|
224
|
+
fail ArgumentError, 'invalid value for "name", the character length must be smaller than or equal to 255.'
|
|
225
|
+
end
|
|
226
|
+
|
|
227
|
+
if name.to_s.length < 1
|
|
228
|
+
fail ArgumentError, 'invalid value for "name", the character length must be greater than or equal to 1.'
|
|
229
|
+
end
|
|
230
|
+
|
|
231
|
+
@name = name
|
|
232
|
+
end
|
|
233
|
+
|
|
234
|
+
# Custom attribute writer method checking allowed values (enum).
|
|
235
|
+
# @param [Object] adjust_sign Object to be assigned
|
|
236
|
+
def adjust_sign=(adjust_sign)
|
|
237
|
+
validator = EnumAttributeValidator.new('String', ["INCREASE", "DECREASE"])
|
|
238
|
+
unless validator.valid?(adjust_sign)
|
|
239
|
+
fail ArgumentError, "invalid value for \"adjust_sign\", must be one of #{validator.allowable_values}."
|
|
240
|
+
end
|
|
241
|
+
@adjust_sign = adjust_sign
|
|
242
|
+
end
|
|
243
|
+
|
|
244
|
+
# Custom attribute writer method with validation
|
|
245
|
+
# @param [Object] adjust_value Value to be assigned
|
|
246
|
+
def adjust_value=(adjust_value)
|
|
247
|
+
if adjust_value.nil?
|
|
248
|
+
fail ArgumentError, 'adjust_value cannot be nil'
|
|
249
|
+
end
|
|
250
|
+
|
|
251
|
+
if adjust_value > 1000
|
|
252
|
+
fail ArgumentError, 'invalid value for "adjust_value", must be smaller than or equal to 1000.'
|
|
253
|
+
end
|
|
254
|
+
|
|
255
|
+
if adjust_value < 1
|
|
256
|
+
fail ArgumentError, 'invalid value for "adjust_value", must be greater than or equal to 1.'
|
|
257
|
+
end
|
|
258
|
+
|
|
259
|
+
@adjust_value = adjust_value
|
|
260
|
+
end
|
|
261
|
+
|
|
262
|
+
# Custom attribute writer method with validation
|
|
263
|
+
# @param [Object] criteria Value to be assigned
|
|
264
|
+
def criteria=(criteria)
|
|
265
|
+
if criteria.nil?
|
|
266
|
+
fail ArgumentError, 'criteria cannot be nil'
|
|
267
|
+
end
|
|
268
|
+
|
|
269
|
+
if criteria.length > 4
|
|
270
|
+
fail ArgumentError, 'invalid value for "criteria", number of items must be less than or equal to 4.'
|
|
271
|
+
end
|
|
272
|
+
|
|
273
|
+
if criteria.length < 1
|
|
274
|
+
fail ArgumentError, 'invalid value for "criteria", number of items must be greater than or equal to 1.'
|
|
275
|
+
end
|
|
276
|
+
|
|
277
|
+
@criteria = criteria
|
|
278
|
+
end
|
|
279
|
+
|
|
280
|
+
# Checks equality by comparing each attribute.
|
|
281
|
+
# @param [Object] Object to be compared
|
|
282
|
+
def ==(o)
|
|
283
|
+
return true if self.equal?(o)
|
|
284
|
+
self.class == o.class &&
|
|
285
|
+
id == o.id &&
|
|
286
|
+
name == o.name &&
|
|
287
|
+
adjust_sign == o.adjust_sign &&
|
|
288
|
+
adjust_value == o.adjust_value &&
|
|
289
|
+
status == o.status &&
|
|
290
|
+
criteria == o.criteria
|
|
291
|
+
end
|
|
292
|
+
|
|
293
|
+
# @see the `==` method
|
|
294
|
+
# @param [Object] Object to be compared
|
|
295
|
+
def eql?(o)
|
|
296
|
+
self == o
|
|
297
|
+
end
|
|
298
|
+
|
|
299
|
+
# Calculates hash code according to all attributes.
|
|
300
|
+
# @return [Integer] Hash code
|
|
301
|
+
def hash
|
|
302
|
+
[id, name, adjust_sign, adjust_value, status, criteria].hash
|
|
303
|
+
end
|
|
304
|
+
|
|
305
|
+
# Builds the object from hash
|
|
306
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
|
307
|
+
# @return [Object] Returns the model itself
|
|
308
|
+
def self.build_from_hash(attributes)
|
|
309
|
+
return nil unless attributes.is_a?(Hash)
|
|
310
|
+
attributes = attributes.transform_keys(&:to_sym)
|
|
311
|
+
transformed_hash = {}
|
|
312
|
+
openapi_types.each_pair do |key, type|
|
|
313
|
+
if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil?
|
|
314
|
+
transformed_hash["#{key}"] = nil
|
|
315
|
+
elsif type =~ /\AArray<(.*)>/i
|
|
316
|
+
# check to ensure the input is an array given that the attribute
|
|
317
|
+
# is documented as an array but the input is not
|
|
318
|
+
if attributes[attribute_map[key]].is_a?(Array)
|
|
319
|
+
transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) }
|
|
320
|
+
end
|
|
321
|
+
elsif !attributes[attribute_map[key]].nil?
|
|
322
|
+
transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]])
|
|
323
|
+
end
|
|
324
|
+
end
|
|
325
|
+
new(transformed_hash)
|
|
326
|
+
end
|
|
327
|
+
|
|
328
|
+
# Returns the object in the form of hash
|
|
329
|
+
# @return [Hash] Returns the object in the form of hash
|
|
330
|
+
def to_hash
|
|
331
|
+
hash = {}
|
|
332
|
+
self.class.attribute_map.each_pair do |attr, param|
|
|
333
|
+
value = self.send(attr)
|
|
334
|
+
if value.nil?
|
|
335
|
+
is_nullable = self.class.openapi_nullable.include?(attr)
|
|
336
|
+
next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
|
|
337
|
+
end
|
|
338
|
+
|
|
339
|
+
hash[param] = _to_hash(value)
|
|
340
|
+
end
|
|
341
|
+
hash
|
|
342
|
+
end
|
|
343
|
+
|
|
344
|
+
end
|
|
345
|
+
|
|
346
|
+
end
|
|
@@ -0,0 +1,305 @@
|
|
|
1
|
+
=begin
|
|
2
|
+
#Zernio API
|
|
3
|
+
|
|
4
|
+
#API reference for Zernio. Authenticate with a Bearer API key. Base URL: https://zernio.com/api
|
|
5
|
+
|
|
6
|
+
The version of the OpenAPI document: 1.0.4
|
|
7
|
+
Contact: support@zernio.com
|
|
8
|
+
Generated by: https://openapi-generator.tech
|
|
9
|
+
Generator version: 7.19.0
|
|
10
|
+
|
|
11
|
+
=end
|
|
12
|
+
|
|
13
|
+
require 'date'
|
|
14
|
+
require 'time'
|
|
15
|
+
|
|
16
|
+
module Zernio
|
|
17
|
+
# One matching condition inside a value rule. `criteriaValues` and `criteriaValueTypes` are POSITIONALLY paired: same length, same order.
|
|
18
|
+
class ValueRuleCriterion < ApiModelBase
|
|
19
|
+
# Platform criterion id. Echo it on `PUT` to KEEP this criterion, omit it to CREATE a new one. A criterion left out of the array entirely is DELETED.
|
|
20
|
+
attr_accessor :id
|
|
21
|
+
|
|
22
|
+
# The dimension being matched. `OMNI_CHANNEL` (conversion location: APP, INSTANT_FORM, PHONE_CALL, WEBSITE) is accepted even though Meta's own enum table omits it.
|
|
23
|
+
attr_accessor :criteria_type
|
|
24
|
+
|
|
25
|
+
# Required on every criterion. `CONTAINS` is currently the only value Meta supports.
|
|
26
|
+
attr_accessor :operator
|
|
27
|
+
|
|
28
|
+
# The values to match. `AGE` takes ranges such as `18-24`, `18+` or a custom `18-26`; a range whose upper bound is 65 is NOT allowed (use `18+` instead of `18-65`). `LOCATION` takes Targeting-Search keys: a two-letter country code for `LOCATION_COUNTRY`, a numeric key for region / city / comScore market. `AUDIENCE_LABEL` takes labels such as `HIGH_VALUE`, which are applied to a Custom Audience in Ads Manager: there is no API to provision them, so they are passed through unvalidated.
|
|
29
|
+
attr_accessor :criteria_values
|
|
30
|
+
|
|
31
|
+
# One entry per `criteriaValues` entry, in the same order. The literal `\"NONE\"` for every criteriaType except `LOCATION`, which uses `LOCATION_COUNTRY`, `LOCATION_REGION`, `LOCATION_CITY` or `LOCATION_COMSCORE_MARKET` and MAY mix them within one criterion. `LOCATION_DMA` was replaced by `LOCATION_COMSCORE_MARKET` on 2026-06-22 and is rejected by this API.
|
|
32
|
+
attr_accessor :criteria_value_types
|
|
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
|
+
:'id' => :'id',
|
|
60
|
+
:'criteria_type' => :'criteriaType',
|
|
61
|
+
:'operator' => :'operator',
|
|
62
|
+
:'criteria_values' => :'criteriaValues',
|
|
63
|
+
:'criteria_value_types' => :'criteriaValueTypes'
|
|
64
|
+
}
|
|
65
|
+
end
|
|
66
|
+
|
|
67
|
+
# Returns attribute mapping this model knows about
|
|
68
|
+
def self.acceptable_attribute_map
|
|
69
|
+
attribute_map
|
|
70
|
+
end
|
|
71
|
+
|
|
72
|
+
# Returns all the JSON keys this model knows about
|
|
73
|
+
def self.acceptable_attributes
|
|
74
|
+
acceptable_attribute_map.values
|
|
75
|
+
end
|
|
76
|
+
|
|
77
|
+
# Attribute type mapping.
|
|
78
|
+
def self.openapi_types
|
|
79
|
+
{
|
|
80
|
+
:'id' => :'String',
|
|
81
|
+
:'criteria_type' => :'String',
|
|
82
|
+
:'operator' => :'String',
|
|
83
|
+
:'criteria_values' => :'Array<String>',
|
|
84
|
+
:'criteria_value_types' => :'Array<String>'
|
|
85
|
+
}
|
|
86
|
+
end
|
|
87
|
+
|
|
88
|
+
# List of attributes with nullable: true
|
|
89
|
+
def self.openapi_nullable
|
|
90
|
+
Set.new([
|
|
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 `Zernio::ValueRuleCriterion` 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 `Zernio::ValueRuleCriterion`. 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?(:'id')
|
|
111
|
+
self.id = attributes[:'id']
|
|
112
|
+
end
|
|
113
|
+
|
|
114
|
+
if attributes.key?(:'criteria_type')
|
|
115
|
+
self.criteria_type = attributes[:'criteria_type']
|
|
116
|
+
else
|
|
117
|
+
self.criteria_type = nil
|
|
118
|
+
end
|
|
119
|
+
|
|
120
|
+
if attributes.key?(:'operator')
|
|
121
|
+
self.operator = attributes[:'operator']
|
|
122
|
+
else
|
|
123
|
+
self.operator = nil
|
|
124
|
+
end
|
|
125
|
+
|
|
126
|
+
if attributes.key?(:'criteria_values')
|
|
127
|
+
if (value = attributes[:'criteria_values']).is_a?(Array)
|
|
128
|
+
self.criteria_values = value
|
|
129
|
+
end
|
|
130
|
+
else
|
|
131
|
+
self.criteria_values = nil
|
|
132
|
+
end
|
|
133
|
+
|
|
134
|
+
if attributes.key?(:'criteria_value_types')
|
|
135
|
+
if (value = attributes[:'criteria_value_types']).is_a?(Array)
|
|
136
|
+
self.criteria_value_types = value
|
|
137
|
+
end
|
|
138
|
+
else
|
|
139
|
+
self.criteria_value_types = nil
|
|
140
|
+
end
|
|
141
|
+
end
|
|
142
|
+
|
|
143
|
+
# Show invalid properties with the reasons. Usually used together with valid?
|
|
144
|
+
# @return Array for valid properties with the reasons
|
|
145
|
+
def list_invalid_properties
|
|
146
|
+
warn '[DEPRECATED] the `list_invalid_properties` method is obsolete'
|
|
147
|
+
invalid_properties = Array.new
|
|
148
|
+
if @criteria_type.nil?
|
|
149
|
+
invalid_properties.push('invalid value for "criteria_type", criteria_type cannot be nil.')
|
|
150
|
+
end
|
|
151
|
+
|
|
152
|
+
if @operator.nil?
|
|
153
|
+
invalid_properties.push('invalid value for "operator", operator cannot be nil.')
|
|
154
|
+
end
|
|
155
|
+
|
|
156
|
+
if @criteria_values.nil?
|
|
157
|
+
invalid_properties.push('invalid value for "criteria_values", criteria_values cannot be nil.')
|
|
158
|
+
end
|
|
159
|
+
|
|
160
|
+
if @criteria_values.length < 1
|
|
161
|
+
invalid_properties.push('invalid value for "criteria_values", number of items must be greater than or equal to 1.')
|
|
162
|
+
end
|
|
163
|
+
|
|
164
|
+
if @criteria_value_types.nil?
|
|
165
|
+
invalid_properties.push('invalid value for "criteria_value_types", criteria_value_types cannot be nil.')
|
|
166
|
+
end
|
|
167
|
+
|
|
168
|
+
if @criteria_value_types.length < 1
|
|
169
|
+
invalid_properties.push('invalid value for "criteria_value_types", number of items must be greater than or equal to 1.')
|
|
170
|
+
end
|
|
171
|
+
|
|
172
|
+
invalid_properties
|
|
173
|
+
end
|
|
174
|
+
|
|
175
|
+
# Check to see if the all the properties in the model are valid
|
|
176
|
+
# @return true if the model is valid
|
|
177
|
+
def valid?
|
|
178
|
+
warn '[DEPRECATED] the `valid?` method is obsolete'
|
|
179
|
+
return false if @criteria_type.nil?
|
|
180
|
+
criteria_type_validator = EnumAttributeValidator.new('String', ["AGE", "GENDER", "OS_TYPE", "DEVICE_PLATFORM", "LOCATION", "PLACEMENT", "OMNI_CHANNEL", "AUDIENCE_LABEL"])
|
|
181
|
+
return false unless criteria_type_validator.valid?(@criteria_type)
|
|
182
|
+
return false if @operator.nil?
|
|
183
|
+
operator_validator = EnumAttributeValidator.new('String', ["CONTAINS"])
|
|
184
|
+
return false unless operator_validator.valid?(@operator)
|
|
185
|
+
return false if @criteria_values.nil?
|
|
186
|
+
return false if @criteria_values.length < 1
|
|
187
|
+
return false if @criteria_value_types.nil?
|
|
188
|
+
return false if @criteria_value_types.length < 1
|
|
189
|
+
true
|
|
190
|
+
end
|
|
191
|
+
|
|
192
|
+
# Custom attribute writer method checking allowed values (enum).
|
|
193
|
+
# @param [Object] criteria_type Object to be assigned
|
|
194
|
+
def criteria_type=(criteria_type)
|
|
195
|
+
validator = EnumAttributeValidator.new('String', ["AGE", "GENDER", "OS_TYPE", "DEVICE_PLATFORM", "LOCATION", "PLACEMENT", "OMNI_CHANNEL", "AUDIENCE_LABEL"])
|
|
196
|
+
unless validator.valid?(criteria_type)
|
|
197
|
+
fail ArgumentError, "invalid value for \"criteria_type\", must be one of #{validator.allowable_values}."
|
|
198
|
+
end
|
|
199
|
+
@criteria_type = criteria_type
|
|
200
|
+
end
|
|
201
|
+
|
|
202
|
+
# Custom attribute writer method checking allowed values (enum).
|
|
203
|
+
# @param [Object] operator Object to be assigned
|
|
204
|
+
def operator=(operator)
|
|
205
|
+
validator = EnumAttributeValidator.new('String', ["CONTAINS"])
|
|
206
|
+
unless validator.valid?(operator)
|
|
207
|
+
fail ArgumentError, "invalid value for \"operator\", must be one of #{validator.allowable_values}."
|
|
208
|
+
end
|
|
209
|
+
@operator = operator
|
|
210
|
+
end
|
|
211
|
+
|
|
212
|
+
# Custom attribute writer method with validation
|
|
213
|
+
# @param [Object] criteria_values Value to be assigned
|
|
214
|
+
def criteria_values=(criteria_values)
|
|
215
|
+
if criteria_values.nil?
|
|
216
|
+
fail ArgumentError, 'criteria_values cannot be nil'
|
|
217
|
+
end
|
|
218
|
+
|
|
219
|
+
if criteria_values.length < 1
|
|
220
|
+
fail ArgumentError, 'invalid value for "criteria_values", number of items must be greater than or equal to 1.'
|
|
221
|
+
end
|
|
222
|
+
|
|
223
|
+
@criteria_values = criteria_values
|
|
224
|
+
end
|
|
225
|
+
|
|
226
|
+
# Custom attribute writer method with validation
|
|
227
|
+
# @param [Object] criteria_value_types Value to be assigned
|
|
228
|
+
def criteria_value_types=(criteria_value_types)
|
|
229
|
+
if criteria_value_types.nil?
|
|
230
|
+
fail ArgumentError, 'criteria_value_types cannot be nil'
|
|
231
|
+
end
|
|
232
|
+
|
|
233
|
+
if criteria_value_types.length < 1
|
|
234
|
+
fail ArgumentError, 'invalid value for "criteria_value_types", number of items must be greater than or equal to 1.'
|
|
235
|
+
end
|
|
236
|
+
|
|
237
|
+
@criteria_value_types = criteria_value_types
|
|
238
|
+
end
|
|
239
|
+
|
|
240
|
+
# Checks equality by comparing each attribute.
|
|
241
|
+
# @param [Object] Object to be compared
|
|
242
|
+
def ==(o)
|
|
243
|
+
return true if self.equal?(o)
|
|
244
|
+
self.class == o.class &&
|
|
245
|
+
id == o.id &&
|
|
246
|
+
criteria_type == o.criteria_type &&
|
|
247
|
+
operator == o.operator &&
|
|
248
|
+
criteria_values == o.criteria_values &&
|
|
249
|
+
criteria_value_types == o.criteria_value_types
|
|
250
|
+
end
|
|
251
|
+
|
|
252
|
+
# @see the `==` method
|
|
253
|
+
# @param [Object] Object to be compared
|
|
254
|
+
def eql?(o)
|
|
255
|
+
self == o
|
|
256
|
+
end
|
|
257
|
+
|
|
258
|
+
# Calculates hash code according to all attributes.
|
|
259
|
+
# @return [Integer] Hash code
|
|
260
|
+
def hash
|
|
261
|
+
[id, criteria_type, operator, criteria_values, criteria_value_types].hash
|
|
262
|
+
end
|
|
263
|
+
|
|
264
|
+
# Builds the object from hash
|
|
265
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
|
266
|
+
# @return [Object] Returns the model itself
|
|
267
|
+
def self.build_from_hash(attributes)
|
|
268
|
+
return nil unless attributes.is_a?(Hash)
|
|
269
|
+
attributes = attributes.transform_keys(&:to_sym)
|
|
270
|
+
transformed_hash = {}
|
|
271
|
+
openapi_types.each_pair do |key, type|
|
|
272
|
+
if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil?
|
|
273
|
+
transformed_hash["#{key}"] = nil
|
|
274
|
+
elsif type =~ /\AArray<(.*)>/i
|
|
275
|
+
# check to ensure the input is an array given that the attribute
|
|
276
|
+
# is documented as an array but the input is not
|
|
277
|
+
if attributes[attribute_map[key]].is_a?(Array)
|
|
278
|
+
transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) }
|
|
279
|
+
end
|
|
280
|
+
elsif !attributes[attribute_map[key]].nil?
|
|
281
|
+
transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]])
|
|
282
|
+
end
|
|
283
|
+
end
|
|
284
|
+
new(transformed_hash)
|
|
285
|
+
end
|
|
286
|
+
|
|
287
|
+
# Returns the object in the form of hash
|
|
288
|
+
# @return [Hash] Returns the object in the form of hash
|
|
289
|
+
def to_hash
|
|
290
|
+
hash = {}
|
|
291
|
+
self.class.attribute_map.each_pair do |attr, param|
|
|
292
|
+
value = self.send(attr)
|
|
293
|
+
if value.nil?
|
|
294
|
+
is_nullable = self.class.openapi_nullable.include?(attr)
|
|
295
|
+
next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
|
|
296
|
+
end
|
|
297
|
+
|
|
298
|
+
hash[param] = _to_hash(value)
|
|
299
|
+
end
|
|
300
|
+
hash
|
|
301
|
+
end
|
|
302
|
+
|
|
303
|
+
end
|
|
304
|
+
|
|
305
|
+
end
|