Class: PinterestSdkClient::AdGroupResponseAllOf

Inherits:
Object
  • Object
show all
Defined in:
lib/pinterest_sdk/models/ad_group_response_all_of.rb

Defined Under Namespace

Classes: EnumAttributeValidator

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(attributes = {}) ⇒ AdGroupResponseAllOf

Initializes the object

Parameters:

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

    Model attributes in the form of hash



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
232
233
# File 'lib/pinterest_sdk/models/ad_group_response_all_of.rb', line 152

def initialize(attributes = {})
  if (!attributes.is_a?(Hash))
    fail ArgumentError, "The input argument (attributes) must be a hash in `PinterestSdkClient::AdGroupResponseAllOf` initialize method"
  end

  # check to see if the attribute exists and convert string to symbol for hash key
  attributes = attributes.each_with_object({}) { |(k, v), h|
    if (!self.class.attribute_map.key?(k.to_sym))
      fail ArgumentError, "`#{k}` is not a valid attribute in `PinterestSdkClient::AdGroupResponseAllOf`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
    end
    h[k.to_sym] = v
  }

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Instance Attribute Details

#auto_targeting_enabledObject

Enable auto-targeting for ad group. Also known as <a href="help.pinterest.com/en/business/article/expanded-targeting" target="_blank">"expanded targeting"</a>.



49
50
51
# File 'lib/pinterest_sdk/models/ad_group_response_all_of.rb', line 49

def auto_targeting_enabled
  @auto_targeting_enabled
end

#bid_in_micro_currencyObject

Bid price in micro currency. This field is REQUIRED for the following campaign objective_type/billable_event combinations: AWARENESS/IMPRESSION, CONSIDERATION/CLICKTHROUGH, CATALOG_SALES/CLICKTHROUGH, VIDEO_VIEW/VIDEO_V_50_MRC.



28
29
30
# File 'lib/pinterest_sdk/models/ad_group_response_all_of.rb', line 28

def bid_in_micro_currency
  @bid_in_micro_currency
end

#budget_in_micro_currencyObject

Budget in micro currency. This field is REQUIRED for non-CBO (campaign budget optimization) campaigns. A CBO campaign automatically generates ad group budgets from its campaign budget to maximize campaign outcome. A CBO campaign is limited to 70 or less ad groups.



25
26
27
# File 'lib/pinterest_sdk/models/ad_group_response_all_of.rb', line 25

def budget_in_micro_currency
  @budget_in_micro_currency
end

#budget_typeObject

Budget type. If DAILY, an ad group’s daily spend will not exceed the budget parameter value. If LIFETIME, the end_time parameter is REQUIRED, and the ad group spend is spread evenly between the ad group ‘start_time` and `end_time` range. A CBO campaign automatically generates ad group budgets from its campaign budget to maximize campaign outcome.



31
32
33
# File 'lib/pinterest_sdk/models/ad_group_response_all_of.rb', line 31

def budget_type
  @budget_type
end

#conversion_learning_mode_typeObject

oCPM learn mode



58
59
60
# File 'lib/pinterest_sdk/models/ad_group_response_all_of.rb', line 58

def conversion_learning_mode_type
  @conversion_learning_mode_type
end

#end_timeObject

Ad group end time. Unix timestamp in seconds.



37
38
39
# File 'lib/pinterest_sdk/models/ad_group_response_all_of.rb', line 37

def end_time
  @end_time
end

#feed_profile_idObject

Feed Profile ID associated to the adgroup.



64
65
66
# File 'lib/pinterest_sdk/models/ad_group_response_all_of.rb', line 64

def feed_profile_id
  @feed_profile_id
end

#lifetime_frequency_capObject

Set a limit to the number of times a promoted pin from this campaign can be impressed by a pinner within the past rolling 30 days. Only available for CPM (cost per mille (1000 impressions)) ad groups. A CPM ad group has an IMPRESSION <a href=\"/docs/redoc/#section/Billable-event\">billable_event</a> value. This field REQUIRES the ‘end_time` field.



43
44
45
# File 'lib/pinterest_sdk/models/ad_group_response_all_of.rb', line 43

def lifetime_frequency_cap
  @lifetime_frequency_cap
end

#nameObject

Ad group name.



19
20
21
# File 'lib/pinterest_sdk/models/ad_group_response_all_of.rb', line 19

def name
  @name
end

#pacing_delivery_typeObject

Pacing delivery type. With ACCELERATED, an ad group budget is spent as fast as possible. With STANDARD, an ad group budget is spent smoothly over a day.



55
56
57
# File 'lib/pinterest_sdk/models/ad_group_response_all_of.rb', line 55

def pacing_delivery_type
  @pacing_delivery_type
end

#placement_groupObject

<a href=\"/docs/redoc/#section/Placement-group\">Placement group</a>.



52
53
54
# File 'lib/pinterest_sdk/models/ad_group_response_all_of.rb', line 52

def placement_group
  @placement_group
end

#start_timeObject

Ad group start time. Unix timestamp in seconds. Defaults to current time.



34
35
36
# File 'lib/pinterest_sdk/models/ad_group_response_all_of.rb', line 34

def start_time
  @start_time
end

#statusObject

Ad group/entity status.



22
23
24
# File 'lib/pinterest_sdk/models/ad_group_response_all_of.rb', line 22

def status
  @status
end

#summary_statusObject

Ad group summary status.



61
62
63
# File 'lib/pinterest_sdk/models/ad_group_response_all_of.rb', line 61

def summary_status
  @summary_status
end

#targeting_specObject

Ad group targeting specification defining the ad group target audience. For example, ‘href="\"iphone\"">APPTYPE":, "GENDER":, "LOCALE":, "LOCATION":, "AGE_BUCKET":



40
41
42
# File 'lib/pinterest_sdk/models/ad_group_response_all_of.rb', line 40

def targeting_spec
  @targeting_spec
end

#tracking_urlsObject

Third-party tracking URLs.
JSON object with the format: href="developers.pinterest.com/docs/redoc/#section/Tracking-URL-event">Tracking event enum</a>":[URL string array],…
For example: ["URL1", "URL2"], "click": ["URL1", "URL2", "URL3"].
Up to three tracking URLs are supported for each event type. Tracking URLs set at the ad group or ad level can override those set at the campaign level. May be null. Pass in an empty object - {} - to remove tracking URLs.
For more information, see <a href="help.pinterest.com/en/business/article/third-party-and-dynamic-tracking" target="_blank">Third-party and dynamic tracking</a>.



46
47
48
# File 'lib/pinterest_sdk/models/ad_group_response_all_of.rb', line 46

def tracking_urls
  @tracking_urls
end

Class Method Details

.acceptable_attributesObject

Returns all the JSON keys this model knows about



111
112
113
# File 'lib/pinterest_sdk/models/ad_group_response_all_of.rb', line 111

def self.acceptable_attributes
  attribute_map.values
end

.attribute_mapObject

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



89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
# File 'lib/pinterest_sdk/models/ad_group_response_all_of.rb', line 89

def self.attribute_map
  {
    :'name' => :'name',
    :'status' => :'status',
    :'budget_in_micro_currency' => :'budget_in_micro_currency',
    :'bid_in_micro_currency' => :'bid_in_micro_currency',
    :'budget_type' => :'budget_type',
    :'start_time' => :'start_time',
    :'end_time' => :'end_time',
    :'targeting_spec' => :'targeting_spec',
    :'lifetime_frequency_cap' => :'lifetime_frequency_cap',
    :'tracking_urls' => :'tracking_urls',
    :'auto_targeting_enabled' => :'auto_targeting_enabled',
    :'placement_group' => :'placement_group',
    :'pacing_delivery_type' => :'pacing_delivery_type',
    :'conversion_learning_mode_type' => :'conversion_learning_mode_type',
    :'summary_status' => :'summary_status',
    :'feed_profile_id' => :'feed_profile_id'
  }
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



310
311
312
# File 'lib/pinterest_sdk/models/ad_group_response_all_of.rb', line 310

def self.build_from_hash(attributes)
  new.build_from_hash(attributes)
end

.openapi_nullableObject

List of attributes with nullable: true



138
139
140
141
142
143
144
145
146
147
148
# File 'lib/pinterest_sdk/models/ad_group_response_all_of.rb', line 138

def self.openapi_nullable
  Set.new([
    :'budget_in_micro_currency',
    :'bid_in_micro_currency',
    :'start_time',
    :'end_time',
    :'tracking_urls',
    :'auto_targeting_enabled',
    :'conversion_learning_mode_type',
  ])
end

.openapi_typesObject

Attribute type mapping.



116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
# File 'lib/pinterest_sdk/models/ad_group_response_all_of.rb', line 116

def self.openapi_types
  {
    :'name' => :'String',
    :'status' => :'EntityStatus',
    :'budget_in_micro_currency' => :'Integer',
    :'bid_in_micro_currency' => :'Integer',
    :'budget_type' => :'String',
    :'start_time' => :'Integer',
    :'end_time' => :'Integer',
    :'targeting_spec' => :'Hash<String, Array<String>>',
    :'lifetime_frequency_cap' => :'Integer',
    :'tracking_urls' => :'TrackingUrls',
    :'auto_targeting_enabled' => :'Boolean',
    :'placement_group' => :'PlacementGroupType',
    :'pacing_delivery_type' => :'PacingDeliveryType',
    :'conversion_learning_mode_type' => :'String',
    :'summary_status' => :'AdGroupSummaryStatus',
    :'feed_profile_id' => :'String'
  }
end

Instance Method Details

#==(o) ⇒ Object

Checks equality by comparing each attribute.

Parameters:

  • Object (Object)

    to be compared



274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
# File 'lib/pinterest_sdk/models/ad_group_response_all_of.rb', line 274

def ==(o)
  return true if self.equal?(o)
  self.class == o.class &&
      name == o.name &&
      status == o.status &&
      budget_in_micro_currency == o.budget_in_micro_currency &&
      bid_in_micro_currency == o.bid_in_micro_currency &&
      budget_type == o.budget_type &&
      start_time == o.start_time &&
      end_time == o.end_time &&
      targeting_spec == o.targeting_spec &&
      lifetime_frequency_cap == o.lifetime_frequency_cap &&
      tracking_urls == o.tracking_urls &&
      auto_targeting_enabled == o.auto_targeting_enabled &&
      placement_group == o.placement_group &&
      pacing_delivery_type == o.pacing_delivery_type &&
      conversion_learning_mode_type == o.conversion_learning_mode_type &&
      summary_status == o.summary_status &&
      feed_profile_id == o.feed_profile_id
end

#_deserialize(type, value) ⇒ Object

Deserializes the data based on type

Parameters:

  • string

    type Data type

  • string

    value Value to be deserialized

Returns:

  • (Object)

    Deserialized data



340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
# File 'lib/pinterest_sdk/models/ad_group_response_all_of.rb', line 340

def _deserialize(type, value)
  case type.to_sym
  when :Time
    Time.parse(value)
  when :Date
    Date.parse(value)
  when :String
    value.to_s
  when :Integer
    value.to_i
  when :Float
    value.to_f
  when :Boolean
    if value.to_s =~ /\A(true|t|yes|y|1)\z/i
      true
    else
      false
    end
  when :Object
    # generic object (usually a Hash), return directly
    value
  when /\AArray<(?<inner_type>.+)>\z/
    inner_type = Regexp.last_match[:inner_type]
    value.map { |v| _deserialize(inner_type, v) }
  when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
    k_type = Regexp.last_match[:k_type]
    v_type = Regexp.last_match[:v_type]
    {}.tap do |hash|
      value.each do |k, v|
        hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
      end
    end
  else # model
    # models (e.g. Pet) or oneOf
    klass = PinterestSdkClient.const_get(type)
    klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
  end
end

#_to_hash(value) ⇒ Hash

Outputs non-array value in the form of hash For object, use to_hash. Otherwise, just return the value

Parameters:

  • value (Object)

    Any valid value

Returns:

  • (Hash)

    Returns the value in the form of hash



411
412
413
414
415
416
417
418
419
420
421
422
423
# File 'lib/pinterest_sdk/models/ad_group_response_all_of.rb', line 411

def _to_hash(value)
  if value.is_a?(Array)
    value.compact.map { |v| _to_hash(v) }
  elsif value.is_a?(Hash)
    {}.tap do |hash|
      value.each { |k, v| hash[k] = _to_hash(v) }
    end
  elsif value.respond_to? :to_hash
    value.to_hash
  else
    value
  end
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



317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
# File 'lib/pinterest_sdk/models/ad_group_response_all_of.rb', line 317

def build_from_hash(attributes)
  return nil unless attributes.is_a?(Hash)
  self.class.openapi_types.each_pair do |key, type|
    if attributes[self.class.attribute_map[key]].nil? && self.class.openapi_nullable.include?(key)
      self.send("#{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[self.class.attribute_map[key]].is_a?(Array)
        self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
      end
    elsif !attributes[self.class.attribute_map[key]].nil?
      self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
    end
  end

  self
end

#eql?(o) ⇒ Boolean

Parameters:

  • Object (Object)

    to be compared

Returns:

  • (Boolean)

See Also:

  • `==` method


297
298
299
# File 'lib/pinterest_sdk/models/ad_group_response_all_of.rb', line 297

def eql?(o)
  self == o
end

#hashInteger

Calculates hash code according to all attributes.

Returns:

  • (Integer)

    Hash code



303
304
305
# File 'lib/pinterest_sdk/models/ad_group_response_all_of.rb', line 303

def hash
  [name, status, budget_in_micro_currency, bid_in_micro_currency, budget_type, start_time, end_time, targeting_spec, lifetime_frequency_cap, tracking_urls, auto_targeting_enabled, placement_group, pacing_delivery_type, conversion_learning_mode_type, summary_status, feed_profile_id].hash
end

#list_invalid_propertiesObject

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

Returns:

  • Array for valid properties with the reasons



237
238
239
240
# File 'lib/pinterest_sdk/models/ad_group_response_all_of.rb', line 237

def list_invalid_properties
  invalid_properties = Array.new
  invalid_properties
end

#to_bodyHash

to_body is an alias to to_hash (backward compatibility)

Returns:

  • (Hash)

    Returns the object in the form of hash



387
388
389
# File 'lib/pinterest_sdk/models/ad_group_response_all_of.rb', line 387

def to_body
  to_hash
end

#to_hashHash

Returns the object in the form of hash

Returns:

  • (Hash)

    Returns the object in the form of hash



393
394
395
396
397
398
399
400
401
402
403
404
405
# File 'lib/pinterest_sdk/models/ad_group_response_all_of.rb', line 393

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

#to_sString

Returns the string representation of the object

Returns:

  • (String)

    String presentation of the object



381
382
383
# File 'lib/pinterest_sdk/models/ad_group_response_all_of.rb', line 381

def to_s
  to_hash.to_s
end

#valid?Boolean

Check to see if the all the properties in the model are valid

Returns:

  • (Boolean)

    true if the model is valid



244
245
246
247
248
249
250
# File 'lib/pinterest_sdk/models/ad_group_response_all_of.rb', line 244

def valid?
  budget_type_validator = EnumAttributeValidator.new('String', ["DAILY", "LIFETIME", "CBO_ADGROUP"])
  return false unless budget_type_validator.valid?(@budget_type)
  conversion_learning_mode_type_validator = EnumAttributeValidator.new('String', ["NOT_ACTIVE", "ACTIVE", "null"])
  return false unless conversion_learning_mode_type_validator.valid?(@conversion_learning_mode_type)
  true
end