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



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

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



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

Collections ad header type



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

def collections_header_type
  @collections_header_type
end

#collections_hero_destination_urlObject

Collections Hero Destination Url



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

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



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

def collections_hero_pin_id
  @collections_hero_pin_id
end

#creative_typeObject

Returns the value of attribute creative_type.



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

def creative_type
  @creative_type
end

#customizable_cta_typeObject

Select a call to action (CTA) to display below your ad. CTA options for catalog sales campaigns are SHOP_NOW, BOOK_NOW, ON_SALE, GET_DEAL, BUY_ONLINE_PICKUP_IN_STORE



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

def customizable_cta_type
  @customizable_cta_type
end

#definitionObject

The full product group definition path



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

def definition
  @definition
end

#grid_click_typeObject

Returns the value of attribute grid_click_type.



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

def grid_click_type
  @grid_click_type
end

#idObject

ID of the product group promotion.



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

def id
  @id
end

#includedObject

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



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

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.



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

def is_generate_background
  @is_generate_background
end

#is_mdlObject

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



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

def is_mdl
  @is_mdl
end

#parent_idObject

The parent Product Group ID of this Product Group



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

def parent_id
  @parent_id
end

#preferred_media_typeObject

Select whether to promote the image or video pin by default for items in the promoted product group. If selecting IMAGE, image will be promoted for all ads in the product group, and when selecting VIDEO, video will be promoted when present, otherwise fall back to image. This is applicable for standard shopping ads only.



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



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

def self.acceptable_attribute_map
  attribute_map
end

.acceptable_attributesObject

Returns all the JSON keys this model knows about



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

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



508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
# File 'lib/pinterest_sdk/models/product_group_promotion.rb', line 508

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



180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
# File 'lib/pinterest_sdk/models/product_group_promotion.rb', line 180

def self.openapi_nullable
  Set.new([
    :'bid_in_micro_currency',
    :'catalog_product_group_id',
    :'catalog_product_group_name',
    :'collections_header_type',
    :'collections_hero_destination_url',
    :'collections_hero_pin_id',
    :'customizable_cta_type',
    :'definition',
    :'grid_click_type',
    :'included',
    :'is_generate_background',
    :'is_mdl',
    :'parent_id',
    :'preferred_media_type',
    :'relative_definition',
    :'selected_image_tag',
    :'selected_video_tag',
    :'slideshow_collections_description',
    :'slideshow_collections_title',
    :'tracking_url'
  ])
end

.openapi_typesObject

Attribute type mapping.



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

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' => :'String',
    :'collections_hero_destination_url' => :'String',
    :'collections_hero_pin_id' => :'String',
    :'creative_type' => :'CreativeType',
    :'customizable_cta_type' => :'String',
    :'definition' => :'String',
    :'grid_click_type' => :'GridClickType',
    :'id' => :'String',
    :'included' => :'Boolean',
    :'is_generate_background' => :'Boolean',
    :'is_mdl' => :'Boolean',
    :'parent_id' => :'String',
    :'preferred_media_type' => :'String',
    :'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



464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
# File 'lib/pinterest_sdk/models/product_group_promotion.rb', line 464

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


495
496
497
# File 'lib/pinterest_sdk/models/product_group_promotion.rb', line 495

def eql?(o)
  self == o
end

#hashInteger

Calculates hash code according to all attributes.

Returns:

  • (Integer)

    Hash code



501
502
503
# File 'lib/pinterest_sdk/models/product_group_promotion.rb', line 501

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



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

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



530
531
532
533
534
535
536
537
538
539
540
541
542
# File 'lib/pinterest_sdk/models/product_group_promotion.rb', line 530

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



353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
# File 'lib/pinterest_sdk/models/product_group_promotion.rb', line 353

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+$/)
  collections_header_type_validator = EnumAttributeValidator.new('String', ["SHOP_THIS_COLLECTION", "EXPLORE_THIS_COLLECTION", "NO_HEADER", "ON_SALE", "GET_DEAL"])
  return false unless collections_header_type_validator.valid?(@collections_header_type)
  return false if !@collections_hero_pin_id.nil? && @collections_hero_pin_id !~ Regexp.new(/^\d+$/)
  customizable_cta_type_validator = EnumAttributeValidator.new('String', ["SHOP_NOW", "BOOK_NOW", "ON_SALE", "GET_DEAL", "BUY_ONLINE_PICKUP_IN_STORE"])
  return false unless customizable_cta_type_validator.valid?(@customizable_cta_type)
  return false if !@id.nil? && @id !~ Regexp.new(/^\d+$/)
  return false if !@parent_id.nil? && @parent_id !~ Regexp.new(/^\d+$/)
  preferred_media_type_validator = EnumAttributeValidator.new('String', ["VIDEO", "IMAGE"])
  return false unless preferred_media_type_validator.valid?(@preferred_media_type)
  true
end