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



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

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?(:'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.



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

def ad_count
  @ad_count
end

#ad_set_budgetObject

Returns the value of attribute ad_set_budget.



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

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 (core fields like _id, name, platform, status, budget, metrics, creative, goal are included; targeting and schedule may be absent). When timeIncrement=1&dailyLevel=ad, each entry also carries a daily[] array of AdDailyMetrics.



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

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.



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

def bid_amount
  @bid_amount
end

#bid_strategyObject

Returns the value of attribute bid_strategy.



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

def bid_strategy
  @bid_strategy
end

#budgetObject

Returns the value of attribute budget.



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

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.



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

def cost_type
  @cost_type
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.



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

def daily
  @daily
end

#metricsObject

Returns the value of attribute metrics.



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

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.



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

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.



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

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.



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

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.



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

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



104
105
106
# File 'lib/zernio-sdk/models/ad_tree_ad_set.rb', line 104

def self.acceptable_attribute_map
  attribute_map
end

.acceptable_attributesObject

Returns all the JSON keys this model knows about



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

def self.acceptable_attributes
  acceptable_attribute_map.values
end

.attribute_mapObject

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



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

def self.attribute_map
  {
    :'platform_ad_set_id' => :'platformAdSetId',
    :'ad_set_name' => :'adSetName',
    :'status' => :'status',
    :'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



286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
# File 'lib/zernio-sdk/models/ad_tree_ad_set.rb', line 286

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



136
137
138
139
140
141
142
143
144
# File 'lib/zernio-sdk/models/ad_tree_ad_set.rb', line 136

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

.openapi_typesObject

Attribute type mapping.



114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
# File 'lib/zernio-sdk/models/ad_tree_ad_set.rb', line 114

def self.openapi_types
  {
    :'platform_ad_set_id' => :'String',
    :'ad_set_name' => :'String',
    :'status' => :'AdStatus',
    :'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



250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
# File 'lib/zernio-sdk/models/ad_tree_ad_set.rb', line 250

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 &&
      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


273
274
275
# File 'lib/zernio-sdk/models/ad_tree_ad_set.rb', line 273

def eql?(o)
  self == o
end

#hashInteger

Calculates hash code according to all attributes.

Returns:

  • (Integer)

    Hash code



279
280
281
# File 'lib/zernio-sdk/models/ad_tree_ad_set.rb', line 279

def hash
  [platform_ad_set_id, ad_set_name, status, 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



235
236
237
238
239
# File 'lib/zernio-sdk/models/ad_tree_ad_set.rb', line 235

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



308
309
310
311
312
313
314
315
316
317
318
319
320
# File 'lib/zernio-sdk/models/ad_tree_ad_set.rb', line 308

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



243
244
245
246
# File 'lib/zernio-sdk/models/ad_tree_ad_set.rb', line 243

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