Class: Zernio::CreateStandaloneAdRequestCreativesInner
- Inherits:
-
ApiModelBase
- Object
- ApiModelBase
- Zernio::CreateStandaloneAdRequestCreativesInner
- Defined in:
- lib/zernio-sdk/models/create_standalone_ad_request_creatives_inner.rb
Overview
Each creative must supply EXACTLY ONE of imageUrl (image creative) or video (video creative).
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
Replaces the entire top-level creativeFeatures map for this item.
-
#description ⇒ Object
Link description for this ad (link_data.description; video creatives: video_data.link_description).
-
#headline ⇒ Object
Returns the value of attribute headline.
-
#image_url ⇒ Object
Image creative.
-
#link_url ⇒ Object
Returns the value of attribute link_url.
-
#name ⇒ Object
Exact name for this ad.
-
#video ⇒ Object
Returns the value of attribute video.
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 = {}) ⇒ CreateStandaloneAdRequestCreativesInner
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 = {}) ⇒ CreateStandaloneAdRequestCreativesInner
Initializes the object
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 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 |
# File 'lib/zernio-sdk/models/create_standalone_ad_request_creatives_inner.rb', line 111 def initialize(attributes = {}) if (!attributes.is_a?(Hash)) fail ArgumentError, "The input argument (attributes) must be a hash in `Zernio::CreateStandaloneAdRequestCreativesInner` 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::CreateStandaloneAdRequestCreativesInner`. 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?(:'creative_features') if (value = attributes[:'creative_features']).is_a?(Hash) self.creative_features = value end end if attributes.key?(:'name') self.name = attributes[:'name'] end if attributes.key?(:'headline') self.headline = attributes[:'headline'] else self.headline = nil end if attributes.key?(:'body') self.body = attributes[:'body'] else self.body = nil end if attributes.key?(:'description') self.description = attributes[:'description'] end if attributes.key?(:'image_url') self.image_url = attributes[:'image_url'] end if attributes.key?(:'video') self.video = attributes[:'video'] end if attributes.key?(:'link_url') self.link_url = attributes[:'link_url'] else self.link_url = nil end if attributes.key?(:'call_to_action') self.call_to_action = attributes[:'call_to_action'] else self.call_to_action = nil end end |
Instance Attribute Details
#body ⇒ Object
Returns the value of attribute body.
27 28 29 |
# File 'lib/zernio-sdk/models/create_standalone_ad_request_creatives_inner.rb', line 27 def body @body end |
#call_to_action ⇒ Object
Returns the value of attribute call_to_action.
39 40 41 |
# File 'lib/zernio-sdk/models/create_standalone_ad_request_creatives_inner.rb', line 39 def call_to_action @call_to_action end |
#creative_features ⇒ Object
Replaces the entire top-level creativeFeatures map for this item. Omit to inherit; an empty map clears these defaults.
20 21 22 |
# File 'lib/zernio-sdk/models/create_standalone_ad_request_creatives_inner.rb', line 20 def creative_features @creative_features end |
#description ⇒ Object
Link description for this ad (link_data.description; video creatives: video_data.link_description). Falls back to the top-level description; when both are omitted Meta scrapes the destination URL's OG description.
30 31 32 |
# File 'lib/zernio-sdk/models/create_standalone_ad_request_creatives_inner.rb', line 30 def description @description end |
#headline ⇒ Object
Returns the value of attribute headline.
25 26 27 |
# File 'lib/zernio-sdk/models/create_standalone_ad_request_creatives_inner.rb', line 25 def headline @headline end |
#image_url ⇒ Object
Image creative. Mutually exclusive with video.
33 34 35 |
# File 'lib/zernio-sdk/models/create_standalone_ad_request_creatives_inner.rb', line 33 def image_url @image_url end |
#link_url ⇒ Object
Returns the value of attribute link_url.
37 38 39 |
# File 'lib/zernio-sdk/models/create_standalone_ad_request_creatives_inner.rb', line 37 def link_url @link_url end |
#name ⇒ Object
Exact name for this ad. Falls back to <name> #N (N = 1-based position).
23 24 25 |
# File 'lib/zernio-sdk/models/create_standalone_ad_request_creatives_inner.rb', line 23 def name @name end |
#video ⇒ Object
Returns the value of attribute video.
35 36 37 |
# File 'lib/zernio-sdk/models/create_standalone_ad_request_creatives_inner.rb', line 35 def video @video end |
Class Method Details
.acceptable_attribute_map ⇒ Object
Returns attribute mapping this model knows about
79 80 81 |
# File 'lib/zernio-sdk/models/create_standalone_ad_request_creatives_inner.rb', line 79 def self.acceptable_attribute_map attribute_map end |
.acceptable_attributes ⇒ Object
Returns all the JSON keys this model knows about
84 85 86 |
# File 'lib/zernio-sdk/models/create_standalone_ad_request_creatives_inner.rb', line 84 def self.acceptable_attributes acceptable_attribute_map.values end |
.attribute_map ⇒ Object
Attribute mapping from ruby-style variable name to JSON key.
64 65 66 67 68 69 70 71 72 73 74 75 76 |
# File 'lib/zernio-sdk/models/create_standalone_ad_request_creatives_inner.rb', line 64 def self.attribute_map { :'creative_features' => :'creativeFeatures', :'name' => :'name', :'headline' => :'headline', :'body' => :'body', :'description' => :'description', :'image_url' => :'imageUrl', :'video' => :'video', :'link_url' => :'linkUrl', :'call_to_action' => :'callToAction' } end |
.build_from_hash(attributes) ⇒ Object
Builds the object from hash
327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 |
# File 'lib/zernio-sdk/models/create_standalone_ad_request_creatives_inner.rb', line 327 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
104 105 106 107 |
# File 'lib/zernio-sdk/models/create_standalone_ad_request_creatives_inner.rb', line 104 def self.openapi_nullable Set.new([ ]) end |
.openapi_types ⇒ Object
Attribute type mapping.
89 90 91 92 93 94 95 96 97 98 99 100 101 |
# File 'lib/zernio-sdk/models/create_standalone_ad_request_creatives_inner.rb', line 89 def self.openapi_types { :'creative_features' => :'Hash<String, String>', :'name' => :'String', :'headline' => :'String', :'body' => :'String', :'description' => :'String', :'image_url' => :'String', :'video' => :'CreateStandaloneAdRequestCreativesInnerVideo', :'link_url' => :'String', :'call_to_action' => :'String' } end |
Instance Method Details
#==(o) ⇒ Object
Checks equality by comparing each attribute.
298 299 300 301 302 303 304 305 306 307 308 309 310 |
# File 'lib/zernio-sdk/models/create_standalone_ad_request_creatives_inner.rb', line 298 def ==(o) return true if self.equal?(o) self.class == o.class && creative_features == o.creative_features && name == o.name && headline == o.headline && body == o.body && description == o.description && image_url == o.image_url && video == o.video && link_url == o.link_url && call_to_action == o.call_to_action end |
#eql?(o) ⇒ Boolean
314 315 316 |
# File 'lib/zernio-sdk/models/create_standalone_ad_request_creatives_inner.rb', line 314 def eql?(o) self == o end |
#hash ⇒ Integer
Calculates hash code according to all attributes.
320 321 322 |
# File 'lib/zernio-sdk/models/create_standalone_ad_request_creatives_inner.rb', line 320 def hash [creative_features, name, headline, body, description, image_url, video, link_url, call_to_action].hash end |
#list_invalid_properties ⇒ Object
Show invalid properties with the reasons. Usually used together with valid?
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 |
# File 'lib/zernio-sdk/models/create_standalone_ad_request_creatives_inner.rb', line 174 def list_invalid_properties warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' invalid_properties = Array.new if !@name.nil? && @name.to_s.length > 255 invalid_properties.push('invalid value for "name", the character length must be smaller than or equal to 255.') end if @headline.nil? invalid_properties.push('invalid value for "headline", headline cannot be nil.') end if @headline.to_s.length > 255 invalid_properties.push('invalid value for "headline", the character length must be smaller than or equal to 255.') end if @body.nil? invalid_properties.push('invalid value for "body", body cannot be nil.') end 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 if @link_url.nil? invalid_properties.push('invalid value for "link_url", link_url cannot be nil.') end if @call_to_action.nil? invalid_properties.push('invalid value for "call_to_action", call_to_action cannot be nil.') end invalid_properties end |
#to_hash ⇒ Hash
Returns the object in the form of hash
349 350 351 352 353 354 355 356 357 358 359 360 361 |
# File 'lib/zernio-sdk/models/create_standalone_ad_request_creatives_inner.rb', line 349 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
210 211 212 213 214 215 216 217 218 219 220 221 222 |
# File 'lib/zernio-sdk/models/create_standalone_ad_request_creatives_inner.rb', line 210 def valid? warn '[DEPRECATED] the `valid?` method is obsolete' return false if !@name.nil? && @name.to_s.length > 255 return false if @headline.nil? return false if @headline.to_s.length > 255 return false if @body.nil? return false if !@description.nil? && @description.to_s.length > 255 return false if @link_url.nil? return false if @call_to_action.nil? call_to_action_validator = EnumAttributeValidator.new('String', ["LEARN_MORE", "SHOP_NOW", "SIGN_UP", "BOOK_TRAVEL", "CONTACT_US", "DOWNLOAD", "GET_OFFER", "GET_QUOTE", "SUBSCRIBE", "WATCH_MORE", "ADD_TO_CART", "APPLY_NOW", "BOOK_NOW", "BUY_TICKETS", "DONATE", "DONATE_NOW", "GET_DIRECTIONS", "GET_SHOWTIMES", "LISTEN_NOW", "ORDER_NOW", "PLAY_GAME", "REQUEST_TIME", "SEE_MENU", "START_ORDER", "INSTALL_MOBILE_APP", "USE_APP"]) return false unless call_to_action_validator.valid?(@call_to_action) true end |