Class: Zernio::AdCreative
- Inherits:
-
ApiModelBase
- Object
- ApiModelBase
- Zernio::AdCreative
- Defined in:
- lib/zernio-sdk/models/ad_creative.rb
Overview
Platform-specific creative data. Fields vary by platform.
Instance Attribute Summary collapse
-
#body ⇒ Object
Ad copy/text.
-
#creative_id ⇒ Object
Meta ad creative id backing this ad.
-
#effective_instagram_media_id ⇒ Object
Meta
effective_instagram_media_id— the Instagram media ID of the boosted post the ad's engagement lives on. -
#effective_object_story_id ⇒ Object
Meta
effective_object_story_id—{pageId}_{postId}of the Facebook post the ad's engagement (comments) lives on. -
#google_description ⇒ Object
Google Ads description.
-
#google_headline ⇒ Object
Google Ads headline.
-
#image_url ⇒ Object
Alternative image URL.
-
#instagram_permalink_url ⇒ Object
Meta
instagram_permalink_url— public Instagram post URL of the boosted media. -
#instagram_user_id ⇒ Object
Meta
instagram_user_id— the Instagram-scoped business ID that owns the boosted media. -
#is_serving ⇒ Object
LinkedIn only.
-
#link_url ⇒ Object
Destination URL.
-
#media_urls ⇒ Object
All media URLs for this ad (carousel images, multiple assets).
-
#object_story_id ⇒ Object
Meta creative
object_story_id(the SHARE reference). -
#object_type ⇒ Object
Meta creative object_type (e.g. SHARE, VIDEO, PRIVACY_CHECK_FAIL, POST_DELETED).
-
#page_id ⇒ Object
Facebook Page backing the creative (Meta only).
-
#pinterest_description ⇒ Object
Returns the value of attribute pinterest_description.
-
#pinterest_image_url ⇒ Object
Returns the value of attribute pinterest_image_url.
-
#pinterest_title ⇒ Object
Returns the value of attribute pinterest_title.
-
#serving_hold_reasons ⇒ Object
LinkedIn only.
-
#thumbnail_url ⇒ Object
Primary thumbnail/image URL.
-
#video_id ⇒ Object
Meta video ID for VIDEO-type ads.
-
#video_url ⇒ Object
Public Facebook watch URL for VIDEO-type ads (https://www.facebook.com/watch/?v=videoId).
Class Method Summary collapse
-
.acceptable_attribute_map ⇒ Object
Returns attribute mapping this model knows about.
-
.acceptable_attributes ⇒ Object
Returns all the JSON keys this model knows about.
-
.attribute_map ⇒ Object
Attribute mapping from ruby-style variable name to JSON key.
-
.build_from_hash(attributes) ⇒ Object
Builds the object from hash.
-
.openapi_nullable ⇒ Object
List of attributes with nullable: true.
-
.openapi_types ⇒ Object
Attribute type mapping.
Instance Method Summary collapse
-
#==(o) ⇒ Object
Checks equality by comparing each attribute.
- #eql?(o) ⇒ Boolean
-
#hash ⇒ Integer
Calculates hash code according to all attributes.
-
#initialize(attributes = {}) ⇒ AdCreative
constructor
Initializes the object.
-
#list_invalid_properties ⇒ Object
Show invalid properties with the reasons.
-
#to_hash ⇒ Hash
Returns the object in the form of hash.
-
#valid? ⇒ Boolean
Check to see if the all the properties in the model are valid.
Methods inherited from ApiModelBase
_deserialize, #_to_hash, #to_body, #to_s
Constructor Details
#initialize(attributes = {}) ⇒ AdCreative
Initializes the object
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 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 |
# File 'lib/zernio-sdk/models/ad_creative.rb', line 167 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?(:'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?(:'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
#body ⇒ Object
Ad copy/text
65 66 67 |
# File 'lib/zernio-sdk/models/ad_creative.rb', line 65 def body @body end |
#creative_id ⇒ Object
Meta ad creative id backing this ad. Reusable via existingCreativeId on POST /v1/ads/create.
32 33 34 |
# File 'lib/zernio-sdk/models/ad_creative.rb', line 32 def creative_id @creative_id end |
#effective_instagram_media_id ⇒ Object
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.
47 48 49 |
# File 'lib/zernio-sdk/models/ad_creative.rb', line 47 def effective_instagram_media_id @effective_instagram_media_id end |
#effective_object_story_id ⇒ Object
Meta effective_object_story_id — {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.
41 42 43 |
# File 'lib/zernio-sdk/models/ad_creative.rb', line 41 def effective_object_story_id @effective_object_story_id end |
#google_description ⇒ Object
Google Ads description
71 72 73 |
# File 'lib/zernio-sdk/models/ad_creative.rb', line 71 def google_description @google_description end |
#google_headline ⇒ Object
Google Ads headline
68 69 70 |
# File 'lib/zernio-sdk/models/ad_creative.rb', line 68 def google_headline @google_headline end |
#image_url ⇒ Object
Alternative image URL
23 24 25 |
# File 'lib/zernio-sdk/models/ad_creative.rb', line 23 def image_url @image_url end |
#instagram_permalink_url ⇒ Object
Meta instagram_permalink_url — public Instagram post URL of the boosted media.
53 54 55 |
# File 'lib/zernio-sdk/models/ad_creative.rb', line 53 def instagram_permalink_url @instagram_permalink_url end |
#instagram_user_id ⇒ Object
Meta instagram_user_id — the Instagram-scoped business ID that owns the boosted media.
50 51 52 |
# File 'lib/zernio-sdk/models/ad_creative.rb', line 50 def instagram_user_id @instagram_user_id end |
#is_serving ⇒ Object
LinkedIn only. Whether LinkedIn is currently serving this specific creative. Complements the ad-level servingStatuses, which describes the parent campaign.
59 60 61 |
# File 'lib/zernio-sdk/models/ad_creative.rb', line 59 def is_serving @is_serving end |
#link_url ⇒ Object
Destination URL
74 75 76 |
# File 'lib/zernio-sdk/models/ad_creative.rb', line 74 def link_url @link_url end |
#media_urls ⇒ Object
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).
56 57 58 |
# File 'lib/zernio-sdk/models/ad_creative.rb', line 56 def media_urls @media_urls end |
#object_story_id ⇒ Object
Meta creative object_story_id (the SHARE reference). Frequently absent — Meta omits it for SHARE creatives. Use effectiveObjectStoryId instead.
38 39 40 |
# File 'lib/zernio-sdk/models/ad_creative.rb', line 38 def object_story_id @object_story_id end |
#object_type ⇒ Object
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.
35 36 37 |
# File 'lib/zernio-sdk/models/ad_creative.rb', line 35 def object_type @object_type end |
#page_id ⇒ Object
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.
44 45 46 |
# File 'lib/zernio-sdk/models/ad_creative.rb', line 44 def page_id @page_id end |
#pinterest_description ⇒ Object
Returns the value of attribute pinterest_description.
80 81 82 |
# File 'lib/zernio-sdk/models/ad_creative.rb', line 80 def pinterest_description @pinterest_description end |
#pinterest_image_url ⇒ Object
Returns the value of attribute pinterest_image_url.
76 77 78 |
# File 'lib/zernio-sdk/models/ad_creative.rb', line 76 def pinterest_image_url @pinterest_image_url end |
#pinterest_title ⇒ Object
Returns the value of attribute pinterest_title.
78 79 80 |
# File 'lib/zernio-sdk/models/ad_creative.rb', line 78 def pinterest_title @pinterest_title end |
#serving_hold_reasons ⇒ Object
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.
62 63 64 |
# File 'lib/zernio-sdk/models/ad_creative.rb', line 62 def serving_hold_reasons @serving_hold_reasons end |
#thumbnail_url ⇒ Object
Primary thumbnail/image URL
20 21 22 |
# File 'lib/zernio-sdk/models/ad_creative.rb', line 20 def thumbnail_url @thumbnail_url end |
#video_id ⇒ Object
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.
26 27 28 |
# File 'lib/zernio-sdk/models/ad_creative.rb', line 26 def video_id @video_id end |
#video_url ⇒ Object
Public Facebook watch URL for VIDEO-type ads (https://www.facebook.com/watch/?v=videoId). Null for non-video ads.
29 30 31 |
# File 'lib/zernio-sdk/models/ad_creative.rb', line 29 def video_url @video_url end |
Class Method Details
.acceptable_attribute_map ⇒ Object
Returns attribute mapping this model knows about
111 112 113 |
# File 'lib/zernio-sdk/models/ad_creative.rb', line 111 def self.acceptable_attribute_map attribute_map end |
.acceptable_attributes ⇒ Object
Returns all the JSON keys this model knows about
116 117 118 |
# File 'lib/zernio-sdk/models/ad_creative.rb', line 116 def self.acceptable_attributes acceptable_attribute_map.values end |
.attribute_map ⇒ Object
Attribute mapping from ruby-style variable name to JSON key.
83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 |
# File 'lib/zernio-sdk/models/ad_creative.rb', line 83 def self.attribute_map { :'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', :'pinterest_image_url' => :'pinterestImageUrl', :'pinterest_title' => :'pinterestTitle', :'pinterest_description' => :'pinterestDescription' } end |
.build_from_hash(attributes) ⇒ Object
Builds the object from hash
333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 |
# File 'lib/zernio-sdk/models/ad_creative.rb', line 333 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_nullable ⇒ Object
List of attributes with nullable: true
149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 |
# File 'lib/zernio-sdk/models/ad_creative.rb', line 149 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_types ⇒ Object
Attribute type mapping.
121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 |
# File 'lib/zernio-sdk/models/ad_creative.rb', line 121 def self.openapi_types { :'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', :'pinterest_image_url' => :'String', :'pinterest_title' => :'String', :'pinterest_description' => :'String' } end |
Instance Method Details
#==(o) ⇒ Object
Checks equality by comparing each attribute.
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/zernio-sdk/models/ad_creative.rb', line 291 def ==(o) return true if self.equal?(o) self.class == o.class && 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 && pinterest_image_url == o.pinterest_image_url && pinterest_title == o.pinterest_title && pinterest_description == o.pinterest_description end |
#eql?(o) ⇒ Boolean
320 321 322 |
# File 'lib/zernio-sdk/models/ad_creative.rb', line 320 def eql?(o) self == o end |
#hash ⇒ Integer
Calculates hash code according to all attributes.
326 327 328 |
# File 'lib/zernio-sdk/models/ad_creative.rb', line 326 def hash [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, pinterest_image_url, pinterest_title, pinterest_description].hash end |
#list_invalid_properties ⇒ Object
Show invalid properties with the reasons. Usually used together with valid?
276 277 278 279 280 |
# File 'lib/zernio-sdk/models/ad_creative.rb', line 276 def list_invalid_properties warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' invalid_properties = Array.new invalid_properties end |
#to_hash ⇒ Hash
Returns the object in the form of hash
355 356 357 358 359 360 361 362 363 364 365 366 367 |
# File 'lib/zernio-sdk/models/ad_creative.rb', line 355 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
284 285 286 287 |
# File 'lib/zernio-sdk/models/ad_creative.rb', line 284 def valid? warn '[DEPRECATED] the `valid?` method is obsolete' true end |