Class: Zernio::AdCreative

Inherits:
ApiModelBase show all
Defined in:
lib/zernio-sdk/models/ad_creative.rb

Overview

Platform-specific creative data. Fields vary by platform.

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

Initializes the object

Parameters:

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

    Model attributes in the form of hash



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
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
# File 'lib/zernio-sdk/models/ad_creative.rb', line 197

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Instance Attribute Details

#asset_groupObject

Initial Performance Max asset group input. Use the asset-groups endpoint for current Google assets.



20
21
22
# File 'lib/zernio-sdk/models/ad_creative.rb', line 20

def asset_group
  @asset_group
end

#asset_group_resource_nameObject

Google resource name of the created Performance Max asset group.



23
24
25
# File 'lib/zernio-sdk/models/ad_creative.rb', line 23

def asset_group_resource_name
  @asset_group_resource_name
end

#bodyObject

Ad copy/text



80
81
82
# File 'lib/zernio-sdk/models/ad_creative.rb', line 80

def body
  @body
end

#creative_idObject

Meta ad creative id backing this ad. Reusable via existingCreativeId on POST /v1/ads/create.



47
48
49
# File 'lib/zernio-sdk/models/ad_creative.rb', line 47

def creative_id
  @creative_id
end

#descriptionsObject

Google RSA only. Replaces the complete description list. No padding or truncation on update.



29
30
31
# File 'lib/zernio-sdk/models/ad_creative.rb', line 29

def descriptions
  @descriptions
end

#effective_instagram_media_idObject

Meta effective_instagram_media_id, the Instagram media ID of the boosted post the ad's engagement lives on. Pass to GET /v1/ads?effectiveInstagramMediaId= to map a Business-Manager-visible IG post back to this ad.



62
63
64
# File 'lib/zernio-sdk/models/ad_creative.rb', line 62

def effective_instagram_media_id
  @effective_instagram_media_id
end

#effective_object_story_idObject

Meta effective_object_story_id, the {pageId}_{postId} of the Facebook post the ad's engagement (comments) lives on. Pass to GET /v1/ads?effectiveObjectStoryId= to map a Business-Manager-visible post back to this ad; GET /v1/ads/adId/comments resolves comments against it.



56
57
58
# File 'lib/zernio-sdk/models/ad_creative.rb', line 56

def effective_object_story_id
  @effective_object_story_id
end

#final_urlsObject

Google RSA only. Replaces final URLs. Omitted lists stay unchanged.



32
33
34
# File 'lib/zernio-sdk/models/ad_creative.rb', line 32

def final_urls
  @final_urls
end

#google_descriptionObject

Google Ads description



86
87
88
# File 'lib/zernio-sdk/models/ad_creative.rb', line 86

def google_description
  @google_description
end

#google_headlineObject

Google Ads headline



83
84
85
# File 'lib/zernio-sdk/models/ad_creative.rb', line 83

def google_headline
  @google_headline
end

#headlinesObject

Google RSA only. Replaces the complete headline list. No padding or truncation on update.



26
27
28
# File 'lib/zernio-sdk/models/ad_creative.rb', line 26

def headlines
  @headlines
end

#image_urlObject

Alternative image URL



38
39
40
# File 'lib/zernio-sdk/models/ad_creative.rb', line 38

def image_url
  @image_url
end

Meta instagram_permalink_url, the public Instagram post URL of the boosted media.



68
69
70
# File 'lib/zernio-sdk/models/ad_creative.rb', line 68

def instagram_permalink_url
  @instagram_permalink_url
end

#instagram_user_idObject

Meta instagram_user_id, the Instagram-scoped business ID that owns the boosted media.



65
66
67
# File 'lib/zernio-sdk/models/ad_creative.rb', line 65

def instagram_user_id
  @instagram_user_id
end

#is_servingObject

LinkedIn only. Whether LinkedIn is currently serving this specific creative. Complements the ad-level servingStatuses, which describes the parent campaign.



74
75
76
# File 'lib/zernio-sdk/models/ad_creative.rb', line 74

def is_serving
  @is_serving
end

Destination URL



89
90
91
# File 'lib/zernio-sdk/models/ad_creative.rb', line 89

def link_url
  @link_url
end

#media_urlsObject

All media URLs for this ad (carousel images, multiple assets). Populated for Meta (carousel child_attachments), Google Ads (responsive display marketing_images), and LinkedIn (multi-image posts).



71
72
73
# File 'lib/zernio-sdk/models/ad_creative.rb', line 71

def media_urls
  @media_urls
end

#object_story_idObject

Meta creative object_story_id (the SHARE reference). Frequently absent, because Meta omits it for SHARE creatives. Use effectiveObjectStoryId instead.



53
54
55
# File 'lib/zernio-sdk/models/ad_creative.rb', line 53

def object_story_id
  @object_story_id
end

#object_typeObject

Meta creative object_type (e.g. SHARE, VIDEO, PRIVACY_CHECK_FAIL, POST_DELETED). Use this to render state-aware previews: when Meta moderation strips image/video fields, only thumbnailUrl at 64x64 is available.



50
51
52
# File 'lib/zernio-sdk/models/ad_creative.rb', line 50

def object_type
  @object_type
end

#page_idObject

Facebook Page backing the creative (Meta only). What the pageId filter on /v1/ads, /v1/ads/campaigns and /v1/ads/tree matches against. Absent for non-Meta ads and rare Meta creatives with no page signal.



59
60
61
# File 'lib/zernio-sdk/models/ad_creative.rb', line 59

def page_id
  @page_id
end

#pinterest_descriptionObject

Returns the value of attribute pinterest_description.



98
99
100
# File 'lib/zernio-sdk/models/ad_creative.rb', line 98

def pinterest_description
  @pinterest_description
end

#pinterest_image_urlObject

Returns the value of attribute pinterest_image_url.



94
95
96
# File 'lib/zernio-sdk/models/ad_creative.rb', line 94

def pinterest_image_url
  @pinterest_image_url
end

#pinterest_titleObject

Returns the value of attribute pinterest_title.



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

def pinterest_title
  @pinterest_title
end

#serving_hold_reasonsObject

LinkedIn only. Why this specific creative is not being served. Empty when it is serving. A superset of the ad-level servingStatuses: it repeats the inherited campaign, campaign group and account holds AND adds creative-only causes such as UNDER_REVIEW, REJECTED, PROCESSING, PROCESSING_FAILED, FORM_HOLD (lead-gen-form creatives), REFERRED_CONTENT_QUALITY_HOLD, JOB_POSTING_ON_HOLD and JOB_POSTING_INVALID (job ads). Some values are format-specific and will never appear on other ad formats. The list is open, so treat unrecognized values as holds rather than errors.



77
78
79
# File 'lib/zernio-sdk/models/ad_creative.rb', line 77

def serving_hold_reasons
  @serving_hold_reasons
end

#thumbnail_urlObject

Primary thumbnail/image URL



35
36
37
# File 'lib/zernio-sdk/models/ad_creative.rb', line 35

def thumbnail_url
  @thumbnail_url
end

#video_idObject

Meta video ID for VIDEO-type ads. Null for non-video ads. Callers that need an embeddable MP4 can call GET /videoId?fields=source with the page access token.



41
42
43
# File 'lib/zernio-sdk/models/ad_creative.rb', line 41

def video_id
  @video_id
end

#video_urlObject

Public Facebook watch URL for VIDEO-type ads (https://www.facebook.com/watch/?v=videoId). Null for non-video ads.



44
45
46
# File 'lib/zernio-sdk/models/ad_creative.rb', line 44

def video_url
  @video_url
end

#whatsapp_phone_numberObject

Explicit E.164 WhatsApp number supplied when creating a Meta boost or messaging ad. Absent when omitted by the caller or on older records.



92
93
94
# File 'lib/zernio-sdk/models/ad_creative.rb', line 92

def whatsapp_phone_number
  @whatsapp_phone_number
end

Class Method Details

.acceptable_attribute_mapObject

Returns attribute mapping this model knows about



135
136
137
# File 'lib/zernio-sdk/models/ad_creative.rb', line 135

def self.acceptable_attribute_map
  attribute_map
end

.acceptable_attributesObject

Returns all the JSON keys this model knows about



140
141
142
# File 'lib/zernio-sdk/models/ad_creative.rb', line 140

def self.acceptable_attributes
  acceptable_attribute_map.values
end

.attribute_mapObject

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



101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
# File 'lib/zernio-sdk/models/ad_creative.rb', line 101

def self.attribute_map
  {
    :'asset_group' => :'assetGroup',
    :'asset_group_resource_name' => :'assetGroupResourceName',
    :'headlines' => :'headlines',
    :'descriptions' => :'descriptions',
    :'final_urls' => :'finalUrls',
    :'thumbnail_url' => :'thumbnailUrl',
    :'image_url' => :'imageUrl',
    :'video_id' => :'videoId',
    :'video_url' => :'videoUrl',
    :'creative_id' => :'creativeId',
    :'object_type' => :'objectType',
    :'object_story_id' => :'objectStoryId',
    :'effective_object_story_id' => :'effectiveObjectStoryId',
    :'page_id' => :'pageId',
    :'effective_instagram_media_id' => :'effectiveInstagramMediaId',
    :'instagram_user_id' => :'instagramUserId',
    :'instagram_permalink_url' => :'instagramPermalinkUrl',
    :'media_urls' => :'mediaUrls',
    :'is_serving' => :'isServing',
    :'serving_hold_reasons' => :'servingHoldReasons',
    :'body' => :'body',
    :'google_headline' => :'googleHeadline',
    :'google_description' => :'googleDescription',
    :'link_url' => :'linkUrl',
    :'whatsapp_phone_number' => :'whatsappPhoneNumber',
    :'pinterest_image_url' => :'pinterestImageUrl',
    :'pinterest_title' => :'pinterestTitle',
    :'pinterest_description' => :'pinterestDescription'
  }
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



474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
# File 'lib/zernio-sdk/models/ad_creative.rb', line 474

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



179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
# File 'lib/zernio-sdk/models/ad_creative.rb', line 179

def self.openapi_nullable
  Set.new([
    :'thumbnail_url',
    :'video_id',
    :'video_url',
    :'creative_id',
    :'object_story_id',
    :'effective_object_story_id',
    :'page_id',
    :'effective_instagram_media_id',
    :'instagram_user_id',
    :'instagram_permalink_url',
    :'is_serving',
  ])
end

.openapi_typesObject

Attribute type mapping.



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
# File 'lib/zernio-sdk/models/ad_creative.rb', line 145

def self.openapi_types
  {
    :'asset_group' => :'GooglePmaxAssetGroupInput',
    :'asset_group_resource_name' => :'String',
    :'headlines' => :'Array<GoogleRsaHeadline>',
    :'descriptions' => :'Array<GoogleRsaDescription>',
    :'final_urls' => :'Array<String>',
    :'thumbnail_url' => :'String',
    :'image_url' => :'String',
    :'video_id' => :'String',
    :'video_url' => :'String',
    :'creative_id' => :'String',
    :'object_type' => :'String',
    :'object_story_id' => :'String',
    :'effective_object_story_id' => :'String',
    :'page_id' => :'String',
    :'effective_instagram_media_id' => :'String',
    :'instagram_user_id' => :'String',
    :'instagram_permalink_url' => :'String',
    :'media_urls' => :'Array<String>',
    :'is_serving' => :'Boolean',
    :'serving_hold_reasons' => :'Array<String>',
    :'body' => :'String',
    :'google_headline' => :'String',
    :'google_description' => :'String',
    :'link_url' => :'String',
    :'whatsapp_phone_number' => :'String',
    :'pinterest_image_url' => :'String',
    :'pinterest_title' => :'String',
    :'pinterest_description' => :'String'
  }
end

Instance Method Details

#==(o) ⇒ Object

Checks equality by comparing each attribute.

Parameters:

  • Object (Object)

    to be compared



426
427
428
429
430
431
432
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
# File 'lib/zernio-sdk/models/ad_creative.rb', line 426

def ==(o)
  return true if self.equal?(o)
  self.class == o.class &&
      asset_group == o.asset_group &&
      asset_group_resource_name == o.asset_group_resource_name &&
      headlines == o.headlines &&
      descriptions == o.descriptions &&
      final_urls == o.final_urls &&
      thumbnail_url == o.thumbnail_url &&
      image_url == o.image_url &&
      video_id == o.video_id &&
      video_url == o.video_url &&
      creative_id == o.creative_id &&
      object_type == o.object_type &&
      object_story_id == o.object_story_id &&
      effective_object_story_id == o.effective_object_story_id &&
      page_id == o.page_id &&
      effective_instagram_media_id == o.effective_instagram_media_id &&
      instagram_user_id == o.instagram_user_id &&
      instagram_permalink_url == o.instagram_permalink_url &&
      media_urls == o.media_urls &&
      is_serving == o.is_serving &&
      serving_hold_reasons == o.serving_hold_reasons &&
      body == o.body &&
      google_headline == o.google_headline &&
      google_description == o.google_description &&
      link_url == o.link_url &&
      whatsapp_phone_number == o.whatsapp_phone_number &&
      pinterest_image_url == o.pinterest_image_url &&
      pinterest_title == o.pinterest_title &&
      pinterest_description == o.pinterest_description
end

#eql?(o) ⇒ Boolean

Parameters:

  • Object (Object)

    to be compared

Returns:

  • (Boolean)

See Also:

  • `==` method


461
462
463
# File 'lib/zernio-sdk/models/ad_creative.rb', line 461

def eql?(o)
  self == o
end

#hashInteger

Calculates hash code according to all attributes.

Returns:

  • (Integer)

    Hash code



467
468
469
# File 'lib/zernio-sdk/models/ad_creative.rb', line 467

def hash
  [asset_group, asset_group_resource_name, headlines, descriptions, final_urls, thumbnail_url, image_url, video_id, video_url, creative_id, object_type, object_story_id, effective_object_story_id, page_id, effective_instagram_media_id, instagram_user_id, instagram_permalink_url, media_urls, is_serving, serving_hold_reasons, body, google_headline, google_description, link_url, whatsapp_phone_number, pinterest_image_url, pinterest_title, pinterest_description].hash
end

#list_invalid_propertiesObject

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

Returns:

  • Array for valid properties with the reasons



336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
# File 'lib/zernio-sdk/models/ad_creative.rb', line 336

def list_invalid_properties
  warn '[DEPRECATED] the `list_invalid_properties` method is obsolete'
  invalid_properties = Array.new
  if !@headlines.nil? && @headlines.length > 15
    invalid_properties.push('invalid value for "headlines", number of items must be less than or equal to 15.')
  end

  if !@headlines.nil? && @headlines.length < 3
    invalid_properties.push('invalid value for "headlines", number of items must be greater than or equal to 3.')
  end

  if !@descriptions.nil? && @descriptions.length > 4
    invalid_properties.push('invalid value for "descriptions", number of items must be less than or equal to 4.')
  end

  if !@descriptions.nil? && @descriptions.length < 2
    invalid_properties.push('invalid value for "descriptions", number of items must be greater than or equal to 2.')
  end

  if !@final_urls.nil? && @final_urls.length < 1
    invalid_properties.push('invalid value for "final_urls", number of items must be greater than or equal to 1.')
  end

  invalid_properties
end

#to_hashHash

Returns the object in the form of hash

Returns:

  • (Hash)

    Returns the object in the form of hash



496
497
498
499
500
501
502
503
504
505
506
507
508
# File 'lib/zernio-sdk/models/ad_creative.rb', line 496

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



364
365
366
367
368
369
370
371
372
# File 'lib/zernio-sdk/models/ad_creative.rb', line 364

def valid?
  warn '[DEPRECATED] the `valid?` method is obsolete'
  return false if !@headlines.nil? && @headlines.length > 15
  return false if !@headlines.nil? && @headlines.length < 3
  return false if !@descriptions.nil? && @descriptions.length > 4
  return false if !@descriptions.nil? && @descriptions.length < 2
  return false if !@final_urls.nil? && @final_urls.length < 1
  true
end