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. - 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.
Instance Attribute Summary collapse
-
#body ⇒ Object
Returns the value of attribute body.
-
#call_to_action ⇒ Object
Returns the value of attribute call_to_action.
-
#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.
-
#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
89 90 91 92 93 94 95 96 97 98 99 100 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 133 134 135 136 137 138 |
# File 'lib/zernio-sdk/models/update_ad_request_creative.rb', line 89 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?(:'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.
22 23 24 |
# File 'lib/zernio-sdk/models/update_ad_request_creative.rb', line 22 def body @body end |
#call_to_action ⇒ Object
Returns the value of attribute call_to_action.
27 28 29 |
# File 'lib/zernio-sdk/models/update_ad_request_creative.rb', line 27 def call_to_action @call_to_action end |
#description ⇒ Object
Link description slot (Meta link_data.description / video_data.link_description, LinkedIn creative description).
25 26 27 |
# File 'lib/zernio-sdk/models/update_ad_request_creative.rb', line 25 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.
39 40 41 |
# File 'lib/zernio-sdk/models/update_ad_request_creative.rb', line 39 def existing_creative_id @existing_creative_id end |
#headline ⇒ Object
Meta and LinkedIn (TikTok has no headline slot)
20 21 22 |
# File 'lib/zernio-sdk/models/update_ad_request_creative.rb', line 20 def headline @headline end |
#image_url ⇒ Object
Returns the value of attribute image_url.
31 32 33 |
# File 'lib/zernio-sdk/models/update_ad_request_creative.rb', line 31 def image_url @image_url end |
#link_url ⇒ Object
Returns the value of attribute link_url.
29 30 31 |
# File 'lib/zernio-sdk/models/update_ad_request_creative.rb', line 29 def link_url @link_url 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.
36 37 38 |
# File 'lib/zernio-sdk/models/update_ad_request_creative.rb', line 36 def video_id @video_id end |
#video_url ⇒ Object
Returns the value of attribute video_url.
33 34 35 |
# File 'lib/zernio-sdk/models/update_ad_request_creative.rb', line 33 def video_url @video_url end |
Class Method Details
.acceptable_attribute_map ⇒ Object
Returns attribute mapping this model knows about
57 58 59 |
# File 'lib/zernio-sdk/models/update_ad_request_creative.rb', line 57 def self.acceptable_attribute_map attribute_map end |
.acceptable_attributes ⇒ Object
Returns all the JSON keys this model knows about
62 63 64 |
# File 'lib/zernio-sdk/models/update_ad_request_creative.rb', line 62 def self.acceptable_attributes acceptable_attribute_map.values end |
.attribute_map ⇒ Object
Attribute mapping from ruby-style variable name to JSON key.
42 43 44 45 46 47 48 49 50 51 52 53 54 |
# File 'lib/zernio-sdk/models/update_ad_request_creative.rb', line 42 def self.attribute_map { :'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
205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 |
# File 'lib/zernio-sdk/models/update_ad_request_creative.rb', line 205 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
82 83 84 85 |
# File 'lib/zernio-sdk/models/update_ad_request_creative.rb', line 82 def self.openapi_nullable Set.new([ ]) end |
.openapi_types ⇒ Object
Attribute type mapping.
67 68 69 70 71 72 73 74 75 76 77 78 79 |
# File 'lib/zernio-sdk/models/update_ad_request_creative.rb', line 67 def self.openapi_types { :'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.
176 177 178 179 180 181 182 183 184 185 186 187 188 |
# File 'lib/zernio-sdk/models/update_ad_request_creative.rb', line 176 def ==(o) return true if self.equal?(o) self.class == o.class && 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
192 193 194 |
# File 'lib/zernio-sdk/models/update_ad_request_creative.rb', line 192 def eql?(o) self == o end |
#hash ⇒ Integer
Calculates hash code according to all attributes.
198 199 200 |
# File 'lib/zernio-sdk/models/update_ad_request_creative.rb', line 198 def hash [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?
142 143 144 145 146 147 148 149 150 |
# File 'lib/zernio-sdk/models/update_ad_request_creative.rb', line 142 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
227 228 229 230 231 232 233 234 235 236 237 238 239 |
# File 'lib/zernio-sdk/models/update_ad_request_creative.rb', line 227 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
154 155 156 157 158 |
# File 'lib/zernio-sdk/models/update_ad_request_creative.rb', line 154 def valid? warn '[DEPRECATED] the `valid?` method is obsolete' return false if !@description.nil? && @description.to_s.length > 255 true end |