Class: Zernio::CreateAdCampaignRequest
- Inherits:
-
ApiModelBase
- Object
- ApiModelBase
- Zernio::CreateAdCampaignRequest
- Defined in:
- lib/zernio-sdk/models/create_ad_campaign_request.rb
Defined Under Namespace
Classes: EnumAttributeValidator
Instance Attribute Summary collapse
-
#account_id ⇒ Object
Zernio SocialAccount id (posting or ads variant); its platform decides where the campaign is created.
-
#ad_account_id ⇒ Object
Platform ad account id (Meta act_
, Google customer id, LinkedIn account id, ...). -
#bid_amount ⇒ Object
Whole currency units (USD: 5 = $5.00).
-
#bid_strategy ⇒ Object
Campaign bid strategy.
-
#budget_amount ⇒ Object
Campaign-level (CBO) budget in WHOLE currency units (USD: 50 = $50.00), NOT cents.
-
#budget_type ⇒ Object
Returns the value of attribute budget_type.
-
#buying_type ⇒ Object
Every platform buys at auction by default, so this only needs sending on Meta, and only to choose RESERVED.
-
#goal ⇒ Object
Mapped to the ODAX objective (same mapping as POST /v1/ads/create).
-
#is_skadnetwork_attribution ⇒ Object
Meta app promotion only.
-
#name ⇒ Object
Returns the value of attribute name.
-
#portfolio_bid_strategy_id ⇒ Object
Google only.
-
#promoted_object ⇒ Object
Returns the value of attribute promoted_object.
-
#roas_average_floor ⇒ Object
Decimal ROAS multiplier (2.0 = 2.0x).
-
#special_ad_categories ⇒ Object
Returns the value of attribute special_ad_categories.
-
#status ⇒ Object
Returns the value of attribute status.
-
#validate_only ⇒ Object
Meta only.
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 = {}) ⇒ CreateAdCampaignRequest
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 = {}) ⇒ CreateAdCampaignRequest
Initializes the object
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 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 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 |
# File 'lib/zernio-sdk/models/create_ad_campaign_request.rb', line 145 def initialize(attributes = {}) if (!attributes.is_a?(Hash)) fail ArgumentError, "The input argument (attributes) must be a hash in `Zernio::CreateAdCampaignRequest` 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::CreateAdCampaignRequest`. 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?(:'account_id') self.account_id = attributes[:'account_id'] else self.account_id = nil end if attributes.key?(:'ad_account_id') self.ad_account_id = attributes[:'ad_account_id'] else self.ad_account_id = nil end if attributes.key?(:'name') self.name = attributes[:'name'] else self.name = nil end if attributes.key?(:'goal') self.goal = attributes[:'goal'] else self.goal = nil end if attributes.key?(:'is_skadnetwork_attribution') self.is_skadnetwork_attribution = attributes[:'is_skadnetwork_attribution'] end if attributes.key?(:'promoted_object') self.promoted_object = attributes[:'promoted_object'] end if attributes.key?(:'buying_type') self. = attributes[:'buying_type'] end if attributes.key?(:'validate_only') self.validate_only = attributes[:'validate_only'] end if attributes.key?(:'special_ad_categories') if (value = attributes[:'special_ad_categories']).is_a?(Array) self.special_ad_categories = value end end if attributes.key?(:'budget_amount') self.budget_amount = attributes[:'budget_amount'] end if attributes.key?(:'budget_type') self.budget_type = attributes[:'budget_type'] end if attributes.key?(:'status') self.status = attributes[:'status'] else self.status = 'PAUSED' 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?(:'portfolio_bid_strategy_id') self.portfolio_bid_strategy_id = attributes[:'portfolio_bid_strategy_id'] end end |
Instance Attribute Details
#account_id ⇒ Object
Zernio SocialAccount id (posting or ads variant); its platform decides where the campaign is created.
19 20 21 |
# File 'lib/zernio-sdk/models/create_ad_campaign_request.rb', line 19 def account_id @account_id end |
#ad_account_id ⇒ Object
Platform ad account id (Meta act_
22 23 24 |
# File 'lib/zernio-sdk/models/create_ad_campaign_request.rb', line 22 def ad_account_id @ad_account_id end |
#bid_amount ⇒ Object
Whole currency units (USD: 5 = $5.00). Required for LOWEST_COST_WITH_BID_CAP and COST_CAP; ignored otherwise. On Meta, validated here but NOT stored: the campaign object has no bid_amount field, only bid_strategy lives on it, and the amount takes effect once an ad set joins this campaign (existingCampaignId on POST /v1/ads/create) and supplies its own bidAmount there. On Google, stored directly on the campaign's bidding strategy.
53 54 55 |
# File 'lib/zernio-sdk/models/create_ad_campaign_request.rb', line 53 def bid_amount @bid_amount end |
#bid_strategy ⇒ Object
Campaign bid strategy. Meta stores bid_strategy alongside the budget, so this REQUIRES budgetAmount + budgetType on the same request; sending it without a campaign budget is a 400. A campaign carrying a strategy without its bid_amount makes every ad set created under it fail with an error that names the ad set (code 100, subcode 1815857), so the bad state is rejected up front rather than accepted. To bid at ad-set level on Meta, set the strategy there instead. On Google: LOWEST_COST_WITHOUT_CAP = Maximize Conversions, COST_CAP + bidAmount = Target CPA, LOWEST_COST_WITH_MIN_ROAS + roasAverageFloor = Target ROAS, LOWEST_COST_WITH_BID_CAP + bidAmount = Maximize Clicks with a CPC ceiling; portfolioBidStrategyId attaches a portfolio strategy instead.
50 51 52 |
# File 'lib/zernio-sdk/models/create_ad_campaign_request.rb', line 50 def bid_strategy @bid_strategy end |
#budget_amount ⇒ Object
Campaign-level (CBO) budget in WHOLE currency units (USD: 50 = $50.00), NOT cents. Meta's own Marketing API takes this same number in minor units, so it is an easy and expensive mix-up. Requires budgetType.
43 44 45 |
# File 'lib/zernio-sdk/models/create_ad_campaign_request.rb', line 43 def budget_amount @budget_amount end |
#budget_type ⇒ Object
Returns the value of attribute budget_type.
45 46 47 |
# File 'lib/zernio-sdk/models/create_ad_campaign_request.rb', line 45 def budget_type @budget_type end |
#buying_type ⇒ Object
Every platform buys at auction by default, so this only needs sending on Meta, and only to choose RESERVED. AUCTION is accepted on every platform and changes nothing. RESERVED (Reach & Frequency) is Meta-only and is rejected with a 400 elsewhere. SKAdNetwork app promotion requires AUCTION.
35 36 37 |
# File 'lib/zernio-sdk/models/create_ad_campaign_request.rb', line 35 def end |
#goal ⇒ Object
Mapped to the ODAX objective (same mapping as POST /v1/ads/create).
27 28 29 |
# File 'lib/zernio-sdk/models/create_ad_campaign_request.rb', line 27 def goal @goal end |
#is_skadnetwork_attribution ⇒ Object
Meta app promotion only. Immutable campaign flag. Set true for iOS 14+ SKAdNetwork campaigns and supply promotedObject.applicationId plus promotedObject.objectStoreUrl. The campaign receives promotedObject only when this flag is true. Cannot be changed on an existing campaign.
30 31 32 |
# File 'lib/zernio-sdk/models/create_ad_campaign_request.rb', line 30 def is_skadnetwork_attribution @is_skadnetwork_attribution end |
#name ⇒ Object
Returns the value of attribute name.
24 25 26 |
# File 'lib/zernio-sdk/models/create_ad_campaign_request.rb', line 24 def name @name end |
#portfolio_bid_strategy_id ⇒ Object
Google only. Attach an existing portfolio bid strategy (numeric id from GET /v1/ads/bid-strategies) to the new campaign instead of a standard one. Exclusive with bidStrategy.
59 60 61 |
# File 'lib/zernio-sdk/models/create_ad_campaign_request.rb', line 59 def portfolio_bid_strategy_id @portfolio_bid_strategy_id end |
#promoted_object ⇒ Object
Returns the value of attribute promoted_object.
32 33 34 |
# File 'lib/zernio-sdk/models/create_ad_campaign_request.rb', line 32 def promoted_object @promoted_object end |
#roas_average_floor ⇒ Object
Decimal ROAS multiplier (2.0 = 2.0x). Required for LOWEST_COST_WITH_MIN_ROAS.
56 57 58 |
# File 'lib/zernio-sdk/models/create_ad_campaign_request.rb', line 56 def roas_average_floor @roas_average_floor end |
#special_ad_categories ⇒ Object
Returns the value of attribute special_ad_categories.
40 41 42 |
# File 'lib/zernio-sdk/models/create_ad_campaign_request.rb', line 40 def special_ad_categories @special_ad_categories end |
#status ⇒ Object
Returns the value of attribute status.
47 48 49 |
# File 'lib/zernio-sdk/models/create_ad_campaign_request.rb', line 47 def status @status end |
#validate_only ⇒ Object
Meta only. Runs campaign validation without creating or persisting a campaign; Idempotency-Key storage is bypassed. Returns HTTP 200 with validateOnly true and status VALIDATED.
38 39 40 |
# File 'lib/zernio-sdk/models/create_ad_campaign_request.rb', line 38 def validate_only @validate_only end |
Class Method Details
.acceptable_attribute_map ⇒ Object
Returns attribute mapping this model knows about
106 107 108 |
# File 'lib/zernio-sdk/models/create_ad_campaign_request.rb', line 106 def self.acceptable_attribute_map attribute_map end |
.acceptable_attributes ⇒ Object
Returns all the JSON keys this model knows about
111 112 113 |
# File 'lib/zernio-sdk/models/create_ad_campaign_request.rb', line 111 def self.acceptable_attributes acceptable_attribute_map.values end |
.attribute_map ⇒ Object
Attribute mapping from ruby-style variable name to JSON key.
84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 |
# File 'lib/zernio-sdk/models/create_ad_campaign_request.rb', line 84 def self.attribute_map { :'account_id' => :'accountId', :'ad_account_id' => :'adAccountId', :'name' => :'name', :'goal' => :'goal', :'is_skadnetwork_attribution' => :'isSkadnetworkAttribution', :'promoted_object' => :'promotedObject', :'buying_type' => :'buyingType', :'validate_only' => :'validateOnly', :'special_ad_categories' => :'specialAdCategories', :'budget_amount' => :'budgetAmount', :'budget_type' => :'budgetType', :'status' => :'status', :'bid_strategy' => :'bidStrategy', :'bid_amount' => :'bidAmount', :'roas_average_floor' => :'roasAverageFloor', :'portfolio_bid_strategy_id' => :'portfolioBidStrategyId' } end |
.build_from_hash(attributes) ⇒ Object
Builds the object from hash
429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 |
# File 'lib/zernio-sdk/models/create_ad_campaign_request.rb', line 429 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
138 139 140 141 |
# File 'lib/zernio-sdk/models/create_ad_campaign_request.rb', line 138 def self.openapi_nullable Set.new([ ]) end |
.openapi_types ⇒ Object
Attribute type mapping.
116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 |
# File 'lib/zernio-sdk/models/create_ad_campaign_request.rb', line 116 def self.openapi_types { :'account_id' => :'String', :'ad_account_id' => :'String', :'name' => :'String', :'goal' => :'String', :'is_skadnetwork_attribution' => :'Boolean', :'promoted_object' => :'AdPromotedObject', :'buying_type' => :'String', :'validate_only' => :'Boolean', :'special_ad_categories' => :'Array<String>', :'budget_amount' => :'Float', :'budget_type' => :'String', :'status' => :'String', :'bid_strategy' => :'String', :'bid_amount' => :'Float', :'roas_average_floor' => :'Float', :'portfolio_bid_strategy_id' => :'String' } end |
Instance Method Details
#==(o) ⇒ Object
Checks equality by comparing each attribute.
393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 |
# File 'lib/zernio-sdk/models/create_ad_campaign_request.rb', line 393 def ==(o) return true if self.equal?(o) self.class == o.class && account_id == o.account_id && ad_account_id == o.ad_account_id && name == o.name && goal == o.goal && is_skadnetwork_attribution == o.is_skadnetwork_attribution && promoted_object == o.promoted_object && == o. && validate_only == o.validate_only && special_ad_categories == o.special_ad_categories && budget_amount == o.budget_amount && budget_type == o.budget_type && status == o.status && bid_strategy == o.bid_strategy && bid_amount == o.bid_amount && roas_average_floor == o.roas_average_floor && portfolio_bid_strategy_id == o.portfolio_bid_strategy_id end |
#eql?(o) ⇒ Boolean
416 417 418 |
# File 'lib/zernio-sdk/models/create_ad_campaign_request.rb', line 416 def eql?(o) self == o end |
#hash ⇒ Integer
Calculates hash code according to all attributes.
422 423 424 |
# File 'lib/zernio-sdk/models/create_ad_campaign_request.rb', line 422 def hash [account_id, ad_account_id, name, goal, is_skadnetwork_attribution, promoted_object, , validate_only, special_ad_categories, budget_amount, budget_type, status, bid_strategy, bid_amount, roas_average_floor, portfolio_bid_strategy_id].hash end |
#list_invalid_properties ⇒ Object
Show invalid properties with the reasons. Usually used together with valid?
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 |
# File 'lib/zernio-sdk/models/create_ad_campaign_request.rb', line 238 def list_invalid_properties warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' invalid_properties = Array.new if @account_id.nil? invalid_properties.push('invalid value for "account_id", account_id cannot be nil.') end if @ad_account_id.nil? invalid_properties.push('invalid value for "ad_account_id", ad_account_id cannot be nil.') end if @name.nil? invalid_properties.push('invalid value for "name", name cannot be nil.') end if @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 @goal.nil? invalid_properties.push('invalid value for "goal", goal cannot be nil.') end pattern = Regexp.new(/^\d+$/) if !@portfolio_bid_strategy_id.nil? && @portfolio_bid_strategy_id !~ pattern invalid_properties.push("invalid value for \"portfolio_bid_strategy_id\", must conform to the pattern #{pattern}.") end invalid_properties end |
#to_hash ⇒ Hash
Returns the object in the form of hash
451 452 453 454 455 456 457 458 459 460 461 462 463 |
# File 'lib/zernio-sdk/models/create_ad_campaign_request.rb', line 451 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
271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 |
# File 'lib/zernio-sdk/models/create_ad_campaign_request.rb', line 271 def valid? warn '[DEPRECATED] the `valid?` method is obsolete' return false if @account_id.nil? return false if @ad_account_id.nil? return false if @name.nil? return false if @name.to_s.length > 255 return false if @goal.nil? goal_validator = EnumAttributeValidator.new('String', ["engagement", "traffic", "awareness", "video_views", "lead_generation", "lead_conversion", "job_applicants", "conversions", "app_promotion", "catalog_sales", "page_likes"]) return false unless goal_validator.valid?(@goal) = EnumAttributeValidator.new('String', ["AUCTION", "RESERVED"]) return false unless .valid?() budget_type_validator = EnumAttributeValidator.new('String', ["daily", "lifetime"]) return false unless budget_type_validator.valid?(@budget_type) status_validator = EnumAttributeValidator.new('String', ["ACTIVE", "PAUSED"]) return false unless status_validator.valid?(@status) bid_strategy_validator = EnumAttributeValidator.new('String', ["LOWEST_COST_WITHOUT_CAP", "LOWEST_COST_WITH_BID_CAP", "COST_CAP", "LOWEST_COST_WITH_MIN_ROAS"]) return false unless bid_strategy_validator.valid?(@bid_strategy) return false if !@portfolio_bid_strategy_id.nil? && @portfolio_bid_strategy_id !~ Regexp.new(/^\d+$/) true end |