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.
-
#promotion ⇒ Object
Overrides the top-level offer for this item.
-
#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
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 171 172 173 174 175 176 177 178 179 |
# File 'lib/zernio-sdk/models/create_standalone_ad_request_creatives_inner.rb', line 116 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?(:'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?(:'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.
30 31 32 |
# File 'lib/zernio-sdk/models/create_standalone_ad_request_creatives_inner.rb', line 30 def body @body end |
#call_to_action ⇒ Object
Returns the value of attribute call_to_action.
42 43 44 |
# File 'lib/zernio-sdk/models/create_standalone_ad_request_creatives_inner.rb', line 42 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.
23 24 25 |
# File 'lib/zernio-sdk/models/create_standalone_ad_request_creatives_inner.rb', line 23 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.
33 34 35 |
# File 'lib/zernio-sdk/models/create_standalone_ad_request_creatives_inner.rb', line 33 def description @description end |
#headline ⇒ Object
Returns the value of attribute headline.
28 29 30 |
# File 'lib/zernio-sdk/models/create_standalone_ad_request_creatives_inner.rb', line 28 def headline @headline end |
#image_url ⇒ Object
Image creative. Mutually exclusive with video.
36 37 38 |
# File 'lib/zernio-sdk/models/create_standalone_ad_request_creatives_inner.rb', line 36 def image_url @image_url end |
#link_url ⇒ Object
Returns the value of attribute link_url.
40 41 42 |
# File 'lib/zernio-sdk/models/create_standalone_ad_request_creatives_inner.rb', line 40 def link_url @link_url end |
#name ⇒ Object
Exact name for this ad. Falls back to <name> #N (N = 1-based position).
26 27 28 |
# File 'lib/zernio-sdk/models/create_standalone_ad_request_creatives_inner.rb', line 26 def name @name end |
#promotion ⇒ Object
Overrides the top-level offer for this item. Omit to inherit; null disables the inherited offer.
20 21 22 |
# File 'lib/zernio-sdk/models/create_standalone_ad_request_creatives_inner.rb', line 20 def promotion @promotion end |
#video ⇒ Object
Returns the value of attribute video.
38 39 40 |
# File 'lib/zernio-sdk/models/create_standalone_ad_request_creatives_inner.rb', line 38 def video @video end |
Class Method Details
.acceptable_attribute_map ⇒ Object
Returns attribute mapping this model knows about
83 84 85 |
# File 'lib/zernio-sdk/models/create_standalone_ad_request_creatives_inner.rb', line 83 def self.acceptable_attribute_map attribute_map end |
.acceptable_attributes ⇒ Object
Returns all the JSON keys this model knows about
88 89 90 |
# File 'lib/zernio-sdk/models/create_standalone_ad_request_creatives_inner.rb', line 88 def self.acceptable_attributes acceptable_attribute_map.values end |
.attribute_map ⇒ Object
Attribute mapping from ruby-style variable name to JSON key.
67 68 69 70 71 72 73 74 75 76 77 78 79 80 |
# File 'lib/zernio-sdk/models/create_standalone_ad_request_creatives_inner.rb', line 67 def self.attribute_map { :'promotion' => :'promotion', :'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
337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 |
# File 'lib/zernio-sdk/models/create_standalone_ad_request_creatives_inner.rb', line 337 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
109 110 111 112 |
# File 'lib/zernio-sdk/models/create_standalone_ad_request_creatives_inner.rb', line 109 def self.openapi_nullable Set.new([ ]) end |
.openapi_types ⇒ Object
Attribute type mapping.
93 94 95 96 97 98 99 100 101 102 103 104 105 106 |
# File 'lib/zernio-sdk/models/create_standalone_ad_request_creatives_inner.rb', line 93 def self.openapi_types { :'promotion' => :'MetaPromotion', :'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.
307 308 309 310 311 312 313 314 315 316 317 318 319 320 |
# File 'lib/zernio-sdk/models/create_standalone_ad_request_creatives_inner.rb', line 307 def ==(o) return true if self.equal?(o) self.class == o.class && promotion == o.promotion && 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
324 325 326 |
# File 'lib/zernio-sdk/models/create_standalone_ad_request_creatives_inner.rb', line 324 def eql?(o) self == o end |
#hash ⇒ Integer
Calculates hash code according to all attributes.
330 331 332 |
# File 'lib/zernio-sdk/models/create_standalone_ad_request_creatives_inner.rb', line 330 def hash [promotion, 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?
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 |
# File 'lib/zernio-sdk/models/create_standalone_ad_request_creatives_inner.rb', line 183 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
359 360 361 362 363 364 365 366 367 368 369 370 371 |
# File 'lib/zernio-sdk/models/create_standalone_ad_request_creatives_inner.rb', line 359 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
219 220 221 222 223 224 225 226 227 228 229 230 231 |
# File 'lib/zernio-sdk/models/create_standalone_ad_request_creatives_inner.rb', line 219 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 |