Class: Zernio::Ad
- Inherits:
-
ApiModelBase
- Object
- ApiModelBase
- Zernio::Ad
- Defined in:
- lib/zernio-sdk/models/ad.rb
Defined Under Namespace
Classes: EnumAttributeValidator
Instance Attribute Summary collapse
-
#_id ⇒ Object
Returns the value of attribute _id.
-
#ad_set_name ⇒ Object
Returns the value of attribute ad_set_name.
-
#ad_type ⇒ Object
Returns the value of attribute ad_type.
-
#bid_amount ⇒ Object
Bid cap in WHOLE currency units of the ad account (USD: 5 = $5.00; JPY: 100 = ¥100).
-
#bid_strategy ⇒ Object
Returns the value of attribute bid_strategy.
-
#budget ⇒ Object
Returns the value of attribute budget.
-
#campaign_name ⇒ Object
Returns the value of attribute campaign_name.
-
#created_at ⇒ Object
Returns the value of attribute created_at.
-
#creative ⇒ Object
Returns the value of attribute creative.
-
#goal ⇒ Object
Available goals vary by platform.
-
#is_external ⇒ Object
True for ads synced from platform ad managers.
-
#metrics ⇒ Object
Returns the value of attribute metrics.
-
#name ⇒ Object
Returns the value of attribute name.
-
#optimization_goal ⇒ Object
Meta ad set optimization goal (e.g. OFFSITE_CONVERSIONS, VALUE, LEAD_GENERATION, LINK_CLICKS).
-
#platform ⇒ Object
Returns the value of attribute platform.
-
#platform_ad_account_id ⇒ Object
Returns the value of attribute platform_ad_account_id.
-
#platform_ad_account_name ⇒ Object
Human-readable advertiser/account name (Meta
AdAccount.name, TikTokadvertiser_name, LinkedIn / X / Pinterest equivalents). -
#platform_ad_id ⇒ Object
Returns the value of attribute platform_ad_id.
-
#platform_ad_set_id ⇒ Object
Returns the value of attribute platform_ad_set_id.
-
#platform_campaign_id ⇒ Object
Returns the value of attribute platform_campaign_id.
-
#platform_created_at ⇒ Object
Platform-reported creation timestamp (Meta
created_time, TikTokcreate_time). -
#platform_objective ⇒ Object
Raw Meta campaign objective (e.g. OUTCOME_SALES, OUTCOME_LEADS, OUTCOME_TRAFFIC).
-
#promoted_object ⇒ Object
Returns the value of attribute promoted_object.
-
#rejection_reason ⇒ Object
Returns the value of attribute rejection_reason.
-
#roas_average_floor ⇒ Object
Minimum ROAS as a decimal multiplier (2.0 = 2.0x ROAS).
-
#schedule ⇒ Object
Returns the value of attribute schedule.
-
#status ⇒ Object
Returns the value of attribute status.
-
#targeting ⇒ Object
The ad set's targeting (age, gender, geo, interests, placements, audience inclusions/exclusions).
-
#updated_at ⇒ Object
Returns the value of attribute updated_at.
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 = {}) ⇒ Ad
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 = {}) ⇒ Ad
Initializes the object
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 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 |
# File 'lib/zernio-sdk/models/ad.rb', line 203 def initialize(attributes = {}) if (!attributes.is_a?(Hash)) fail ArgumentError, "The input argument (attributes) must be a hash in `Zernio::Ad` 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::Ad`. 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?(:'_id') self._id = attributes[:'_id'] end if attributes.key?(:'name') self.name = attributes[:'name'] end if attributes.key?(:'platform') self.platform = attributes[:'platform'] end if attributes.key?(:'status') self.status = attributes[:'status'] end if attributes.key?(:'ad_type') self.ad_type = attributes[:'ad_type'] end if attributes.key?(:'goal') self.goal = attributes[:'goal'] end if attributes.key?(:'is_external') self.is_external = attributes[:'is_external'] end if attributes.key?(:'budget') self.budget = attributes[:'budget'] end if attributes.key?(:'metrics') self.metrics = attributes[:'metrics'] end if attributes.key?(:'platform_ad_id') self.platform_ad_id = attributes[:'platform_ad_id'] end if attributes.key?(:'platform_ad_account_id') self.platform_ad_account_id = attributes[:'platform_ad_account_id'] end if attributes.key?(:'platform_campaign_id') self.platform_campaign_id = attributes[:'platform_campaign_id'] end if attributes.key?(:'platform_ad_set_id') self.platform_ad_set_id = attributes[:'platform_ad_set_id'] end if attributes.key?(:'campaign_name') self.campaign_name = attributes[:'campaign_name'] end if attributes.key?(:'ad_set_name') self.ad_set_name = attributes[:'ad_set_name'] end if attributes.key?(:'platform_objective') self.platform_objective = attributes[:'platform_objective'] end if attributes.key?(:'optimization_goal') self.optimization_goal = attributes[:'optimization_goal'] end if attributes.key?(:'platform_ad_account_name') self.platform_ad_account_name = attributes[:'platform_ad_account_name'] end if attributes.key?(:'platform_created_at') self.platform_created_at = attributes[:'platform_created_at'] end if attributes.key?(:'bid_strategy') self.bid_strategy = attributes[:'bid_strategy'] end if attributes.key?(:'bid_amount') self.bid_amount = attributes[:'bid_amount'] end if attributes.key?(:'roas_average_floor') self.roas_average_floor = attributes[:'roas_average_floor'] end if attributes.key?(:'promoted_object') self.promoted_object = attributes[:'promoted_object'] end if attributes.key?(:'creative') self.creative = attributes[:'creative'] end if attributes.key?(:'targeting') self.targeting = attributes[:'targeting'] end if attributes.key?(:'schedule') self.schedule = attributes[:'schedule'] end if attributes.key?(:'rejection_reason') self.rejection_reason = attributes[:'rejection_reason'] end if attributes.key?(:'created_at') self.created_at = attributes[:'created_at'] end if attributes.key?(:'updated_at') self.updated_at = attributes[:'updated_at'] end end |
Instance Attribute Details
#_id ⇒ Object
Returns the value of attribute _id.
18 19 20 |
# File 'lib/zernio-sdk/models/ad.rb', line 18 def _id @_id end |
#ad_set_name ⇒ Object
Returns the value of attribute ad_set_name.
48 49 50 |
# File 'lib/zernio-sdk/models/ad.rb', line 48 def ad_set_name @ad_set_name end |
#ad_type ⇒ Object
Returns the value of attribute ad_type.
26 27 28 |
# File 'lib/zernio-sdk/models/ad.rb', line 26 def ad_type @ad_type end |
#bid_amount ⇒ Object
Bid cap in WHOLE currency units of the ad account (USD: 5 = $5.00; JPY: 100 = ¥100). Populated when bidStrategy is LOWEST_COST_WITH_BID_CAP or COST_CAP. null for auto-bid (LOWEST_COST_WITHOUT_CAP). - Meta source: bid_amount on the ad set (smallest-denomination int, decoded here). - TikTok source: priority order bid_price -> conversion_bid_price -> deep_cpa_bid (whichever is set on the ad group). TikTok stores all three in whole currency units. Source: facebook-business-sdk-codegen api_specs/specs/AdSet.json (bid_amount).
65 66 67 |
# File 'lib/zernio-sdk/models/ad.rb', line 65 def bid_amount @bid_amount end |
#bid_strategy ⇒ Object
Returns the value of attribute bid_strategy.
62 63 64 |
# File 'lib/zernio-sdk/models/ad.rb', line 62 def bid_strategy @bid_strategy end |
#budget ⇒ Object
Returns the value of attribute budget.
34 35 36 |
# File 'lib/zernio-sdk/models/ad.rb', line 34 def budget @budget end |
#campaign_name ⇒ Object
Returns the value of attribute campaign_name.
46 47 48 |
# File 'lib/zernio-sdk/models/ad.rb', line 46 def campaign_name @campaign_name end |
#created_at ⇒ Object
Returns the value of attribute created_at.
81 82 83 |
# File 'lib/zernio-sdk/models/ad.rb', line 81 def created_at @created_at end |
#creative ⇒ Object
Returns the value of attribute creative.
72 73 74 |
# File 'lib/zernio-sdk/models/ad.rb', line 72 def creative @creative end |
#goal ⇒ Object
Available goals vary by platform. Meta (Facebook/Instagram) supports all 9 (incl. lead_conversion = website pixel lead optimization and catalog_sales = Advantage+ catalog ads). TikTok supports the 7 non-lead_conversion goals. LinkedIn supports all except app_promotion / lead_conversion. Twitter/X supports engagement, traffic, awareness, video_views, app_promotion. Pinterest and Google Ads support only engagement, traffic, awareness, video_views.
29 30 31 |
# File 'lib/zernio-sdk/models/ad.rb', line 29 def goal @goal end |
#is_external ⇒ Object
True for ads synced from platform ad managers
32 33 34 |
# File 'lib/zernio-sdk/models/ad.rb', line 32 def is_external @is_external end |
#metrics ⇒ Object
Returns the value of attribute metrics.
36 37 38 |
# File 'lib/zernio-sdk/models/ad.rb', line 36 def metrics @metrics end |
#name ⇒ Object
Returns the value of attribute name.
20 21 22 |
# File 'lib/zernio-sdk/models/ad.rb', line 20 def name @name end |
#optimization_goal ⇒ Object
Meta ad set optimization goal (e.g. OFFSITE_CONVERSIONS, VALUE, LEAD_GENERATION, LINK_CLICKS). Only present for Meta ads.
54 55 56 |
# File 'lib/zernio-sdk/models/ad.rb', line 54 def optimization_goal @optimization_goal end |
#platform ⇒ Object
Returns the value of attribute platform.
22 23 24 |
# File 'lib/zernio-sdk/models/ad.rb', line 22 def platform @platform end |
#platform_ad_account_id ⇒ Object
Returns the value of attribute platform_ad_account_id.
40 41 42 |
# File 'lib/zernio-sdk/models/ad.rb', line 40 def platform_ad_account_id @platform_ad_account_id end |
#platform_ad_account_name ⇒ Object
Human-readable advertiser/account name (Meta AdAccount.name, TikTok advertiser_name, LinkedIn / X / Pinterest equivalents). Refreshed every sync so platform-side renames propagate within one cycle. null when the platform doesn't return a name or the sync hasn't run yet.
57 58 59 |
# File 'lib/zernio-sdk/models/ad.rb', line 57 def platform_ad_account_name @platform_ad_account_name end |
#platform_ad_id ⇒ Object
Returns the value of attribute platform_ad_id.
38 39 40 |
# File 'lib/zernio-sdk/models/ad.rb', line 38 def platform_ad_id @platform_ad_id end |
#platform_ad_set_id ⇒ Object
Returns the value of attribute platform_ad_set_id.
44 45 46 |
# File 'lib/zernio-sdk/models/ad.rb', line 44 def platform_ad_set_id @platform_ad_set_id end |
#platform_campaign_id ⇒ Object
Returns the value of attribute platform_campaign_id.
42 43 44 |
# File 'lib/zernio-sdk/models/ad.rb', line 42 def platform_campaign_id @platform_campaign_id end |
#platform_created_at ⇒ Object
Platform-reported creation timestamp (Meta created_time, TikTok create_time). Distinct from createdAt which reflects when Zernio first synced the doc — for sort/filter by "when the ad was actually created on the platform", read this field. null for legacy ads synced before this field was added; aggregations fall back to createdAt in that case.
60 61 62 |
# File 'lib/zernio-sdk/models/ad.rb', line 60 def platform_created_at @platform_created_at end |
#platform_objective ⇒ Object
Raw Meta campaign objective (e.g. OUTCOME_SALES, OUTCOME_LEADS, OUTCOME_TRAFFIC). Only present for Meta ads.
51 52 53 |
# File 'lib/zernio-sdk/models/ad.rb', line 51 def platform_objective @platform_objective end |
#promoted_object ⇒ Object
Returns the value of attribute promoted_object.
70 71 72 |
# File 'lib/zernio-sdk/models/ad.rb', line 70 def promoted_object @promoted_object end |
#rejection_reason ⇒ Object
Returns the value of attribute rejection_reason.
79 80 81 |
# File 'lib/zernio-sdk/models/ad.rb', line 79 def rejection_reason @rejection_reason end |
#roas_average_floor ⇒ Object
Minimum ROAS as a decimal multiplier (2.0 = 2.0x ROAS). Populated when bidStrategy is LOWEST_COST_WITH_MIN_ROAS. - Meta source: decoded from bid_constraints.roas_average_floor (Meta stores as fixed-point int × 10000; we return the decimal). - TikTok source: roas_bid on the ad group (already a decimal). Source: facebook-business-sdk-codegen api_specs/specs/AdCampaignBidConstraint.json.
68 69 70 |
# File 'lib/zernio-sdk/models/ad.rb', line 68 def roas_average_floor @roas_average_floor end |
#schedule ⇒ Object
Returns the value of attribute schedule.
77 78 79 |
# File 'lib/zernio-sdk/models/ad.rb', line 77 def schedule @schedule end |
#status ⇒ Object
Returns the value of attribute status.
24 25 26 |
# File 'lib/zernio-sdk/models/ad.rb', line 24 def status @status end |
#targeting ⇒ Object
The ad set's targeting (age, gender, geo, interests, placements, audience inclusions/exclusions). For ads created through Zernio this is the spec you supplied. For external ads (synced from Meta Ads Manager, isExternal: true) targeting lives at the ad set and isn't stored at ingest, so on the first GET /v1/ads/{adId} Zernio resolves it live from Meta and caches it on the ad; the value is then Meta's raw targeting shape (snake_case, e.g. geo_locations, age_min), the same object Ads Manager shows. May be absent if the ad set exposes no targeting or the lookup fails.
75 76 77 |
# File 'lib/zernio-sdk/models/ad.rb', line 75 def targeting @targeting end |
#updated_at ⇒ Object
Returns the value of attribute updated_at.
83 84 85 |
# File 'lib/zernio-sdk/models/ad.rb', line 83 def updated_at @updated_at end |
Class Method Details
.acceptable_attribute_map ⇒ Object
Returns attribute mapping this model knows about
143 144 145 |
# File 'lib/zernio-sdk/models/ad.rb', line 143 def self.acceptable_attribute_map attribute_map end |
.acceptable_attributes ⇒ Object
Returns all the JSON keys this model knows about
148 149 150 |
# File 'lib/zernio-sdk/models/ad.rb', line 148 def self.acceptable_attributes acceptable_attribute_map.values end |
.attribute_map ⇒ Object
Attribute mapping from ruby-style variable name to JSON key.
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 139 140 |
# File 'lib/zernio-sdk/models/ad.rb', line 108 def self.attribute_map { :'_id' => :'_id', :'name' => :'name', :'platform' => :'platform', :'status' => :'status', :'ad_type' => :'adType', :'goal' => :'goal', :'is_external' => :'isExternal', :'budget' => :'budget', :'metrics' => :'metrics', :'platform_ad_id' => :'platformAdId', :'platform_ad_account_id' => :'platformAdAccountId', :'platform_campaign_id' => :'platformCampaignId', :'platform_ad_set_id' => :'platformAdSetId', :'campaign_name' => :'campaignName', :'ad_set_name' => :'adSetName', :'platform_objective' => :'platformObjective', :'optimization_goal' => :'optimizationGoal', :'platform_ad_account_name' => :'platformAdAccountName', :'platform_created_at' => :'platformCreatedAt', :'bid_strategy' => :'bidStrategy', :'bid_amount' => :'bidAmount', :'roas_average_floor' => :'roasAverageFloor', :'promoted_object' => :'promotedObject', :'creative' => :'creative', :'targeting' => :'targeting', :'schedule' => :'schedule', :'rejection_reason' => :'rejectionReason', :'created_at' => :'createdAt', :'updated_at' => :'updatedAt' } end |
.build_from_hash(attributes) ⇒ Object
Builds the object from hash
436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 |
# File 'lib/zernio-sdk/models/ad.rb', line 436 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
188 189 190 191 192 193 194 195 196 197 198 199 |
# File 'lib/zernio-sdk/models/ad.rb', line 188 def self.openapi_nullable Set.new([ :'metrics', :'platform_objective', :'optimization_goal', :'platform_ad_account_name', :'platform_created_at', :'bid_strategy', :'bid_amount', :'roas_average_floor', ]) end |
.openapi_types ⇒ Object
Attribute type mapping.
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 |
# File 'lib/zernio-sdk/models/ad.rb', line 153 def self.openapi_types { :'_id' => :'String', :'name' => :'String', :'platform' => :'String', :'status' => :'AdStatus', :'ad_type' => :'String', :'goal' => :'String', :'is_external' => :'Boolean', :'budget' => :'AdBudget', :'metrics' => :'AdMetrics', :'platform_ad_id' => :'String', :'platform_ad_account_id' => :'String', :'platform_campaign_id' => :'String', :'platform_ad_set_id' => :'String', :'campaign_name' => :'String', :'ad_set_name' => :'String', :'platform_objective' => :'String', :'optimization_goal' => :'String', :'platform_ad_account_name' => :'String', :'platform_created_at' => :'Time', :'bid_strategy' => :'BidStrategy', :'bid_amount' => :'Float', :'roas_average_floor' => :'Float', :'promoted_object' => :'AdPromotedObject', :'creative' => :'AdCreative', :'targeting' => :'Object', :'schedule' => :'AdSchedule', :'rejection_reason' => :'String', :'created_at' => :'Time', :'updated_at' => :'Time' } end |
Instance Method Details
#==(o) ⇒ Object
Checks equality by comparing each attribute.
387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 |
# File 'lib/zernio-sdk/models/ad.rb', line 387 def ==(o) return true if self.equal?(o) self.class == o.class && _id == o._id && name == o.name && platform == o.platform && status == o.status && ad_type == o.ad_type && goal == o.goal && is_external == o.is_external && budget == o.budget && metrics == o.metrics && platform_ad_id == o.platform_ad_id && platform_ad_account_id == o.platform_ad_account_id && platform_campaign_id == o.platform_campaign_id && platform_ad_set_id == o.platform_ad_set_id && campaign_name == o.campaign_name && ad_set_name == o.ad_set_name && platform_objective == o.platform_objective && optimization_goal == o.optimization_goal && platform_ad_account_name == o.platform_ad_account_name && platform_created_at == o.platform_created_at && bid_strategy == o.bid_strategy && bid_amount == o.bid_amount && roas_average_floor == o.roas_average_floor && promoted_object == o.promoted_object && creative == o.creative && targeting == o.targeting && schedule == o.schedule && rejection_reason == o.rejection_reason && created_at == o.created_at && updated_at == o.updated_at end |
#eql?(o) ⇒ Boolean
423 424 425 |
# File 'lib/zernio-sdk/models/ad.rb', line 423 def eql?(o) self == o end |
#hash ⇒ Integer
Calculates hash code according to all attributes.
429 430 431 |
# File 'lib/zernio-sdk/models/ad.rb', line 429 def hash [_id, name, platform, status, ad_type, goal, is_external, budget, metrics, platform_ad_id, platform_ad_account_id, platform_campaign_id, platform_ad_set_id, campaign_name, ad_set_name, platform_objective, optimization_goal, platform_ad_account_name, platform_created_at, bid_strategy, bid_amount, roas_average_floor, promoted_object, creative, targeting, schedule, rejection_reason, created_at, updated_at].hash end |
#list_invalid_properties ⇒ Object
Show invalid properties with the reasons. Usually used together with valid?
336 337 338 339 340 |
# File 'lib/zernio-sdk/models/ad.rb', line 336 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
458 459 460 461 462 463 464 465 466 467 468 469 470 |
# File 'lib/zernio-sdk/models/ad.rb', line 458 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
344 345 346 347 348 349 350 351 352 353 |
# File 'lib/zernio-sdk/models/ad.rb', line 344 def valid? warn '[DEPRECATED] the `valid?` method is obsolete' platform_validator = EnumAttributeValidator.new('String', ["facebook", "instagram", "tiktok", "linkedin", "pinterest", "google", "twitter"]) return false unless platform_validator.valid?(@platform) ad_type_validator = EnumAttributeValidator.new('String', ["boost", "standalone"]) return false unless ad_type_validator.valid?(@ad_type) goal_validator = EnumAttributeValidator.new('String', ["engagement", "traffic", "awareness", "video_views", "lead_generation", "lead_conversion", "conversions", "app_promotion", "catalog_sales", "job_applicants"]) return false unless goal_validator.valid?(@goal) true end |