Class: Zernio::UpdateAdRequestCreative
- Inherits:
-
ApiModelBase
- Object
- ApiModelBase
- Zernio::UpdateAdRequestCreative
- Defined in:
- lib/zernio-sdk/models/update_ad_request_creative.rb
Overview
Replace or patch the ad's creative. Meta, TikTok, and LinkedIn. - Meta: patch-style. Pass any subset: fields you omit are preserved from the live creative, including media (image_hash/video_id are reused, no re-upload) and url_tags. Sending the full set (headline, body, callToAction, linkUrl, imageUrl) rebuilds the creative from scratch instead. Partial patching reads the live object_story_spec, which Meta strips on SHARE / page-post / dark / asset_feed creatives. Those return 422 asking for the full set. A videoUrl/videoId on an image creative is a type change and also needs the full set. existingCreativeId repoints the ad at a creative from GET /v1/ads/creatives and ignores every other field. Meta creatives are immutable, so any change creates a new creative and repoints the ad; the old creative is retained on the ad account for historical reporting. promotion and creativeFeatures are Meta-only. Omitted settings are preserved from the live creative, including full rebuilds. Send promotion: null to remove the explicit offer from the replacement. A supplied creativeFeatures map overrides individual existing keys. - TikTok: patch-style. Pass any subset; headline is ignored (TikTok creatives have no headline slot). body becomes the in-feed ad_text; linkUrl becomes landing_page_url; videoUrl triggers a fresh upload. description, videoId and existingCreativeId are Meta-only and return 400. - LinkedIn: requires new media (image via imageUrl or video via videoUrl); a text-only creative update returns 400. Uploads the media, creates a new inline media creative on the same campaign, and pauses the old creative (best-effort). The old creative is retained for historical reporting. videoId and existingCreativeId are Meta-only and return 400.
Defined Under Namespace
Classes: EnumAttributeValidator
Instance Attribute Summary collapse
-
#body ⇒ Object
Returns the value of attribute body.
-
#call_to_action ⇒ Object
Returns the value of attribute call_to_action.
-
#creative_features ⇒ Object
Meta Advantage+ creative enhancements.
-
#description ⇒ Object
Link description slot (Meta
link_data.description/video_data.link_description, LinkedIn creative description). -
#existing_creative_id ⇒ Object
Meta only.
-
#headline ⇒ Object
Meta and LinkedIn (TikTok has no headline slot).
-
#image_url ⇒ Object
Returns the value of attribute image_url.
-
#link_url ⇒ Object
Returns the value of attribute link_url.
-
#promotion ⇒ Object
Returns the value of attribute promotion.
-
#video_id ⇒ Object
Meta only.
-
#video_url ⇒ Object
Returns the value of attribute video_url.
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 = {}) ⇒ UpdateAdRequestCreative
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 = {}) ⇒ UpdateAdRequestCreative
Initializes the object
120 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 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 |
# File 'lib/zernio-sdk/models/update_ad_request_creative.rb', line 120 def initialize(attributes = {}) if (!attributes.is_a?(Hash)) fail ArgumentError, "The input argument (attributes) must be a hash in `Zernio::UpdateAdRequestCreative` 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::UpdateAdRequestCreative`. 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?(:'promotion') self.promotion = attributes[:'promotion'] end if attributes.key?(:'creative_features') if (value = attributes[:'creative_features']).is_a?(Hash) self.creative_features = value end end if attributes.key?(:'headline') self.headline = attributes[:'headline'] end if attributes.key?(:'body') self.body = attributes[:'body'] end if attributes.key?(:'description') self.description = attributes[:'description'] end if attributes.key?(:'call_to_action') self.call_to_action = attributes[:'call_to_action'] end if attributes.key?(:'link_url') self.link_url = attributes[:'link_url'] end if attributes.key?(:'image_url') self.image_url = attributes[:'image_url'] end if attributes.key?(:'video_url') self.video_url = attributes[:'video_url'] end if attributes.key?(:'video_id') self.video_id = attributes[:'video_id'] end if attributes.key?(:'existing_creative_id') self.existing_creative_id = attributes[:'existing_creative_id'] end end |
Instance Attribute Details
#body ⇒ Object
Returns the value of attribute body.
27 28 29 |
# File 'lib/zernio-sdk/models/update_ad_request_creative.rb', line 27 def body @body end |
#call_to_action ⇒ Object
Returns the value of attribute call_to_action.
32 33 34 |
# File 'lib/zernio-sdk/models/update_ad_request_creative.rb', line 32 def call_to_action @call_to_action end |
#creative_features ⇒ Object
Meta Advantage+ creative enhancements. Map snake_case feature names to OPT_IN or OPT_OUT; Meta validates supported keys and unspecified features default to OPT_OUT. auto_promotion_tag is an enhancement; use the separate promotion field for an explicit offer. The deprecated standard_enhancements bundle is rejected by Meta.
22 23 24 |
# File 'lib/zernio-sdk/models/update_ad_request_creative.rb', line 22 def creative_features @creative_features end |
#description ⇒ Object
Link description slot (Meta link_data.description / video_data.link_description, LinkedIn creative description).
30 31 32 |
# File 'lib/zernio-sdk/models/update_ad_request_creative.rb', line 30 def description @description end |
#existing_creative_id ⇒ Object
Meta only. Repoint the ad at an existing library creative (from GET /v1/ads/creatives); all other creative fields are ignored.
44 45 46 |
# File 'lib/zernio-sdk/models/update_ad_request_creative.rb', line 44 def existing_creative_id @existing_creative_id end |
#headline ⇒ Object
Meta and LinkedIn (TikTok has no headline slot)
25 26 27 |
# File 'lib/zernio-sdk/models/update_ad_request_creative.rb', line 25 def headline @headline end |
#image_url ⇒ Object
Returns the value of attribute image_url.
36 37 38 |
# File 'lib/zernio-sdk/models/update_ad_request_creative.rb', line 36 def image_url @image_url end |
#link_url ⇒ Object
Returns the value of attribute link_url.
34 35 36 |
# File 'lib/zernio-sdk/models/update_ad_request_creative.rb', line 34 def link_url @link_url end |
#promotion ⇒ Object
Returns the value of attribute promotion.
19 20 21 |
# File 'lib/zernio-sdk/models/update_ad_request_creative.rb', line 19 def promotion @promotion end |
#video_id ⇒ Object
Meta only. Reuse an already-uploaded ad video (from POST /v1/ads/videos or GET /v1/ads/videos) instead of re-uploading via videoUrl.
41 42 43 |
# File 'lib/zernio-sdk/models/update_ad_request_creative.rb', line 41 def video_id @video_id end |
#video_url ⇒ Object
Returns the value of attribute video_url.
38 39 40 |
# File 'lib/zernio-sdk/models/update_ad_request_creative.rb', line 38 def video_url @video_url end |
Class Method Details
.acceptable_attribute_map ⇒ Object
Returns attribute mapping this model knows about
86 87 88 |
# File 'lib/zernio-sdk/models/update_ad_request_creative.rb', line 86 def self.acceptable_attribute_map attribute_map end |
.acceptable_attributes ⇒ Object
Returns all the JSON keys this model knows about
91 92 93 |
# File 'lib/zernio-sdk/models/update_ad_request_creative.rb', line 91 def self.acceptable_attributes acceptable_attribute_map.values end |
.attribute_map ⇒ Object
Attribute mapping from ruby-style variable name to JSON key.
69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 |
# File 'lib/zernio-sdk/models/update_ad_request_creative.rb', line 69 def self.attribute_map { :'promotion' => :'promotion', :'creative_features' => :'creativeFeatures', :'headline' => :'headline', :'body' => :'body', :'description' => :'description', :'call_to_action' => :'callToAction', :'link_url' => :'linkUrl', :'image_url' => :'imageUrl', :'video_url' => :'videoUrl', :'video_id' => :'videoId', :'existing_creative_id' => :'existingCreativeId' } end |
.build_from_hash(attributes) ⇒ Object
Builds the object from hash
248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 |
# File 'lib/zernio-sdk/models/update_ad_request_creative.rb', line 248 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
113 114 115 116 |
# File 'lib/zernio-sdk/models/update_ad_request_creative.rb', line 113 def self.openapi_nullable Set.new([ ]) end |
.openapi_types ⇒ Object
Attribute type mapping.
96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 |
# File 'lib/zernio-sdk/models/update_ad_request_creative.rb', line 96 def self.openapi_types { :'promotion' => :'MetaPromotion', :'creative_features' => :'Hash<String, String>', :'headline' => :'String', :'body' => :'String', :'description' => :'String', :'call_to_action' => :'String', :'link_url' => :'String', :'image_url' => :'String', :'video_url' => :'String', :'video_id' => :'String', :'existing_creative_id' => :'String' } end |
Instance Method Details
#==(o) ⇒ Object
Checks equality by comparing each attribute.
217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 |
# File 'lib/zernio-sdk/models/update_ad_request_creative.rb', line 217 def ==(o) return true if self.equal?(o) self.class == o.class && promotion == o.promotion && creative_features == o.creative_features && headline == o.headline && body == o.body && description == o.description && call_to_action == o.call_to_action && link_url == o.link_url && image_url == o.image_url && video_url == o.video_url && video_id == o.video_id && existing_creative_id == o.existing_creative_id end |
#eql?(o) ⇒ Boolean
235 236 237 |
# File 'lib/zernio-sdk/models/update_ad_request_creative.rb', line 235 def eql?(o) self == o end |
#hash ⇒ Integer
Calculates hash code according to all attributes.
241 242 243 |
# File 'lib/zernio-sdk/models/update_ad_request_creative.rb', line 241 def hash [promotion, creative_features, headline, body, description, call_to_action, link_url, image_url, video_url, video_id, existing_creative_id].hash end |
#list_invalid_properties ⇒ Object
Show invalid properties with the reasons. Usually used together with valid?
183 184 185 186 187 188 189 190 191 |
# File 'lib/zernio-sdk/models/update_ad_request_creative.rb', line 183 def list_invalid_properties warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' invalid_properties = Array.new if !@description.nil? && @description.to_s.length > 255 invalid_properties.push('invalid value for "description", the character length must be smaller than or equal to 255.') end invalid_properties end |
#to_hash ⇒ Hash
Returns the object in the form of hash
270 271 272 273 274 275 276 277 278 279 280 281 282 |
# File 'lib/zernio-sdk/models/update_ad_request_creative.rb', line 270 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
195 196 197 198 199 |
# File 'lib/zernio-sdk/models/update_ad_request_creative.rb', line 195 def valid? warn '[DEPRECATED] the `valid?` method is obsolete' return false if !@description.nil? && @description.to_s.length > 255 true end |