Class: Zernio::AdTreeAdSet

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

Overview

Ad set (or ad group/line item depending on platform) with rolled-up metrics and child ads

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

Initializes the object

Parameters:

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

    Model attributes in the form of hash



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

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

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

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

  if attributes.key?(:'created_time')
    self.created_time = attributes[:'created_time']
  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?(:'ad_set_budget')
    self.ad_set_budget = attributes[:'ad_set_budget']
  end

  if attributes.key?(:'metrics')
    self.metrics = attributes[:'metrics']
  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?(:'cost_type')
    self.cost_type = attributes[:'cost_type']
  end

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

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

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

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

Instance Attribute Details

#ad_countObject

Returns the value of attribute ad_count.



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

def ad_count
  @ad_count
end

#ad_set_budgetObject

Returns the value of attribute ad_set_budget.



33
34
35
# File 'lib/zernio-sdk/models/ad_tree_ad_set.rb', line 33

def ad_set_budget
  @ad_set_budget
end

#ad_set_nameObject

Returns the value of attribute ad_set_name.



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

def ad_set_name
  @ad_set_name
end

#adsObject

Individual ads within this ad set (capped at 100). Returns a subset of Ad fields from the aggregation: _id, name, platform, status, configuredStatus, reviewStatus, budget, metrics, creative, goal and the platform* ids are always included; targeting and schedule may be absent. configuredStatus (the ad's own on/off toggle) and reviewStatus (the platform's review verdict) are part of this contract, not incidental: a rejected ad is only distinguishable from a healthy one through reviewStatus. When timeIncrement=1&dailyLevel=ad, each entry also carries a daily[] array of AdDailyMetrics.



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

def ads
  @ads
end

#bid_amountObject

Bid amount in whole currency units. On Meta/TikTok populated when bidStrategy is LOWEST_COST_WITH_BID_CAP or COST_CAP; on LinkedIn it is the campaign's effective unitCost and pairs with costType, where 0 is a real, delivery-stopping value.



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

def bid_amount
  @bid_amount
end

#bid_strategyObject

Returns the value of attribute bid_strategy.



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

def bid_strategy
  @bid_strategy
end

#budgetObject

Returns the value of attribute budget.



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

def budget
  @budget
end

#cost_typeObject

LinkedIn only. Effective cost model (billing event) of the LinkedIn campaign backing this ad set: CPM, CPC or CPV. Null for non-LinkedIn ad sets.



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

def cost_type
  @cost_type
end

#created_timeObject

Earliest platformCreatedAt (platform ad creation time; falls back to createdAt, Zernio's sync time, for ads synced before that field existed) across this ad set's ads. Not the ad set's own creation time on the platform — a proxy usable for sorting.



27
28
29
# File 'lib/zernio-sdk/models/ad_tree_ad_set.rb', line 27

def created_time
  @created_time
end

#dailyObject

Per-day metric series for this ad set. Present only when GET /v1/ads/tree is called with timeIncrement=1 and dailyLevel is adset or ad.



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

def daily
  @daily
end

#metricsObject

Returns the value of attribute metrics.



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

def metrics
  @metrics
end

#optimization_goalObject

What the delivery system optimizes for. Meta ad set optimization goal (e.g. OFFSITE_CONVERSIONS, VALUE, LEAD_GENERATION), or on LinkedIn the campaign's effective optimizationTargetType (NONE means manual bidding). See the optimizationGoal field on Ad for the full value spaces.



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

def optimization_goal
  @optimization_goal
end

#platform_ad_set_idObject

Returns the value of attribute platform_ad_set_id.



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

def platform_ad_set_id
  @platform_ad_set_id
end

Returns the value of attribute promoted_object.



54
55
56
# File 'lib/zernio-sdk/models/ad_tree_ad_set.rb', line 54

def promoted_object
  @promoted_object
end

#roas_average_floorObject

Minimum ROAS as a decimal multiplier (2.0 = 2.0x). Populated when bidStrategy is LOWEST_COST_WITH_MIN_ROAS.



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

def roas_average_floor
  @roas_average_floor
end

#serving_statusesObject

LinkedIn only. Why the LinkedIn campaign backing this ad set is (or is not) delivering. A LinkedIn Campaign maps to this ad-set node, so this is the level where LinkedIn's holds actually apply. Empty means no serving data, ["RUNNABLE"] means eligible to serve, anything else is a hold. See the servingStatuses field on Ad for the known values.



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

def serving_statuses
  @serving_statuses
end

#statusObject

Derived from child ad statuses



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

def status
  @status
end

Class Method Details

.acceptable_attribute_mapObject

Returns attribute mapping this model knows about



108
109
110
# File 'lib/zernio-sdk/models/ad_tree_ad_set.rb', line 108

def self.acceptable_attribute_map
  attribute_map
end

.acceptable_attributesObject

Returns all the JSON keys this model knows about



113
114
115
# File 'lib/zernio-sdk/models/ad_tree_ad_set.rb', line 113

def self.acceptable_attributes
  acceptable_attribute_map.values
end

.attribute_mapObject

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



85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
# File 'lib/zernio-sdk/models/ad_tree_ad_set.rb', line 85

def self.attribute_map
  {
    :'platform_ad_set_id' => :'platformAdSetId',
    :'ad_set_name' => :'adSetName',
    :'status' => :'status',
    :'created_time' => :'createdTime',
    :'ad_count' => :'adCount',
    :'budget' => :'budget',
    :'ad_set_budget' => :'adSetBudget',
    :'metrics' => :'metrics',
    :'optimization_goal' => :'optimizationGoal',
    :'bid_strategy' => :'bidStrategy',
    :'bid_amount' => :'bidAmount',
    :'roas_average_floor' => :'roasAverageFloor',
    :'cost_type' => :'costType',
    :'serving_statuses' => :'servingStatuses',
    :'promoted_object' => :'promotedObject',
    :'ads' => :'ads',
    :'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



297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
# File 'lib/zernio-sdk/models/ad_tree_ad_set.rb', line 297

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



141
142
143
144
145
146
147
148
149
150
# File 'lib/zernio-sdk/models/ad_tree_ad_set.rb', line 141

def self.openapi_nullable
  Set.new([
    :'created_time',
    :'optimization_goal',
    :'bid_strategy',
    :'bid_amount',
    :'roas_average_floor',
    :'cost_type',
  ])
end

.openapi_typesObject

Attribute type mapping.



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_tree_ad_set.rb', line 118

def self.openapi_types
  {
    :'platform_ad_set_id' => :'String',
    :'ad_set_name' => :'String',
    :'status' => :'AdStatus',
    :'created_time' => :'Time',
    :'ad_count' => :'Integer',
    :'budget' => :'AdTreeAdSetBudget',
    :'ad_set_budget' => :'AdTreeAdSetAdSetBudget',
    :'metrics' => :'AdMetrics',
    :'optimization_goal' => :'String',
    :'bid_strategy' => :'BidStrategy',
    :'bid_amount' => :'Float',
    :'roas_average_floor' => :'Float',
    :'cost_type' => :'String',
    :'serving_statuses' => :'Array<String>',
    :'promoted_object' => :'AdTreeAdSetPromotedObject',
    :'ads' => :'Array<Ad>',
    :'daily' => :'Array<AdDailyMetrics>'
  }
end

Instance Method Details

#==(o) ⇒ Object

Checks equality by comparing each attribute.

Parameters:

  • Object (Object)

    to be compared



260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
# File 'lib/zernio-sdk/models/ad_tree_ad_set.rb', line 260

def ==(o)
  return true if self.equal?(o)
  self.class == o.class &&
      platform_ad_set_id == o.platform_ad_set_id &&
      ad_set_name == o.ad_set_name &&
      status == o.status &&
      created_time == o.created_time &&
      ad_count == o.ad_count &&
      budget == o.budget &&
      ad_set_budget == o.ad_set_budget &&
      metrics == o.metrics &&
      optimization_goal == o.optimization_goal &&
      bid_strategy == o.bid_strategy &&
      bid_amount == o.bid_amount &&
      roas_average_floor == o.roas_average_floor &&
      cost_type == o.cost_type &&
      serving_statuses == o.serving_statuses &&
      promoted_object == o.promoted_object &&
      ads == o.ads &&
      daily == o.daily
end

#eql?(o) ⇒ Boolean

Parameters:

  • Object (Object)

    to be compared

Returns:

  • (Boolean)

See Also:

  • `==` method


284
285
286
# File 'lib/zernio-sdk/models/ad_tree_ad_set.rb', line 284

def eql?(o)
  self == o
end

#hashInteger

Calculates hash code according to all attributes.

Returns:

  • (Integer)

    Hash code



290
291
292
# File 'lib/zernio-sdk/models/ad_tree_ad_set.rb', line 290

def hash
  [platform_ad_set_id, ad_set_name, status, created_time, ad_count, budget, ad_set_budget, metrics, optimization_goal, bid_strategy, bid_amount, roas_average_floor, cost_type, serving_statuses, promoted_object, ads, 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



245
246
247
248
249
# File 'lib/zernio-sdk/models/ad_tree_ad_set.rb', line 245

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



319
320
321
322
323
324
325
326
327
328
329
330
331
# File 'lib/zernio-sdk/models/ad_tree_ad_set.rb', line 319

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



253
254
255
256
# File 'lib/zernio-sdk/models/ad_tree_ad_set.rb', line 253

def valid?
  warn '[DEPRECATED] the `valid?` method is obsolete'
  true
end