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.
-
#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. -
#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).
-
#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.
-
#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
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 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 |
# File 'lib/zernio-sdk/models/ad_creative.rb', line 143 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?(:'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?(:'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?(:'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
53 54 55 |
# File 'lib/zernio-sdk/models/ad_creative.rb', line 53 def body @body 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.
41 42 43 |
# File 'lib/zernio-sdk/models/ad_creative.rb', line 41 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.
38 39 40 |
# File 'lib/zernio-sdk/models/ad_creative.rb', line 38 def effective_object_story_id @effective_object_story_id end |
#google_description ⇒ Object
Google Ads description
59 60 61 |
# File 'lib/zernio-sdk/models/ad_creative.rb', line 59 def google_description @google_description end |
#google_headline ⇒ Object
Google Ads headline
56 57 58 |
# File 'lib/zernio-sdk/models/ad_creative.rb', line 56 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.
47 48 49 |
# File 'lib/zernio-sdk/models/ad_creative.rb', line 47 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.
44 45 46 |
# File 'lib/zernio-sdk/models/ad_creative.rb', line 44 def instagram_user_id @instagram_user_id end |
#link_url ⇒ Object
Destination URL
62 63 64 |
# File 'lib/zernio-sdk/models/ad_creative.rb', line 62 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).
50 51 52 |
# File 'lib/zernio-sdk/models/ad_creative.rb', line 50 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.
35 36 37 |
# File 'lib/zernio-sdk/models/ad_creative.rb', line 35 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.
32 33 34 |
# File 'lib/zernio-sdk/models/ad_creative.rb', line 32 def object_type @object_type end |
#pinterest_description ⇒ Object
Returns the value of attribute pinterest_description.
68 69 70 |
# File 'lib/zernio-sdk/models/ad_creative.rb', line 68 def pinterest_description @pinterest_description end |
#pinterest_image_url ⇒ Object
Returns the value of attribute pinterest_image_url.
64 65 66 |
# File 'lib/zernio-sdk/models/ad_creative.rb', line 64 def pinterest_image_url @pinterest_image_url end |
#pinterest_title ⇒ Object
Returns the value of attribute pinterest_title.
66 67 68 |
# File 'lib/zernio-sdk/models/ad_creative.rb', line 66 def pinterest_title @pinterest_title 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
95 96 97 |
# File 'lib/zernio-sdk/models/ad_creative.rb', line 95 def self.acceptable_attribute_map attribute_map end |
.acceptable_attributes ⇒ Object
Returns all the JSON keys this model knows about
100 101 102 |
# File 'lib/zernio-sdk/models/ad_creative.rb', line 100 def self.acceptable_attributes acceptable_attribute_map.values end |
.attribute_map ⇒ Object
Attribute mapping from ruby-style variable name to JSON key.
71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 |
# File 'lib/zernio-sdk/models/ad_creative.rb', line 71 def self.attribute_map { :'thumbnail_url' => :'thumbnailUrl', :'image_url' => :'imageUrl', :'video_id' => :'videoId', :'video_url' => :'videoUrl', :'object_type' => :'objectType', :'object_story_id' => :'objectStoryId', :'effective_object_story_id' => :'effectiveObjectStoryId', :'effective_instagram_media_id' => :'effectiveInstagramMediaId', :'instagram_user_id' => :'instagramUserId', :'instagram_permalink_url' => :'instagramPermalinkUrl', :'media_urls' => :'mediaUrls', :'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
287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 |
# File 'lib/zernio-sdk/models/ad_creative.rb', line 287 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
129 130 131 132 133 134 135 136 137 138 139 |
# File 'lib/zernio-sdk/models/ad_creative.rb', line 129 def self.openapi_nullable Set.new([ :'video_id', :'video_url', :'object_story_id', :'effective_object_story_id', :'effective_instagram_media_id', :'instagram_user_id', :'instagram_permalink_url', ]) end |
.openapi_types ⇒ Object
Attribute type mapping.
105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 |
# File 'lib/zernio-sdk/models/ad_creative.rb', line 105 def self.openapi_types { :'thumbnail_url' => :'String', :'image_url' => :'String', :'video_id' => :'String', :'video_url' => :'String', :'object_type' => :'String', :'object_story_id' => :'String', :'effective_object_story_id' => :'String', :'effective_instagram_media_id' => :'String', :'instagram_user_id' => :'String', :'instagram_permalink_url' => :'String', :'media_urls' => :'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.
249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 |
# File 'lib/zernio-sdk/models/ad_creative.rb', line 249 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 && object_type == o.object_type && object_story_id == o.object_story_id && effective_object_story_id == o.effective_object_story_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 && 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
274 275 276 |
# File 'lib/zernio-sdk/models/ad_creative.rb', line 274 def eql?(o) self == o end |
#hash ⇒ Integer
Calculates hash code according to all attributes.
280 281 282 |
# File 'lib/zernio-sdk/models/ad_creative.rb', line 280 def hash [thumbnail_url, image_url, video_id, video_url, object_type, object_story_id, effective_object_story_id, effective_instagram_media_id, instagram_user_id, instagram_permalink_url, media_urls, 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?
234 235 236 237 238 |
# File 'lib/zernio-sdk/models/ad_creative.rb', line 234 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
309 310 311 312 313 314 315 316 317 318 319 320 321 |
# File 'lib/zernio-sdk/models/ad_creative.rb', line 309 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
242 243 244 245 |
# File 'lib/zernio-sdk/models/ad_creative.rb', line 242 def valid? warn '[DEPRECATED] the `valid?` method is obsolete' true end |