Class: Zernio::AdCampaign

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

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

Initializes the object

Parameters:

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

    Model attributes in the form of hash



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

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

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

Instance Attribute Details

#account_idObject

Returns the value of attribute account_id.



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

def 
  @account_id
end

#ad_countObject

Returns the value of attribute ad_count.



36
37
38
# File 'lib/zernio-sdk/models/ad_campaign.rb', line 36

def ad_count
  @ad_count
end

#advertising_channel_typeObject

Google-only. Raw campaign.advertising_channel_type. See AdTreeCampaign.advertisingChannelType.



63
64
65
# File 'lib/zernio-sdk/models/ad_campaign.rb', line 63

def advertising_channel_type
  @advertising_channel_type
end

#bid_amountObject

Representative bid cap from the top-spending ad set (whole currency units). Populated when bidStrategy is LOWEST_COST_WITH_BID_CAP or COST_CAP.



74
75
76
# File 'lib/zernio-sdk/models/ad_campaign.rb', line 74

def bid_amount
  @bid_amount
end

#bid_strategyObject

Returns the value of attribute bid_strategy.



71
72
73
# File 'lib/zernio-sdk/models/ad_campaign.rb', line 71

def bid_strategy
  @bid_strategy
end

#budgetObject

Returns the value of attribute budget.



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

def budget
  @budget
end

#budget_levelObject

Canonical CBO/ABO indicator. See AdTreeCampaign.budgetLevel.



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

def budget_level
  @budget_level
end

#campaign_budgetObject

Returns the value of attribute campaign_budget.



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

def campaign_budget
  @campaign_budget
end

#campaign_issues_infoObject

Platform-reported campaign issues (Meta issues_info[]).



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

def campaign_issues_info
  @campaign_issues_info
end

#campaign_nameObject

Returns the value of attribute campaign_name.



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

def campaign_name
  @campaign_name
end

#currencyObject

ISO 4217 currency code for all budget amounts. Budgets are NOT normalized to USD.



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

def currency
  @currency
end

#earliest_adObject

Returns the value of attribute earliest_ad.



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

def earliest_ad
  @earliest_ad
end

#is_budget_schedule_enabledObject

Meta-only. Mirrors Campaign.is_budget_schedule_enabled.



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

def is_budget_schedule_enabled
  @is_budget_schedule_enabled
end

#latest_adObject

Returns the value of attribute latest_ad.



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

def latest_ad
  @latest_ad
end

#metricsObject

Returns the value of attribute metrics.



51
52
53
# File 'lib/zernio-sdk/models/ad_campaign.rb', line 51

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)



69
70
71
# File 'lib/zernio-sdk/models/ad_campaign.rb', line 69

def optimization_goal
  @optimization_goal
end

#platformObject

Returns the value of attribute platform.



20
21
22
# File 'lib/zernio-sdk/models/ad_campaign.rb', line 20

def platform
  @platform
end

#platform_ad_account_idObject

Returns the value of attribute platform_ad_account_id.



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

def 
  @platform_ad_account_id
end

#platform_ad_account_nameObject

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



56
57
58
# File 'lib/zernio-sdk/models/ad_campaign.rb', line 56

def 
  @platform_ad_account_name
end

#platform_campaign_idObject

Returns the value of attribute platform_campaign_id.



18
19
20
# File 'lib/zernio-sdk/models/ad_campaign.rb', line 18

def platform_campaign_id
  @platform_campaign_id
end

#platform_campaign_statusObject

Raw platform-level campaign status (Meta effective_status).



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

def platform_campaign_status
  @platform_campaign_status
end

#platform_objectiveObject

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



66
67
68
# File 'lib/zernio-sdk/models/ad_campaign.rb', line 66

def platform_objective
  @platform_objective
end

#profile_idObject

Returns the value of attribute profile_id.



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

def profile_id
  @profile_id
end

Returns the value of attribute promoted_object.



79
80
81
# File 'lib/zernio-sdk/models/ad_campaign.rb', line 79

def promoted_object
  @promoted_object
end

#review_statusObject

Platform-side review state of the campaign. See AdTreeCampaign.reviewStatus for the full description.



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

def review_status
  @review_status
end

#roas_average_floorObject

Representative ROAS floor from the top-spending ad set. Decimal multiplier (2.0 = 2.0x).



77
78
79
# File 'lib/zernio-sdk/models/ad_campaign.rb', line 77

def roas_average_floor
  @roas_average_floor
end

#statusObject

Delivery status derived from child ad statuses. Distinct from reviewStatus.



25
26
27
# File 'lib/zernio-sdk/models/ad_campaign.rb', line 25

def status
  @status
end

Class Method Details

.acceptable_attribute_mapObject

Returns attribute mapping this model knows about



141
142
143
# File 'lib/zernio-sdk/models/ad_campaign.rb', line 141

def self.acceptable_attribute_map
  attribute_map
end

.acceptable_attributesObject

Returns all the JSON keys this model knows about



146
147
148
# File 'lib/zernio-sdk/models/ad_campaign.rb', line 146

def self.acceptable_attributes
  acceptable_attribute_map.values
end

.attribute_mapObject

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



108
109
110
111
112
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
# File 'lib/zernio-sdk/models/ad_campaign.rb', line 108

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',
    :'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',
    :'earliest_ad' => :'earliestAd',
    :'latest_ad' => :'latestAd'
  }
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



430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
# File 'lib/zernio-sdk/models/ad_campaign.rb', line 430

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



184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
# File 'lib/zernio-sdk/models/ad_campaign.rb', line 184

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.



151
152
153
154
155
156
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
# File 'lib/zernio-sdk/models/ad_campaign.rb', line 151

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',
    :'budget' => :'AdCampaignBudget',
    :'campaign_budget' => :'AdCampaignCampaignBudget',
    :'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',
    :'earliest_ad' => :'Time',
    :'latest_ad' => :'Time'
  }
end

Instance Method Details

#==(o) ⇒ Object

Checks equality by comparing each attribute.

Parameters:

  • Object (Object)

    to be compared



383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
# File 'lib/zernio-sdk/models/ad_campaign.rb', line 383

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 &&
      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 &&
      earliest_ad == o.earliest_ad &&
      latest_ad == o.latest_ad
end

#eql?(o) ⇒ Boolean

Parameters:

  • Object (Object)

    to be compared

Returns:

  • (Boolean)

See Also:

  • `==` method


417
418
419
# File 'lib/zernio-sdk/models/ad_campaign.rb', line 417

def eql?(o)
  self == o
end

#hashInteger

Calculates hash code according to all attributes.

Returns:

  • (Integer)

    Hash code



423
424
425
# File 'lib/zernio-sdk/models/ad_campaign.rb', line 423

def hash
  [platform_campaign_id, platform, campaign_name, status, review_status, platform_campaign_status, campaign_issues_info, ad_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, earliest_ad, latest_ad].hash
end

#list_invalid_propertiesObject

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

Returns:

  • Array for valid properties with the reasons



332
333
334
335
336
# File 'lib/zernio-sdk/models/ad_campaign.rb', line 332

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



452
453
454
455
456
457
458
459
460
461
462
463
464
# File 'lib/zernio-sdk/models/ad_campaign.rb', line 452

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



340
341
342
343
344
345
346
347
348
349
# File 'lib/zernio-sdk/models/ad_campaign.rb', line 340

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