Class: Zernio::UploadedOrDerivedAudience

Inherits:
ApiModelBase show all
Defined in:
lib/zernio-sdk/models/uploaded_or_derived_audience.rb

Overview

customer_list, website, or lookalike audience (uploaded or derived from a source).

Defined Under Namespace

Classes: EnumAttributeValidator

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from ApiModelBase

_deserialize, #_to_hash, #to_body, #to_s

Constructor Details

#initialize(attributes = {}) ⇒ UploadedOrDerivedAudience

Initializes the object

Parameters:

  • attributes (Hash) (defaults to: {})

    Model attributes in the form of hash



157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
# File 'lib/zernio-sdk/models/uploaded_or_derived_audience.rb', line 157

def initialize(attributes = {})
  if (!attributes.is_a?(Hash))
    fail ArgumentError, "The input argument (attributes) must be a hash in `Zernio::UploadedOrDerivedAudience` initialize method"
  end

  # check to see if the attribute exists and convert string to symbol for hash key
  acceptable_attribute_map = self.class.acceptable_attribute_map
  attributes = attributes.each_with_object({}) { |(k, v), h|
    if (!acceptable_attribute_map.key?(k.to_sym))
      fail ArgumentError, "`#{k}` is not a valid attribute in `Zernio::UploadedOrDerivedAudience`. Please check the name to make sure it's valid. List of attributes: " + acceptable_attribute_map.keys.inspect
    end
    h[k.to_sym] = v
  }

  if attributes.key?(:'account_id')
    self. = attributes[:'account_id']
  else
    self. = nil
  end

  if attributes.key?(:'ad_account_id')
    self. = attributes[:'ad_account_id']
  else
    self. = nil
  end

  if attributes.key?(:'name')
    self.name = attributes[:'name']
  else
    self.name = nil
  end

  if attributes.key?(:'description')
    self.description = attributes[:'description']
  end

  if attributes.key?(:'type')
    self.type = attributes[:'type']
  else
    self.type = nil
  end

  if attributes.key?(:'match_rules')
    if (value = attributes[:'match_rules']).is_a?(Array)
      self.match_rules = value
    end
  end

  if attributes.key?(:'source_type')
    self.source_type = attributes[:'source_type']
  end

  if attributes.key?(:'trigger')
    self.trigger = attributes[:'trigger']
  end

  if attributes.key?(:'lookback_days')
    self.lookback_days = attributes[:'lookback_days']
  end

  if attributes.key?(:'engagement_sources')
    if (value = attributes[:'engagement_sources']).is_a?(Array)
      self.engagement_sources = value
    end
  end

  if attributes.key?(:'companies')
    if (value = attributes[:'companies']).is_a?(Array)
      self.companies = value
    end
  end

  if attributes.key?(:'pixel_id')
    self.pixel_id = attributes[:'pixel_id']
  end

  if attributes.key?(:'retention_days')
    self.retention_days = attributes[:'retention_days']
  end

  if attributes.key?(:'source_audience_id')
    self.source_audience_id = attributes[:'source_audience_id']
  end

  if attributes.key?(:'country')
    self.country = attributes[:'country']
  end

  if attributes.key?(:'ratio')
    self.ratio = attributes[:'ratio']
  end

  if attributes.key?(:'rule')
    self.rule = attributes[:'rule']
  end

  if attributes.key?(:'customer_file_source')
    self.customer_file_source = attributes[:'customer_file_source']
  end
end

Instance Attribute Details

#account_idObject

Returns the value of attribute account_id.



19
20
21
# File 'lib/zernio-sdk/models/uploaded_or_derived_audience.rb', line 19

def 
  @account_id
end

#ad_account_idObject

Platform ad account ID. Must start with act_ for Meta; bare platform id for others (Google customer id, X/TikTok/LinkedIn/Pinterest account id).



22
23
24
# File 'lib/zernio-sdk/models/uploaded_or_derived_audience.rb', line 22

def 
  @ad_account_id
end

#companiesObject

Required for company_list audiences (LinkedIn only): plain-text company rows for account targeting. Each row needs at least one identifier. LinkedIn recommends 1,000+ companies for a usable match rate and takes up to 48h to process the list.



46
47
48
# File 'lib/zernio-sdk/models/uploaded_or_derived_audience.rb', line 46

def companies
  @companies
end

#countryObject

2-letter code, required for lookalike audiences



58
59
60
# File 'lib/zernio-sdk/models/uploaded_or_derived_audience.rb', line 58

def country
  @country
end

#customer_file_sourceObject

Data source declaration for GDPR compliance (customer_list only)



67
68
69
# File 'lib/zernio-sdk/models/uploaded_or_derived_audience.rb', line 67

def customer_file_source
  @customer_file_source
end

#descriptionObject

Returns the value of attribute description.



26
27
28
# File 'lib/zernio-sdk/models/uploaded_or_derived_audience.rb', line 26

def description
  @description
end

#engagement_sourcesObject

Required for engagement audiences. Campaign URNs for the ad source types, organization URNs for pages and events. LinkedIn creates one rule per source, all sharing the same trigger and lookbackDays.



43
44
45
# File 'lib/zernio-sdk/models/uploaded_or_derived_audience.rb', line 43

def engagement_sources
  @engagement_sources
end

#lookback_daysObject

Required for engagement audiences. Rolling window.



40
41
42
# File 'lib/zernio-sdk/models/uploaded_or_derived_audience.rb', line 40

def lookback_days
  @lookback_days
end

#match_rulesObject

Required for website_retargeting audiences (LinkedIn only). Each rule is a URL pattern; a member who visits any matching page enters the segment. Needs the LinkedIn Insight Tag installed on the customer's site — the segment only starts filling once the tag reports visits. The response's platformAudienceId is the LinkedIn adSegment id, valid for downstream use. These segments appear in GET /v1/ads/audiences with type: website_retargeting once LinkedIn has finished building them.



31
32
33
# File 'lib/zernio-sdk/models/uploaded_or_derived_audience.rb', line 31

def match_rules
  @match_rules
end

#nameObject

Returns the value of attribute name.



24
25
26
# File 'lib/zernio-sdk/models/uploaded_or_derived_audience.rb', line 24

def name
  @name
end

#pixel_idObject

Required for website audiences



49
50
51
# File 'lib/zernio-sdk/models/uploaded_or_derived_audience.rb', line 49

def pixel_id
  @pixel_id
end

#ratioObject

Required for lookalike audiences



61
62
63
# File 'lib/zernio-sdk/models/uploaded_or_derived_audience.rb', line 61

def ratio
  @ratio
end

#retention_daysObject

Required for website audiences



52
53
54
# File 'lib/zernio-sdk/models/uploaded_or_derived_audience.rb', line 52

def retention_days
  @retention_days
end

#ruleObject

Pixel event rule for website audiences (optional)



64
65
66
# File 'lib/zernio-sdk/models/uploaded_or_derived_audience.rb', line 64

def rule
  @rule
end

#source_audience_idObject

Required for lookalike audiences



55
56
57
# File 'lib/zernio-sdk/models/uploaded_or_derived_audience.rb', line 55

def source_audience_id
  @source_audience_id
end

#source_typeObject

Required for engagement audiences (LinkedIn only): what members engaged with — a video/leadgen/single-image ad campaign, a Company Page or an Event page.



34
35
36
# File 'lib/zernio-sdk/models/uploaded_or_derived_audience.rb', line 34

def source_type
  @source_type
end

#triggerObject

Required for engagement audiences. The action, validated by LinkedIn against sourceType. Common values: VIDEO_ADS FIRST_QUARTILE / MIDPOINT / THIRD_QUARTILE / FULL_COMPLETE; LEAD_GEN_FORMS VIEW_FORM / LEAD_FORM_SUBMIT; ORGANIZATION_PAGES VIEW / CTA_CLICK; EVENT_PAGES RSVPED / VIDEO_VIEWED / ENGAGEMENT / CLICK.



37
38
39
# File 'lib/zernio-sdk/models/uploaded_or_derived_audience.rb', line 37

def trigger
  @trigger
end

#typeObject

Returns the value of attribute type.



28
29
30
# File 'lib/zernio-sdk/models/uploaded_or_derived_audience.rb', line 28

def type
  @type
end

Class Method Details

.acceptable_attribute_mapObject

Returns attribute mapping this model knows about



116
117
118
# File 'lib/zernio-sdk/models/uploaded_or_derived_audience.rb', line 116

def self.acceptable_attribute_map
  attribute_map
end

.acceptable_attributesObject

Returns all the JSON keys this model knows about



121
122
123
# File 'lib/zernio-sdk/models/uploaded_or_derived_audience.rb', line 121

def self.acceptable_attributes
  acceptable_attribute_map.values
end

.attribute_mapObject

Attribute mapping from ruby-style variable name to JSON key.



92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
# File 'lib/zernio-sdk/models/uploaded_or_derived_audience.rb', line 92

def self.attribute_map
  {
    :'account_id' => :'accountId',
    :'ad_account_id' => :'adAccountId',
    :'name' => :'name',
    :'description' => :'description',
    :'type' => :'type',
    :'match_rules' => :'matchRules',
    :'source_type' => :'sourceType',
    :'trigger' => :'trigger',
    :'lookback_days' => :'lookbackDays',
    :'engagement_sources' => :'engagementSources',
    :'companies' => :'companies',
    :'pixel_id' => :'pixelId',
    :'retention_days' => :'retentionDays',
    :'source_audience_id' => :'sourceAudienceId',
    :'country' => :'country',
    :'ratio' => :'ratio',
    :'rule' => :'rule',
    :'customer_file_source' => :'customerFileSource'
  }
end

.build_from_hash(attributes) ⇒ Object

Builds the object from hash

Parameters:

  • attributes (Hash)

    Model attributes in the form of hash

Returns:

  • (Object)

    Returns the model itself



548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
# File 'lib/zernio-sdk/models/uploaded_or_derived_audience.rb', line 548

def self.build_from_hash(attributes)
  return nil unless attributes.is_a?(Hash)
  attributes = attributes.transform_keys(&:to_sym)
  transformed_hash = {}
  openapi_types.each_pair do |key, type|
    if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil?
      transformed_hash["#{key}"] = nil
    elsif type =~ /\AArray<(.*)>/i
      # check to ensure the input is an array given that the attribute
      # is documented as an array but the input is not
      if attributes[attribute_map[key]].is_a?(Array)
        transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) }
      end
    elsif !attributes[attribute_map[key]].nil?
      transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]])
    end
  end
  new(transformed_hash)
end

.openapi_nullableObject

List of attributes with nullable: true



150
151
152
153
# File 'lib/zernio-sdk/models/uploaded_or_derived_audience.rb', line 150

def self.openapi_nullable
  Set.new([
  ])
end

.openapi_typesObject

Attribute type mapping.



126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
# File 'lib/zernio-sdk/models/uploaded_or_derived_audience.rb', line 126

def self.openapi_types
  {
    :'account_id' => :'String',
    :'ad_account_id' => :'String',
    :'name' => :'String',
    :'description' => :'String',
    :'type' => :'String',
    :'match_rules' => :'Array<UploadedOrDerivedAudienceMatchRulesInner>',
    :'source_type' => :'String',
    :'trigger' => :'String',
    :'lookback_days' => :'Integer',
    :'engagement_sources' => :'Array<String>',
    :'companies' => :'Array<UploadedOrDerivedAudienceCompaniesInner>',
    :'pixel_id' => :'String',
    :'retention_days' => :'Integer',
    :'source_audience_id' => :'String',
    :'country' => :'String',
    :'ratio' => :'Float',
    :'rule' => :'Object',
    :'customer_file_source' => :'String'
  }
end

Instance Method Details

#==(o) ⇒ Object

Checks equality by comparing each attribute.

Parameters:

  • Object (Object)

    to be compared



510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
# File 'lib/zernio-sdk/models/uploaded_or_derived_audience.rb', line 510

def ==(o)
  return true if self.equal?(o)
  self.class == o.class &&
       == o. &&
       == o. &&
      name == o.name &&
      description == o.description &&
      type == o.type &&
      match_rules == o.match_rules &&
      source_type == o.source_type &&
      trigger == o.trigger &&
      lookback_days == o.lookback_days &&
      engagement_sources == o.engagement_sources &&
      companies == o.companies &&
      pixel_id == o.pixel_id &&
      retention_days == o.retention_days &&
      source_audience_id == o.source_audience_id &&
      country == o.country &&
      ratio == o.ratio &&
      rule == o.rule &&
      customer_file_source == o.customer_file_source
end

#eql?(o) ⇒ Boolean

Parameters:

  • Object (Object)

    to be compared

Returns:

  • (Boolean)

See Also:

  • `==` method


535
536
537
# File 'lib/zernio-sdk/models/uploaded_or_derived_audience.rb', line 535

def eql?(o)
  self == o
end

#hashInteger

Calculates hash code according to all attributes.

Returns:

  • (Integer)

    Hash code



541
542
543
# File 'lib/zernio-sdk/models/uploaded_or_derived_audience.rb', line 541

def hash
  [, , name, description, type, match_rules, source_type, trigger, lookback_days, engagement_sources, companies, pixel_id, retention_days, source_audience_id, country, ratio, rule, customer_file_source].hash
end

#list_invalid_propertiesObject

Show invalid properties with the reasons. Usually used together with valid?

Returns:

  • Array for valid properties with the reasons



260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
# File 'lib/zernio-sdk/models/uploaded_or_derived_audience.rb', line 260

def list_invalid_properties
  warn '[DEPRECATED] the `list_invalid_properties` method is obsolete'
  invalid_properties = Array.new
  if @account_id.nil?
    invalid_properties.push('invalid value for "account_id", account_id cannot be nil.')
  end

  if @ad_account_id.nil?
    invalid_properties.push('invalid value for "ad_account_id", ad_account_id cannot be nil.')
  end

  if @name.nil?
    invalid_properties.push('invalid value for "name", name cannot be nil.')
  end

  if @name.to_s.length > 255
    invalid_properties.push('invalid value for "name", the character length must be smaller than or equal to 255.')
  end

  if @type.nil?
    invalid_properties.push('invalid value for "type", type cannot be nil.')
  end

  if !@match_rules.nil? && @match_rules.length > 50
    invalid_properties.push('invalid value for "match_rules", number of items must be less than or equal to 50.')
  end

  if !@match_rules.nil? && @match_rules.length < 1
    invalid_properties.push('invalid value for "match_rules", number of items must be greater than or equal to 1.')
  end

  if !@engagement_sources.nil? && @engagement_sources.length > 50
    invalid_properties.push('invalid value for "engagement_sources", number of items must be less than or equal to 50.')
  end

  if !@engagement_sources.nil? && @engagement_sources.length < 1
    invalid_properties.push('invalid value for "engagement_sources", number of items must be greater than or equal to 1.')
  end

  if !@companies.nil? && @companies.length > 300000
    invalid_properties.push('invalid value for "companies", number of items must be less than or equal to 300000.')
  end

  if !@companies.nil? && @companies.length < 1
    invalid_properties.push('invalid value for "companies", number of items must be greater than or equal to 1.')
  end

  if !@retention_days.nil? && @retention_days > 180
    invalid_properties.push('invalid value for "retention_days", must be smaller than or equal to 180.')
  end

  if !@retention_days.nil? && @retention_days < 1
    invalid_properties.push('invalid value for "retention_days", must be greater than or equal to 1.')
  end

  if !@ratio.nil? && @ratio > 0.2
    invalid_properties.push('invalid value for "ratio", must be smaller than or equal to 0.2.')
  end

  if !@ratio.nil? && @ratio < 0.01
    invalid_properties.push('invalid value for "ratio", must be greater than or equal to 0.01.')
  end

  invalid_properties
end

#to_hashHash

Returns the object in the form of hash

Returns:

  • (Hash)

    Returns the object in the form of hash



570
571
572
573
574
575
576
577
578
579
580
581
582
# File 'lib/zernio-sdk/models/uploaded_or_derived_audience.rb', line 570

def to_hash
  hash = {}
  self.class.attribute_map.each_pair do |attr, param|
    value = self.send(attr)
    if value.nil?
      is_nullable = self.class.openapi_nullable.include?(attr)
      next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
    end

    hash[param] = _to_hash(value)
  end
  hash
end

#valid?Boolean

Check to see if the all the properties in the model are valid

Returns:

  • (Boolean)

    true if the model is valid



328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
# File 'lib/zernio-sdk/models/uploaded_or_derived_audience.rb', line 328

def valid?
  warn '[DEPRECATED] the `valid?` method is obsolete'
  return false if @account_id.nil?
  return false if @ad_account_id.nil?
  return false if @name.nil?
  return false if @name.to_s.length > 255
  return false if @type.nil?
  type_validator = EnumAttributeValidator.new('String', ["customer_list", "company_list", "engagement", "website", "website_retargeting", "lookalike"])
  return false unless type_validator.valid?(@type)
  return false if !@match_rules.nil? && @match_rules.length > 50
  return false if !@match_rules.nil? && @match_rules.length < 1
  source_type_validator = EnumAttributeValidator.new('String', ["VIDEO_ADS", "LEAD_GEN_FORMS", "ORGANIZATION_PAGES", "EVENT_PAGES", "SINGLE_IMAGE_ADS"])
  return false unless source_type_validator.valid?(@source_type)
  lookback_days_validator = EnumAttributeValidator.new('Integer', [30, 60, 90, 180, 365])
  return false unless lookback_days_validator.valid?(@lookback_days)
  return false if !@engagement_sources.nil? && @engagement_sources.length > 50
  return false if !@engagement_sources.nil? && @engagement_sources.length < 1
  return false if !@companies.nil? && @companies.length > 300000
  return false if !@companies.nil? && @companies.length < 1
  return false if !@retention_days.nil? && @retention_days > 180
  return false if !@retention_days.nil? && @retention_days < 1
  return false if !@ratio.nil? && @ratio > 0.2
  return false if !@ratio.nil? && @ratio < 0.01
  true
end