Class: PinterestSdkClient::AdGroupResponse

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

Defined Under Namespace

Classes: EnumAttributeValidator

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(attributes = {}) ⇒ AdGroupResponse

Initializes the object

Parameters:

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

    Model attributes in the form of hash



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
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
# File 'lib/pinterest_sdk/models/ad_group_response.rb', line 194

def initialize(attributes = {})
  if (!attributes.is_a?(Hash))
    fail ArgumentError, "The input argument (attributes) must be a hash in `PinterestSdkClient::AdGroupResponse` 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::AdGroupResponse`. 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

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

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

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

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

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

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

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

Instance Attribute Details

#ad_account_idObject

Advertiser ID.



78
79
80
# File 'lib/pinterest_sdk/models/ad_group_response.rb', line 78

def 
  @ad_account_id
end

#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.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.rb', line 28

def bid_in_micro_currency
  @bid_in_micro_currency
end

#billable_eventObject

Returns the value of attribute billable_event.



69
70
71
# File 'lib/pinterest_sdk/models/ad_group_response.rb', line 69

def billable_event
  @billable_event
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.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.rb', line 31

def budget_type
  @budget_type
end

#campaign_idObject

Campaign ID of the ad group.



67
68
69
# File 'lib/pinterest_sdk/models/ad_group_response.rb', line 67

def campaign_id
  @campaign_id
end

#conversion_learning_mode_typeObject

oCPM learn mode



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

def conversion_learning_mode_type
  @conversion_learning_mode_type
end

#created_timeObject

Ad group creation time. Unix timestamp in seconds.



81
82
83
# File 'lib/pinterest_sdk/models/ad_group_response.rb', line 81

def created_time
  @created_time
end

#end_timeObject

Ad group end time. Unix timestamp in seconds.



37
38
39
# File 'lib/pinterest_sdk/models/ad_group_response.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.rb', line 64

def feed_profile_id
  @feed_profile_id
end

#idObject

Ad group ID.



72
73
74
# File 'lib/pinterest_sdk/models/ad_group_response.rb', line 72

def id
  @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.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.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.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.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.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.rb', line 22

def status
  @status
end

#summary_statusObject

Ad group summary status.



61
62
63
# File 'lib/pinterest_sdk/models/ad_group_response.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.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.rb', line 46

def tracking_urls
  @tracking_urls
end

#typeObject

Always "adgroup".



75
76
77
# File 'lib/pinterest_sdk/models/ad_group_response.rb', line 75

def type
  @type
end

#updated_timeObject

Ad group last update time. Unix timestamp in seconds.



84
85
86
# File 'lib/pinterest_sdk/models/ad_group_response.rb', line 84

def updated_time
  @updated_time
end

Class Method Details

.acceptable_attributesObject

Returns all the JSON keys this model knows about



138
139
140
# File 'lib/pinterest_sdk/models/ad_group_response.rb', line 138

def self.acceptable_attributes
  attribute_map.values
end

.attribute_mapObject

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



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
# File 'lib/pinterest_sdk/models/ad_group_response.rb', line 109

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',
    :'campaign_id' => :'campaign_id',
    :'billable_event' => :'billable_event',
    :'id' => :'id',
    :'type' => :'type',
    :'ad_account_id' => :'ad_account_id',
    :'created_time' => :'created_time',
    :'updated_time' => :'updated_time'
  }
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



438
439
440
# File 'lib/pinterest_sdk/models/ad_group_response.rb', line 438

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

.openapi_all_ofObject

List of class defined in allOf (OpenAPI v3)



185
186
187
188
189
190
# File 'lib/pinterest_sdk/models/ad_group_response.rb', line 185

def self.openapi_all_of
  [
  :'AdGroupResponseAllOf',
  :'AdGroupResponseAllOf1'
  ]
end

.openapi_nullableObject

List of attributes with nullable: true



172
173
174
175
176
177
178
179
180
181
182
# File 'lib/pinterest_sdk/models/ad_group_response.rb', line 172

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.



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
# File 'lib/pinterest_sdk/models/ad_group_response.rb', line 143

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',
    :'campaign_id' => :'String',
    :'billable_event' => :'ActionType',
    :'id' => :'String',
    :'type' => :'String',
    :'ad_account_id' => :'String',
    :'created_time' => :'Integer',
    :'updated_time' => :'Integer'
  }
end

Instance Method Details

#==(o) ⇒ Object

Checks equality by comparing each attribute.

Parameters:

  • Object (Object)

    to be compared



395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
# File 'lib/pinterest_sdk/models/ad_group_response.rb', line 395

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 &&
      campaign_id == o.campaign_id &&
      billable_event == o.billable_event &&
      id == o.id &&
      type == o.type &&
       == o. &&
      created_time == o.created_time &&
      updated_time == o.updated_time
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



468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
# File 'lib/pinterest_sdk/models/ad_group_response.rb', line 468

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



539
540
541
542
543
544
545
546
547
548
549
550
551
# File 'lib/pinterest_sdk/models/ad_group_response.rb', line 539

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



445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
# File 'lib/pinterest_sdk/models/ad_group_response.rb', line 445

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


425
426
427
# File 'lib/pinterest_sdk/models/ad_group_response.rb', line 425

def eql?(o)
  self == o
end

#hashInteger

Calculates hash code according to all attributes.

Returns:

  • (Integer)

    Hash code



431
432
433
# File 'lib/pinterest_sdk/models/ad_group_response.rb', line 431

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, campaign_id, billable_event, id, type, , created_time, updated_time].hash
end

#list_invalid_propertiesObject

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

Returns:

  • Array for valid properties with the reasons



307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
# File 'lib/pinterest_sdk/models/ad_group_response.rb', line 307

def list_invalid_properties
  invalid_properties = Array.new
  pattern = Regexp.new(/^\d+$/)
  if !@campaign_id.nil? && @campaign_id !~ pattern
    invalid_properties.push("invalid value for \"campaign_id\", must conform to the pattern #{pattern}.")
  end

  pattern = Regexp.new(/^\d+$/)
  if !@id.nil? && @id !~ pattern
    invalid_properties.push("invalid value for \"id\", must conform to the pattern #{pattern}.")
  end

  pattern = Regexp.new(/^\d+$/)
  if !@ad_account_id.nil? && @ad_account_id !~ pattern
    invalid_properties.push("invalid value for \"ad_account_id\", must conform to the pattern #{pattern}.")
  end

  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



515
516
517
# File 'lib/pinterest_sdk/models/ad_group_response.rb', line 515

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



521
522
523
524
525
526
527
528
529
530
531
532
533
# File 'lib/pinterest_sdk/models/ad_group_response.rb', line 521

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



509
510
511
# File 'lib/pinterest_sdk/models/ad_group_response.rb', line 509

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



329
330
331
332
333
334
335
336
337
338
# File 'lib/pinterest_sdk/models/ad_group_response.rb', line 329

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)
  return false if !@campaign_id.nil? && @campaign_id !~ Regexp.new(/^\d+$/)
  return false if !@id.nil? && @id !~ Regexp.new(/^\d+$/)
  return false if !@ad_account_id.nil? && @ad_account_id !~ Regexp.new(/^\d+$/)
  true
end