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



137
138
139
140
141
142
143
144
145
146
147
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
# File 'lib/zernio-sdk/models/ad_tree_ad_set.rb', line 137

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



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

def ads
  @ads
end

#bid_amountObject

Bid cap in whole currency units. Populated when bidStrategy is LOWEST_COST_WITH_BID_CAP or COST_CAP.



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

#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.



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

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

Meta ad set optimization goal (e.g. OFFSITE_CONVERSIONS, VALUE, LEAD_GENERATION)



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.



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

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

#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



96
97
98
# File 'lib/zernio-sdk/models/ad_tree_ad_set.rb', line 96

def self.acceptable_attribute_map
  attribute_map
end

.acceptable_attributesObject

Returns all the JSON keys this model knows about



101
102
103
# File 'lib/zernio-sdk/models/ad_tree_ad_set.rb', line 101

def self.acceptable_attributes
  acceptable_attribute_map.values
end

.attribute_mapObject

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



76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
# File 'lib/zernio-sdk/models/ad_tree_ad_set.rb', line 76

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',
    :'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



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

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



126
127
128
129
130
131
132
133
# File 'lib/zernio-sdk/models/ad_tree_ad_set.rb', line 126

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

.openapi_typesObject

Attribute type mapping.



106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
# File 'lib/zernio-sdk/models/ad_tree_ad_set.rb', line 106

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',
    :'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



229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
# File 'lib/zernio-sdk/models/ad_tree_ad_set.rb', line 229

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


250
251
252
# File 'lib/zernio-sdk/models/ad_tree_ad_set.rb', line 250

def eql?(o)
  self == o
end

#hashInteger

Calculates hash code according to all attributes.

Returns:

  • (Integer)

    Hash code



256
257
258
# File 'lib/zernio-sdk/models/ad_tree_ad_set.rb', line 256

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



214
215
216
217
218
# File 'lib/zernio-sdk/models/ad_tree_ad_set.rb', line 214

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



285
286
287
288
289
290
291
292
293
294
295
296
297
# File 'lib/zernio-sdk/models/ad_tree_ad_set.rb', line 285

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



222
223
224
225
# File 'lib/zernio-sdk/models/ad_tree_ad_set.rb', line 222

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