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.
-
#goal ⇒ Object
Mapped to the ODAX objective (same mapping as POST /v1/ads/create).
-
#name ⇒ Object
Returns the value of attribute name.
-
#portfolio_bid_strategy_id ⇒ Object
Google only.
-
#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.
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
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 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 |
# File 'lib/zernio-sdk/models/create_ad_campaign_request.rb', line 126 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?(:'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.
42 43 44 |
# File 'lib/zernio-sdk/models/create_ad_campaign_request.rb', line 42 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.
39 40 41 |
# File 'lib/zernio-sdk/models/create_ad_campaign_request.rb', line 39 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.
32 33 34 |
# File 'lib/zernio-sdk/models/create_ad_campaign_request.rb', line 32 def budget_amount @budget_amount end |
#budget_type ⇒ Object
Returns the value of attribute budget_type.
34 35 36 |
# File 'lib/zernio-sdk/models/create_ad_campaign_request.rb', line 34 def budget_type @budget_type 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 |
#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.
48 49 50 |
# File 'lib/zernio-sdk/models/create_ad_campaign_request.rb', line 48 def portfolio_bid_strategy_id @portfolio_bid_strategy_id end |
#roas_average_floor ⇒ Object
Decimal ROAS multiplier (2.0 = 2.0x). Required for LOWEST_COST_WITH_MIN_ROAS.
45 46 47 |
# File 'lib/zernio-sdk/models/create_ad_campaign_request.rb', line 45 def roas_average_floor @roas_average_floor end |
#special_ad_categories ⇒ Object
Returns the value of attribute special_ad_categories.
29 30 31 |
# File 'lib/zernio-sdk/models/create_ad_campaign_request.rb', line 29 def special_ad_categories @special_ad_categories end |
#status ⇒ Object
Returns the value of attribute status.
36 37 38 |
# File 'lib/zernio-sdk/models/create_ad_campaign_request.rb', line 36 def status @status end |
Class Method Details
.acceptable_attribute_map ⇒ Object
Returns attribute mapping this model knows about
91 92 93 |
# File 'lib/zernio-sdk/models/create_ad_campaign_request.rb', line 91 def self.acceptable_attribute_map attribute_map end |
.acceptable_attributes ⇒ Object
Returns all the JSON keys this model knows about
96 97 98 |
# File 'lib/zernio-sdk/models/create_ad_campaign_request.rb', line 96 def self.acceptable_attributes acceptable_attribute_map.values end |
.attribute_map ⇒ Object
Attribute mapping from ruby-style variable name to JSON key.
73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 |
# File 'lib/zernio-sdk/models/create_ad_campaign_request.rb', line 73 def self.attribute_map { :'account_id' => :'accountId', :'ad_account_id' => :'adAccountId', :'name' => :'name', :'goal' => :'goal', :'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
378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 |
# File 'lib/zernio-sdk/models/create_ad_campaign_request.rb', line 378 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
119 120 121 122 |
# File 'lib/zernio-sdk/models/create_ad_campaign_request.rb', line 119 def self.openapi_nullable Set.new([ ]) end |
.openapi_types ⇒ Object
Attribute type mapping.
101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 |
# File 'lib/zernio-sdk/models/create_ad_campaign_request.rb', line 101 def self.openapi_types { :'account_id' => :'String', :'ad_account_id' => :'String', :'name' => :'String', :'goal' => :'String', :'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.
346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 |
# File 'lib/zernio-sdk/models/create_ad_campaign_request.rb', line 346 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 && 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
365 366 367 |
# File 'lib/zernio-sdk/models/create_ad_campaign_request.rb', line 365 def eql?(o) self == o end |
#hash ⇒ Integer
Calculates hash code according to all attributes.
371 372 373 |
# File 'lib/zernio-sdk/models/create_ad_campaign_request.rb', line 371 def hash [account_id, ad_account_id, name, goal, 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?
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 |
# File 'lib/zernio-sdk/models/create_ad_campaign_request.rb', line 203 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
400 401 402 403 404 405 406 407 408 409 410 411 412 |
# File 'lib/zernio-sdk/models/create_ad_campaign_request.rb', line 400 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
236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 |
# File 'lib/zernio-sdk/models/create_ad_campaign_request.rb', line 236 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) 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 |