Class: Zernio::AdTreeCampaign

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

Overview

Campaign with nested ad sets and rolled-up metrics

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 = {}) ⇒ AdTreeCampaign

Initializes the object

Parameters:

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

    Model attributes in the form of hash



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
257
258
259
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
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
# File 'lib/zernio-sdk/models/ad_tree_campaign.rb', line 210

def initialize(attributes = {})
  if (!attributes.is_a?(Hash))
    fail ArgumentError, "The input argument (attributes) must be a hash in `Zernio::AdTreeCampaign` 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::AdTreeCampaign`. 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?(:'platform_campaign_id')
    self.platform_campaign_id = attributes[:'platform_campaign_id']
  end

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

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

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

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

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

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

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

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

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

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

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

  if attributes.key?(:'is_budget_schedule_enabled')
    self.is_budget_schedule_enabled = attributes[:'is_budget_schedule_enabled']
  else
    self.is_budget_schedule_enabled = false
  end

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Instance Attribute Details

#account_idObject

Returns the value of attribute account_id.



62
63
64
# File 'lib/zernio-sdk/models/ad_tree_campaign.rb', line 62

def 
  @account_id
end

#ad_countObject

Total ads across all ad sets



38
39
40
# File 'lib/zernio-sdk/models/ad_tree_campaign.rb', line 38

def ad_count
  @ad_count
end

#ad_set_countObject

Returns the value of attribute ad_set_count.



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

def ad_set_count
  @ad_set_count
end

#ad_setsObject

Returns the value of attribute ad_sets.



85
86
87
# File 'lib/zernio-sdk/models/ad_tree_campaign.rb', line 85

def ad_sets
  @ad_sets
end

#advertising_channel_typeObject

Google-only. Raw campaign.advertising_channel_type (SEARCH, PERFORMANCE_MAX, VIDEO, DEMAND_GEN, DISPLAY, SHOPPING, ...). Serving surface, distinct from platformObjective (advertiser intent). Null/absent for non-Google platforms.



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

def advertising_channel_type
  @advertising_channel_type
end

#bid_amountObject

Representative bid cap for the campaign — bubbled up from the top-spending ad set's bid_amount (whole currency units). Populated when the ad-set bidStrategy is LOWEST_COST_WITH_BID_CAP or COST_CAP.



78
79
80
# File 'lib/zernio-sdk/models/ad_tree_campaign.rb', line 78

def bid_amount
  @bid_amount
end

#bid_strategyObject

Returns the value of attribute bid_strategy.



75
76
77
# File 'lib/zernio-sdk/models/ad_tree_campaign.rb', line 75

def bid_strategy
  @bid_strategy
end

#budgetObject

Returns the value of attribute budget.



42
43
44
# File 'lib/zernio-sdk/models/ad_tree_campaign.rb', line 42

def budget
  @budget
end

#budget_levelObject

Canonical CBO/ABO indicator. campaign = CBO (Advantage Campaign Budget, budget lives on the campaign). adset = ABO (budget lives on each ad set). Route budget updates to the matching Meta entity.



47
48
49
# File 'lib/zernio-sdk/models/ad_tree_campaign.rb', line 47

def budget_level
  @budget_level
end

#campaign_budgetObject

Returns the value of attribute campaign_budget.



44
45
46
# File 'lib/zernio-sdk/models/ad_tree_campaign.rb', line 44

def campaign_budget
  @campaign_budget
end

#campaign_issues_infoObject

Platform-reported campaign issues (Meta issues_info[]). Populated only when the platform has delivery issues to report; contains the specific error codes and messages.



35
36
37
# File 'lib/zernio-sdk/models/ad_tree_campaign.rb', line 35

def campaign_issues_info
  @campaign_issues_info
end

#campaign_nameObject

Returns the value of attribute campaign_name.



23
24
25
# File 'lib/zernio-sdk/models/ad_tree_campaign.rb', line 23

def campaign_name
  @campaign_name
end

#currencyObject

ISO 4217 currency code (e.g. USD, EUR, CLP, JPY) for all budget amounts in this campaign node. Budgets are NOT normalized to USD.



53
54
55
# File 'lib/zernio-sdk/models/ad_tree_campaign.rb', line 53

def currency
  @currency
end

#dailyObject

Per-day metric series for this campaign. Present only when GET /v1/ads/tree is called with timeIncrement=1 (any dailyLevel). This is the per-campaign daily trend — summing its additive fields reproduces the campaign metrics total.



88
89
90
# File 'lib/zernio-sdk/models/ad_tree_campaign.rb', line 88

def daily
  @daily
end

#is_budget_schedule_enabledObject

Meta-only. Mirrors Campaign.is_budget_schedule_enabled — true when the campaign uses budget scheduling (time-based budget changes). Independent of CBO/ABO.



50
51
52
# File 'lib/zernio-sdk/models/ad_tree_campaign.rb', line 50

def is_budget_schedule_enabled
  @is_budget_schedule_enabled
end

#metricsObject

Returns the value of attribute metrics.



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

def metrics
  @metrics
end

#optimization_goalObject

Meta optimization goal shared across ad sets, or comma-separated values when ad sets differ (e.g. OFFSITE_CONVERSIONS, VALUE, LEAD_GENERATION)



73
74
75
# File 'lib/zernio-sdk/models/ad_tree_campaign.rb', line 73

def optimization_goal
  @optimization_goal
end

#platformObject

Returns the value of attribute platform.



21
22
23
# File 'lib/zernio-sdk/models/ad_tree_campaign.rb', line 21

def platform
  @platform
end

#platform_ad_account_idObject

Returns the value of attribute platform_ad_account_id.



57
58
59
# File 'lib/zernio-sdk/models/ad_tree_campaign.rb', line 57

def 
  @platform_ad_account_id
end

#platform_ad_account_nameObject

Human-readable advertiser/account name from the platform. Refreshed on every sync.



60
61
62
# File 'lib/zernio-sdk/models/ad_tree_campaign.rb', line 60

def 
  @platform_ad_account_name
end

#platform_campaign_idObject

Returns the value of attribute platform_campaign_id.



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

def platform_campaign_id
  @platform_campaign_id
end

#platform_campaign_statusObject

Raw platform-level campaign status (Meta effective_status: ACTIVE, PAUSED, DELETED, ARCHIVED, IN_PROCESS, WITH_ISSUES). Distinct from per-ad platformStatus.



32
33
34
# File 'lib/zernio-sdk/models/ad_tree_campaign.rb', line 32

def platform_campaign_status
  @platform_campaign_status
end

#platform_objectiveObject

Raw Meta campaign objective (e.g. OUTCOME_SALES, OUTCOME_LEADS, OUTCOME_TRAFFIC)



70
71
72
# File 'lib/zernio-sdk/models/ad_tree_campaign.rb', line 70

def platform_objective
  @platform_objective
end

#profile_idObject

Returns the value of attribute profile_id.



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

def profile_id
  @profile_id
end

Returns the value of attribute promoted_object.



83
84
85
# File 'lib/zernio-sdk/models/ad_tree_campaign.rb', line 83

def promoted_object
  @promoted_object
end

#review_statusObject

Platform-side review state of the campaign. Independent of the children-derived delivery status: a campaign can have ads already active (status=active) while the campaign itself is still being reviewed by the platform (reviewStatus=in_review). For Meta, derived from effective_status + issues_info on the Campaign, plus ad-level PENDING_REVIEW rollup.



29
30
31
# File 'lib/zernio-sdk/models/ad_tree_campaign.rb', line 29

def review_status
  @review_status
end

#roas_average_floorObject

Representative ROAS floor for the campaign — bubbled up from the top-spending ad set. Decimal multiplier (2.0 = 2.0x).



81
82
83
# File 'lib/zernio-sdk/models/ad_tree_campaign.rb', line 81

def roas_average_floor
  @roas_average_floor
end

#statusObject

Delivery status derived from child ad statuses. Distinct from reviewStatus, which reflects the platform-side review state.



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

def status
  @status
end

Class Method Details

.acceptable_attribute_mapObject

Returns attribute mapping this model knows about



147
148
149
# File 'lib/zernio-sdk/models/ad_tree_campaign.rb', line 147

def self.acceptable_attribute_map
  attribute_map
end

.acceptable_attributesObject

Returns all the JSON keys this model knows about



152
153
154
# File 'lib/zernio-sdk/models/ad_tree_campaign.rb', line 152

def self.acceptable_attributes
  acceptable_attribute_map.values
end

.attribute_mapObject

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



113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
# File 'lib/zernio-sdk/models/ad_tree_campaign.rb', line 113

def self.attribute_map
  {
    :'platform_campaign_id' => :'platformCampaignId',
    :'platform' => :'platform',
    :'campaign_name' => :'campaignName',
    :'status' => :'status',
    :'review_status' => :'reviewStatus',
    :'platform_campaign_status' => :'platformCampaignStatus',
    :'campaign_issues_info' => :'campaignIssuesInfo',
    :'ad_count' => :'adCount',
    :'ad_set_count' => :'adSetCount',
    :'budget' => :'budget',
    :'campaign_budget' => :'campaignBudget',
    :'budget_level' => :'budgetLevel',
    :'is_budget_schedule_enabled' => :'isBudgetScheduleEnabled',
    :'currency' => :'currency',
    :'metrics' => :'metrics',
    :'platform_ad_account_id' => :'platformAdAccountId',
    :'platform_ad_account_name' => :'platformAdAccountName',
    :'account_id' => :'accountId',
    :'profile_id' => :'profileId',
    :'advertising_channel_type' => :'advertisingChannelType',
    :'platform_objective' => :'platformObjective',
    :'optimization_goal' => :'optimizationGoal',
    :'bid_strategy' => :'bidStrategy',
    :'bid_amount' => :'bidAmount',
    :'roas_average_floor' => :'roasAverageFloor',
    :'promoted_object' => :'promotedObject',
    :'ad_sets' => :'adSets',
    :'daily' => :'daily'
  }
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



446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
# File 'lib/zernio-sdk/models/ad_tree_campaign.rb', line 446

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



191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
# File 'lib/zernio-sdk/models/ad_tree_campaign.rb', line 191

def self.openapi_nullable
  Set.new([
    :'review_status',
    :'platform_campaign_status',
    :'campaign_issues_info',
    :'budget_level',
    :'currency',
    :'platform_ad_account_name',
    :'advertising_channel_type',
    :'platform_objective',
    :'optimization_goal',
    :'bid_strategy',
    :'bid_amount',
    :'roas_average_floor',
  ])
end

.openapi_typesObject

Attribute type mapping.



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
# File 'lib/zernio-sdk/models/ad_tree_campaign.rb', line 157

def self.openapi_types
  {
    :'platform_campaign_id' => :'String',
    :'platform' => :'String',
    :'campaign_name' => :'String',
    :'status' => :'AdStatus',
    :'review_status' => :'String',
    :'platform_campaign_status' => :'String',
    :'campaign_issues_info' => :'Array<Object>',
    :'ad_count' => :'Integer',
    :'ad_set_count' => :'Integer',
    :'budget' => :'AdTreeCampaignBudget',
    :'campaign_budget' => :'AdTreeCampaignCampaignBudget',
    :'budget_level' => :'String',
    :'is_budget_schedule_enabled' => :'Boolean',
    :'currency' => :'String',
    :'metrics' => :'AdMetrics',
    :'platform_ad_account_id' => :'String',
    :'platform_ad_account_name' => :'String',
    :'account_id' => :'String',
    :'profile_id' => :'String',
    :'advertising_channel_type' => :'String',
    :'platform_objective' => :'String',
    :'optimization_goal' => :'String',
    :'bid_strategy' => :'BidStrategy',
    :'bid_amount' => :'Float',
    :'roas_average_floor' => :'Float',
    :'promoted_object' => :'AdTreeCampaignPromotedObject',
    :'ad_sets' => :'Array<AdTreeAdSet>',
    :'daily' => :'Array<AdDailyMetrics>'
  }
end

Instance Method Details

#==(o) ⇒ Object

Checks equality by comparing each attribute.

Parameters:

  • Object (Object)

    to be compared



398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
# File 'lib/zernio-sdk/models/ad_tree_campaign.rb', line 398

def ==(o)
  return true if self.equal?(o)
  self.class == o.class &&
      platform_campaign_id == o.platform_campaign_id &&
      platform == o.platform &&
      campaign_name == o.campaign_name &&
      status == o.status &&
      review_status == o.review_status &&
      platform_campaign_status == o.platform_campaign_status &&
      campaign_issues_info == o.campaign_issues_info &&
      ad_count == o.ad_count &&
      ad_set_count == o.ad_set_count &&
      budget == o.budget &&
      campaign_budget == o.campaign_budget &&
      budget_level == o.budget_level &&
      is_budget_schedule_enabled == o.is_budget_schedule_enabled &&
      currency == o.currency &&
      metrics == o.metrics &&
       == o. &&
       == o. &&
       == o. &&
      profile_id == o.profile_id &&
      advertising_channel_type == o.advertising_channel_type &&
      platform_objective == o.platform_objective &&
      optimization_goal == o.optimization_goal &&
      bid_strategy == o.bid_strategy &&
      bid_amount == o.bid_amount &&
      roas_average_floor == o.roas_average_floor &&
      promoted_object == o.promoted_object &&
      ad_sets == o.ad_sets &&
      daily == o.daily
end

#eql?(o) ⇒ Boolean

Parameters:

  • Object (Object)

    to be compared

Returns:

  • (Boolean)

See Also:

  • `==` method


433
434
435
# File 'lib/zernio-sdk/models/ad_tree_campaign.rb', line 433

def eql?(o)
  self == o
end

#hashInteger

Calculates hash code according to all attributes.

Returns:

  • (Integer)

    Hash code



439
440
441
# File 'lib/zernio-sdk/models/ad_tree_campaign.rb', line 439

def hash
  [platform_campaign_id, platform, campaign_name, status, review_status, platform_campaign_status, campaign_issues_info, ad_count, ad_set_count, budget, campaign_budget, budget_level, is_budget_schedule_enabled, currency, metrics, , , , profile_id, advertising_channel_type, platform_objective, optimization_goal, bid_strategy, bid_amount, roas_average_floor, promoted_object, ad_sets, daily].hash
end

#list_invalid_propertiesObject

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

Returns:

  • Array for valid properties with the reasons



347
348
349
350
351
# File 'lib/zernio-sdk/models/ad_tree_campaign.rb', line 347

def list_invalid_properties
  warn '[DEPRECATED] the `list_invalid_properties` method is obsolete'
  invalid_properties = Array.new
  invalid_properties
end

#to_hashHash

Returns the object in the form of hash

Returns:

  • (Hash)

    Returns the object in the form of hash



468
469
470
471
472
473
474
475
476
477
478
479
480
# File 'lib/zernio-sdk/models/ad_tree_campaign.rb', line 468

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



355
356
357
358
359
360
361
362
363
364
# File 'lib/zernio-sdk/models/ad_tree_campaign.rb', line 355

def valid?
  warn '[DEPRECATED] the `valid?` method is obsolete'
  platform_validator = EnumAttributeValidator.new('String', ["facebook", "instagram", "tiktok", "linkedin", "pinterest", "google", "twitter"])
  return false unless platform_validator.valid?(@platform)
  review_status_validator = EnumAttributeValidator.new('String', ["in_review", "approved", "rejected", "with_issues"])
  return false unless review_status_validator.valid?(@review_status)
  budget_level_validator = EnumAttributeValidator.new('String', ["campaign", "adset"])
  return false unless budget_level_validator.valid?(@budget_level)
  true
end