Class: PinterestSdkClient::ProductGroupPromotion

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

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

Initializes the object

Parameters:

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

    Model attributes in the form of hash



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
304
305
306
307
308
309
310
311
312
313
# File 'lib/pinterest_sdk/models/product_group_promotion.rb', line 200

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Instance Attribute Details

#ad_group_idObject

ID of the ad group the product group belongs to.



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

def ad_group_id
  @ad_group_id
end

#bid_in_micro_currencyObject

The bid in micro currency.



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

def bid_in_micro_currency
  @bid_in_micro_currency
end

#catalog_product_group_idObject

ID of the catalogs product group that this product group promotion references (required for create operations)



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

def catalog_product_group_id
  @catalog_product_group_id
end

#catalog_product_group_nameObject

Catalogs product group name



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

def catalog_product_group_name
  @catalog_product_group_name
end

#collections_header_typeObject

Returns the value of attribute collections_header_type.



30
31
32
# File 'lib/pinterest_sdk/models/product_group_promotion.rb', line 30

def collections_header_type
  @collections_header_type
end

#collections_hero_destination_urlObject

Collections Hero Destination Url



33
34
35
# File 'lib/pinterest_sdk/models/product_group_promotion.rb', line 33

def collections_hero_destination_url
  @collections_hero_destination_url
end

#collections_hero_pin_idObject

Hero Pin ID if this PG is promoted as a Collection



36
37
38
# File 'lib/pinterest_sdk/models/product_group_promotion.rb', line 36

def collections_hero_pin_id
  @collections_hero_pin_id
end

#creative_typeObject

Returns the value of attribute creative_type.



38
39
40
# File 'lib/pinterest_sdk/models/product_group_promotion.rb', line 38

def creative_type
  @creative_type
end

#customizable_cta_typeObject

Returns the value of attribute customizable_cta_type.



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

def customizable_cta_type
  @customizable_cta_type
end

#definitionObject

The full product group definition path



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

def definition
  @definition
end

#grid_click_typeObject

Returns the value of attribute grid_click_type.



45
46
47
# File 'lib/pinterest_sdk/models/product_group_promotion.rb', line 45

def grid_click_type
  @grid_click_type
end

#idObject

ID of the product group promotion (required for update operations).



48
49
50
# File 'lib/pinterest_sdk/models/product_group_promotion.rb', line 48

def id
  @id
end

#includedObject

True if the group is BIDDABLE, false if it should be EXCLUDED from serving ads.



51
52
53
# File 'lib/pinterest_sdk/models/product_group_promotion.rb', line 51

def included
  @included
end

#is_generate_backgroundObject

Enable generate backgrounds for the product group, default value is FALSE. When enabled, Pinterest will use generative AI to apply backgrounds for your product images that help drive user inspiration and engagement.



54
55
56
# File 'lib/pinterest_sdk/models/product_group_promotion.rb', line 54

def is_generate_background
  @is_generate_background
end

#is_image_auto_resizingObject

Set to TRUE to automatically resize your product images with generative AI. This ensures that images have optimal appearance for better performance.



57
58
59
# File 'lib/pinterest_sdk/models/product_group_promotion.rb', line 57

def is_image_auto_resizing
  @is_image_auto_resizing
end

#is_mdlObject

If set to true products promoted in this product group will use the Mobile Deep Link specified in your catalog



60
61
62
# File 'lib/pinterest_sdk/models/product_group_promotion.rb', line 60

def is_mdl
  @is_mdl
end

#parent_idObject

The parent Product Group ID of this Product Group



63
64
65
# File 'lib/pinterest_sdk/models/product_group_promotion.rb', line 63

def parent_id
  @parent_id
end

#preferred_media_typeObject

Returns the value of attribute preferred_media_type.



65
66
67
# File 'lib/pinterest_sdk/models/product_group_promotion.rb', line 65

def preferred_media_type
  @preferred_media_type
end

#relative_definitionObject

The definition of the product group, relative to its parent - an attribute name/value pair



68
69
70
# File 'lib/pinterest_sdk/models/product_group_promotion.rb', line 68

def relative_definition
  @relative_definition
end

#selected_image_tagObject

The ad image tag selected for the product group promotion.



71
72
73
# File 'lib/pinterest_sdk/models/product_group_promotion.rb', line 71

def selected_image_tag
  @selected_image_tag
end

#selected_video_tagObject

The ad video tag selected for the product group promotion.



74
75
76
# File 'lib/pinterest_sdk/models/product_group_promotion.rb', line 74

def selected_video_tag
  @selected_video_tag
end

#slideshow_collections_descriptionObject

Slideshow Collections Description



77
78
79
# File 'lib/pinterest_sdk/models/product_group_promotion.rb', line 77

def slideshow_collections_description
  @slideshow_collections_description
end

#slideshow_collections_titleObject

Slideshow Collections Title



80
81
82
# File 'lib/pinterest_sdk/models/product_group_promotion.rb', line 80

def slideshow_collections_title
  @slideshow_collections_title
end

#statusObject

Returns the value of attribute status.



82
83
84
# File 'lib/pinterest_sdk/models/product_group_promotion.rb', line 82

def status
  @status
end

#tracking_urlObject

Tracking template for proudct group promotions. 4000 limit



85
86
87
# File 'lib/pinterest_sdk/models/product_group_promotion.rb', line 85

def tracking_url
  @tracking_url
end

Class Method Details

.acceptable_attribute_mapObject

Returns attribute mapping this model knows about



141
142
143
# File 'lib/pinterest_sdk/models/product_group_promotion.rb', line 141

def self.acceptable_attribute_map
  attribute_map
end

.acceptable_attributesObject

Returns all the JSON keys this model knows about



146
147
148
# File 'lib/pinterest_sdk/models/product_group_promotion.rb', line 146

def self.acceptable_attributes
  acceptable_attribute_map.values
end

.attribute_mapObject

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



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
136
137
138
# File 'lib/pinterest_sdk/models/product_group_promotion.rb', line 110

def self.attribute_map
  {
    :'ad_group_id' => :'ad_group_id',
    :'bid_in_micro_currency' => :'bid_in_micro_currency',
    :'catalog_product_group_id' => :'catalog_product_group_id',
    :'catalog_product_group_name' => :'catalog_product_group_name',
    :'collections_header_type' => :'collections_header_type',
    :'collections_hero_destination_url' => :'collections_hero_destination_url',
    :'collections_hero_pin_id' => :'collections_hero_pin_id',
    :'creative_type' => :'creative_type',
    :'customizable_cta_type' => :'customizable_cta_type',
    :'definition' => :'definition',
    :'grid_click_type' => :'grid_click_type',
    :'id' => :'id',
    :'included' => :'included',
    :'is_generate_background' => :'is_generate_background',
    :'is_image_auto_resizing' => :'is_image_auto_resizing',
    :'is_mdl' => :'is_mdl',
    :'parent_id' => :'parent_id',
    :'preferred_media_type' => :'preferred_media_type',
    :'relative_definition' => :'relative_definition',
    :'selected_image_tag' => :'selected_image_tag',
    :'selected_video_tag' => :'selected_video_tag',
    :'slideshow_collections_description' => :'slideshow_collections_description',
    :'slideshow_collections_title' => :'slideshow_collections_title',
    :'status' => :'status',
    :'tracking_url' => :'tracking_url'
  }
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



478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
# File 'lib/pinterest_sdk/models/product_group_promotion.rb', line 478

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



182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
# File 'lib/pinterest_sdk/models/product_group_promotion.rb', line 182

def self.openapi_nullable
  Set.new([
    :'collections_header_type',
    :'collections_hero_destination_url',
    :'collections_hero_pin_id',
    :'grid_click_type',
    :'is_generate_background',
    :'is_image_auto_resizing',
    :'preferred_media_type',
    :'selected_image_tag',
    :'selected_video_tag',
    :'slideshow_collections_description',
    :'slideshow_collections_title',
  ])
end

.openapi_typesObject

Attribute type mapping.



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

def self.openapi_types
  {
    :'ad_group_id' => :'String',
    :'bid_in_micro_currency' => :'Integer',
    :'catalog_product_group_id' => :'String',
    :'catalog_product_group_name' => :'String',
    :'collections_header_type' => :'CollectionsHeaderType',
    :'collections_hero_destination_url' => :'String',
    :'collections_hero_pin_id' => :'String',
    :'creative_type' => :'CreativeType',
    :'customizable_cta_type' => :'ProductGroupPromotionCustomizableCTAType',
    :'definition' => :'String',
    :'grid_click_type' => :'GridClickType',
    :'id' => :'String',
    :'included' => :'Boolean',
    :'is_generate_background' => :'Boolean',
    :'is_image_auto_resizing' => :'Boolean',
    :'is_mdl' => :'Boolean',
    :'parent_id' => :'String',
    :'preferred_media_type' => :'PreferredMediaType',
    :'relative_definition' => :'String',
    :'selected_image_tag' => :'String',
    :'selected_video_tag' => :'String',
    :'slideshow_collections_description' => :'String',
    :'slideshow_collections_title' => :'String',
    :'status' => :'EntityStatus',
    :'tracking_url' => :'String'
  }
end

Instance Method Details

#==(o) ⇒ Object

Checks equality by comparing each attribute.

Parameters:

  • Object (Object)

    to be compared



433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
# File 'lib/pinterest_sdk/models/product_group_promotion.rb', line 433

def ==(o)
  return true if self.equal?(o)
  self.class == o.class &&
      ad_group_id == o.ad_group_id &&
      bid_in_micro_currency == o.bid_in_micro_currency &&
      catalog_product_group_id == o.catalog_product_group_id &&
      catalog_product_group_name == o.catalog_product_group_name &&
      collections_header_type == o.collections_header_type &&
      collections_hero_destination_url == o.collections_hero_destination_url &&
      collections_hero_pin_id == o.collections_hero_pin_id &&
      creative_type == o.creative_type &&
      customizable_cta_type == o.customizable_cta_type &&
      definition == o.definition &&
      grid_click_type == o.grid_click_type &&
      id == o.id &&
      included == o.included &&
      is_generate_background == o.is_generate_background &&
      is_image_auto_resizing == o.is_image_auto_resizing &&
      is_mdl == o.is_mdl &&
      parent_id == o.parent_id &&
      preferred_media_type == o.preferred_media_type &&
      relative_definition == o.relative_definition &&
      selected_image_tag == o.selected_image_tag &&
      selected_video_tag == o.selected_video_tag &&
      slideshow_collections_description == o.slideshow_collections_description &&
      slideshow_collections_title == o.slideshow_collections_title &&
      status == o.status &&
      tracking_url == o.tracking_url
end

#eql?(o) ⇒ Boolean

Parameters:

  • Object (Object)

    to be compared

Returns:

  • (Boolean)

See Also:

  • `==` method


465
466
467
# File 'lib/pinterest_sdk/models/product_group_promotion.rb', line 465

def eql?(o)
  self == o
end

#hashInteger

Calculates hash code according to all attributes.

Returns:

  • (Integer)

    Hash code



471
472
473
# File 'lib/pinterest_sdk/models/product_group_promotion.rb', line 471

def hash
  [ad_group_id, bid_in_micro_currency, catalog_product_group_id, catalog_product_group_name, collections_header_type, collections_hero_destination_url, collections_hero_pin_id, creative_type, customizable_cta_type, definition, grid_click_type, id, included, is_generate_background, is_image_auto_resizing, is_mdl, parent_id, preferred_media_type, relative_definition, selected_image_tag, selected_video_tag, slideshow_collections_description, slideshow_collections_title, status, tracking_url].hash
end

#list_invalid_propertiesObject

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

Returns:

  • Array for valid properties with the reasons



317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
# File 'lib/pinterest_sdk/models/product_group_promotion.rb', line 317

def list_invalid_properties
  warn '[DEPRECATED] the `list_invalid_properties` method is obsolete'
  invalid_properties = Array.new
  pattern = Regexp.new(/^(AG)?\d+$/)
  if !@ad_group_id.nil? && @ad_group_id !~ pattern
    invalid_properties.push("invalid value for \"ad_group_id\", must conform to the pattern #{pattern}.")
  end

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

  pattern = Regexp.new(/^\d+$/)
  if !@collections_hero_pin_id.nil? && @collections_hero_pin_id !~ pattern
    invalid_properties.push("invalid value for \"collections_hero_pin_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 !@parent_id.nil? && @parent_id !~ pattern
    invalid_properties.push("invalid value for \"parent_id\", must conform to the pattern #{pattern}.")
  end

  invalid_properties
end

#to_hashHash

Returns the object in the form of hash

Returns:

  • (Hash)

    Returns the object in the form of hash



500
501
502
503
504
505
506
507
508
509
510
511
512
# File 'lib/pinterest_sdk/models/product_group_promotion.rb', line 500

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



350
351
352
353
354
355
356
357
358
# File 'lib/pinterest_sdk/models/product_group_promotion.rb', line 350

def valid?
  warn '[DEPRECATED] the `valid?` method is obsolete'
  return false if !@ad_group_id.nil? && @ad_group_id !~ Regexp.new(/^(AG)?\d+$/)
  return false if !@catalog_product_group_id.nil? && @catalog_product_group_id !~ Regexp.new(/^\d+$/)
  return false if !@collections_hero_pin_id.nil? && @collections_hero_pin_id !~ Regexp.new(/^\d+$/)
  return false if !@id.nil? && @id !~ Regexp.new(/^\d+$/)
  return false if !@parent_id.nil? && @parent_id !~ Regexp.new(/^\d+$/)
  true
end