Class: PinterestSdkClient::TargetingSpec
- Inherits:
-
ApiModelBase
- Object
- ApiModelBase
- PinterestSdkClient::TargetingSpec
- Defined in:
- lib/pinterest_sdk/models/targeting_spec.rb
Overview
Ad group targeting specification defining the ad group target audience. For example, ‘href="\"iphone\"">APPTYPE“:, "GENDER”:, "LOCALE“:, "LOCATION”:, "MINIMUM_AGE":"18", "MAXIMUM_AGE":"65+"`
Defined Under Namespace
Classes: EnumAttributeValidator
Instance Attribute Summary collapse
-
#age_bucket ⇒ Object
**Legacy field.** Predefined age ranges.
-
#apptype ⇒ Object
Allowed devices.
-
#audience_exclude ⇒ Object
Excluded customer list IDs.
-
#audience_include ⇒ Object
Targeted customer list IDs.
-
#gender ⇒ Object
Targeted genders.
-
#geo ⇒ Object
Location region codes, e.g., "BE-VOV" (East Flanders, Belgium) For complete list, <a href="help.pinterest.com/sub/helpcenter/partner/pinterest_location_targeting_codes.xlsx" target="_blank">click here</a> or postal codes, e.g., "US-94107".
-
#interest ⇒ Object
Array of interest object IDs.
-
#locale ⇒ Object
24 ISO 639-1 two-letter language codes.
-
#location ⇒ Object
22 ISO Alpha 2 two letter country codes or US Nielsen DMA (Designated Market Area) codes (location region codes) (e.g., ["US", "807"]).
-
#maximum_age ⇒ Object
Maximum age to target (inclusive).
-
#minimum_age ⇒ Object
Minimum age to target (inclusive).
-
#shopping_retargeting ⇒ Object
Array of object: lookback_window [Integer]: Number of days ago to start lookback timeframe for dynamic retargeting tag_types [Array of integer]: Event types to target for dynamic retargeting exclusion_window [Integer]: Number of days ago to stop lookback timeframe for dynamic retargeting.
-
#targeting_strategy ⇒ Object
Returns the value of attribute targeting_strategy.
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 = {}) ⇒ TargetingSpec
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 = {}) ⇒ TargetingSpec
Initializes the object
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 |
# File 'lib/pinterest_sdk/models/targeting_spec.rb', line 146 def initialize(attributes = {}) if (!attributes.is_a?(Hash)) fail ArgumentError, "The input argument (attributes) must be a hash in `PinterestSdkClient::TargetingSpec` 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 `PinterestSdkClient::TargetingSpec`. 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?(:'age_bucket') if (value = attributes[:'age_bucket']).is_a?(Array) self.age_bucket = value end end if attributes.key?(:'apptype') if (value = attributes[:'apptype']).is_a?(Array) self.apptype = value end end if attributes.key?(:'audience_exclude') if (value = attributes[:'audience_exclude']).is_a?(Array) self.audience_exclude = value end end if attributes.key?(:'audience_include') if (value = attributes[:'audience_include']).is_a?(Array) self.audience_include = value end end if attributes.key?(:'gender') if (value = attributes[:'gender']).is_a?(Array) self.gender = value end end if attributes.key?(:'geo') if (value = attributes[:'geo']).is_a?(Array) self.geo = value end end if attributes.key?(:'interest') if (value = attributes[:'interest']).is_a?(Array) self.interest = value end end if attributes.key?(:'locale') if (value = attributes[:'locale']).is_a?(Array) self.locale = value end end if attributes.key?(:'location') if (value = attributes[:'location']).is_a?(Array) self.location = value end end if attributes.key?(:'maximum_age') self.maximum_age = attributes[:'maximum_age'] end if attributes.key?(:'minimum_age') self.minimum_age = attributes[:'minimum_age'] end if attributes.key?(:'shopping_retargeting') if (value = attributes[:'shopping_retargeting']).is_a?(Array) self.shopping_retargeting = value end end if attributes.key?(:'targeting_strategy') if (value = attributes[:'targeting_strategy']).is_a?(Array) self.targeting_strategy = value end end end |
Instance Attribute Details
#age_bucket ⇒ Object
**Legacy field.** Predefined age ranges. We recommend using MINIMUM_AGE and MAXIMUM_AGE instead for more flexible targeting. Cannot be combined with MINIMUM_AGE/MAXIMUM_AGE. If neither AGE_BUCKET nor MINIMUM_AGE/MAXIMUM_AGE are specified, all ages will be targeted.
20 21 22 |
# File 'lib/pinterest_sdk/models/targeting_spec.rb', line 20 def age_bucket @age_bucket end |
#apptype ⇒ Object
Allowed devices. If the APPTYPE field is missing, the default behavior in terms of ad delivery is that **All devices/apptypes** will be targeted.
23 24 25 |
# File 'lib/pinterest_sdk/models/targeting_spec.rb', line 23 def apptype @apptype end |
#audience_exclude ⇒ Object
Excluded customer list IDs. Used to drive new customer acquisition goals. For example: ["2542620905475"]. Audience lists need to have at least 100 people with Pinterest accounts in them. If the AUDIENCE_EXCLUDE field is missing, the default behavior in terms of ad delivery is that **No users will be excluded**.
26 27 28 |
# File 'lib/pinterest_sdk/models/targeting_spec.rb', line 26 def audience_exclude @audience_exclude end |
#audience_include ⇒ Object
Targeted customer list IDs. For example: ["2542620905473"]. Audience lists need to have at least 100 people with Pinterest accounts in them Audience lists need to have at least 100 people with Pinterest accounts in them. If the AUDIENCE_INCLUDE field is missing, the default behavior in terms of ad delivery is that **All users will be included**.
29 30 31 |
# File 'lib/pinterest_sdk/models/targeting_spec.rb', line 29 def audience_include @audience_include end |
#gender ⇒ Object
Targeted genders. Values: ["unknown","male","female"]. If the GENDER field is missing, the default behavior in terms of ad delivery is that **All genders will be targeted**.
32 33 34 |
# File 'lib/pinterest_sdk/models/targeting_spec.rb', line 32 def gender @gender end |
#geo ⇒ Object
Location region codes, e.g., "BE-VOV" (East Flanders, Belgium) For complete list, <a href="help.pinterest.com/sub/helpcenter/partner/pinterest_location_targeting_codes.xlsx" target="_blank">click here</a> or postal codes, e.g., "US-94107". Use either region codes or postal codes but not both. At least one of LOCATION or GEO must be specified. If the GEO field is missing, then only LOCATION values will be targeted (see LOCATION field below).
35 36 37 |
# File 'lib/pinterest_sdk/models/targeting_spec.rb', line 35 def geo @geo end |
#interest ⇒ Object
Array of interest object IDs. If the INTEREST field is missing, the default behavior in terms of ad delivery is that **All interests will be targeted**.
38 39 40 |
# File 'lib/pinterest_sdk/models/targeting_spec.rb', line 38 def interest @interest end |
#locale ⇒ Object
24 ISO 639-1 two-letter language codes. If the LOCALE field is not included in the request, all languages are targeted.
41 42 43 |
# File 'lib/pinterest_sdk/models/targeting_spec.rb', line 41 def locale @locale end |
#location ⇒ Object
22 ISO Alpha 2 two letter country codes or US Nielsen DMA (Designated Market Area) codes (location region codes) (e.g., ["US", "807"]). For complete list, <a href="help.pinterest.com/sub/helpcenter/partner/pinterest_location_targeting_codes.xlsx" target="_blank">click here</a>. Location-Country and Location-Metro codes apply. At least one of LOCATION or GEO must be specified. If the LOCATION field is missing, then only GEO values will be targeted (see GEO field above).
44 45 46 |
# File 'lib/pinterest_sdk/models/targeting_spec.rb', line 44 def location @location end |
#maximum_age ⇒ Object
Maximum age to target (inclusive). Values: "18", "19", …, "65", "65+". Must be used together with MINIMUM_AGE. Cannot be combined with AGE_BUCKET. If neither MINIMUM_AGE/MAXIMUM_AGE nor AGE_BUCKET are specified, all ages will be targeted.
47 48 49 |
# File 'lib/pinterest_sdk/models/targeting_spec.rb', line 47 def maximum_age @maximum_age end |
#minimum_age ⇒ Object
Minimum age to target (inclusive). Values: "18", "19", …, "65". Note: 65+ is not allowed for minimum age. Must be used together with MAXIMUM_AGE. Cannot be combined with AGE_BUCKET. If neither MINIMUM_AGE/MAXIMUM_AGE nor AGE_BUCKET are specified, all ages will be targeted.
50 51 52 |
# File 'lib/pinterest_sdk/models/targeting_spec.rb', line 50 def minimum_age @minimum_age end |
#shopping_retargeting ⇒ Object
Array of object: lookback_window [Integer]: Number of days ago to start lookback timeframe for dynamic retargeting tag_types [Array of integer]: Event types to target for dynamic retargeting exclusion_window [Integer]: Number of days ago to stop lookback timeframe for dynamic retargeting
53 54 55 |
# File 'lib/pinterest_sdk/models/targeting_spec.rb', line 53 def shopping_retargeting @shopping_retargeting end |
#targeting_strategy ⇒ Object
Returns the value of attribute targeting_strategy.
56 57 58 |
# File 'lib/pinterest_sdk/models/targeting_spec.rb', line 56 def targeting_strategy @targeting_strategy end |
Class Method Details
.acceptable_attribute_map ⇒ Object
Returns attribute mapping this model knows about
100 101 102 |
# File 'lib/pinterest_sdk/models/targeting_spec.rb', line 100 def self.acceptable_attribute_map attribute_map end |
.acceptable_attributes ⇒ Object
Returns all the JSON keys this model knows about
105 106 107 |
# File 'lib/pinterest_sdk/models/targeting_spec.rb', line 105 def self.acceptable_attributes acceptable_attribute_map.values end |
.attribute_map ⇒ Object
Attribute mapping from ruby-style variable name to JSON key.
81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 |
# File 'lib/pinterest_sdk/models/targeting_spec.rb', line 81 def self.attribute_map { :'age_bucket' => :'AGE_BUCKET', :'apptype' => :'APPTYPE', :'audience_exclude' => :'AUDIENCE_EXCLUDE', :'audience_include' => :'AUDIENCE_INCLUDE', :'gender' => :'GENDER', :'geo' => :'GEO', :'interest' => :'INTEREST', :'locale' => :'LOCALE', :'location' => :'LOCATION', :'maximum_age' => :'MAXIMUM_AGE', :'minimum_age' => :'MINIMUM_AGE', :'shopping_retargeting' => :'SHOPPING_RETARGETING', :'targeting_strategy' => :'TARGETING_STRATEGY' } 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/pinterest_sdk/models/targeting_spec.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
129 130 131 132 133 134 135 136 137 138 139 140 141 142 |
# File 'lib/pinterest_sdk/models/targeting_spec.rb', line 129 def self.openapi_nullable Set.new([ :'age_bucket', :'apptype', :'audience_exclude', :'audience_include', :'gender', :'geo', :'locale', :'location', :'shopping_retargeting', :'targeting_strategy' ]) end |
.openapi_types ⇒ Object
Attribute type mapping.
110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 |
# File 'lib/pinterest_sdk/models/targeting_spec.rb', line 110 def self.openapi_types { :'age_bucket' => :'Array<TargetingSpecAgeBucket>', :'apptype' => :'Array<TargetingSpecAppType>', :'audience_exclude' => :'Array<String>', :'audience_include' => :'Array<String>', :'gender' => :'Array<TargetingSpecGender>', :'geo' => :'Array<String>', :'interest' => :'Array<String>', :'locale' => :'Array<String>', :'location' => :'Array<String>', :'maximum_age' => :'String', :'minimum_age' => :'String', :'shopping_retargeting' => :'Array<TargetingSpecShoppingRetargeting>', :'targeting_strategy' => :'Array<String>' } end |
Instance Method Details
#==(o) ⇒ Object
Checks equality by comparing each attribute.
294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 |
# File 'lib/pinterest_sdk/models/targeting_spec.rb', line 294 def ==(o) return true if self.equal?(o) self.class == o.class && age_bucket == o.age_bucket && apptype == o.apptype && audience_exclude == o.audience_exclude && audience_include == o.audience_include && gender == o.gender && geo == o.geo && interest == o.interest && locale == o.locale && location == o.location && maximum_age == o.maximum_age && minimum_age == o.minimum_age && shopping_retargeting == o.shopping_retargeting && targeting_strategy == o.targeting_strategy end |
#eql?(o) ⇒ Boolean
314 315 316 |
# File 'lib/pinterest_sdk/models/targeting_spec.rb', line 314 def eql?(o) self == o end |
#hash ⇒ Integer
Calculates hash code according to all attributes.
320 321 322 |
# File 'lib/pinterest_sdk/models/targeting_spec.rb', line 320 def hash [age_bucket, apptype, audience_exclude, audience_include, gender, geo, interest, locale, location, maximum_age, minimum_age, shopping_retargeting, targeting_strategy].hash end |
#list_invalid_properties ⇒ Object
Show invalid properties with the reasons. Usually used together with valid?
237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 |
# File 'lib/pinterest_sdk/models/targeting_spec.rb', line 237 def list_invalid_properties warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' invalid_properties = Array.new pattern = Regexp.new(/^\d+\+?$/) if !@maximum_age.nil? && @maximum_age !~ pattern invalid_properties.push("invalid value for \"maximum_age\", must conform to the pattern #{pattern}.") end pattern = Regexp.new(/^\d+$/) if !@minimum_age.nil? && @minimum_age !~ pattern invalid_properties.push("invalid value for \"minimum_age\", must conform to the pattern #{pattern}.") 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/pinterest_sdk/models/targeting_spec.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
255 256 257 258 259 260 |
# File 'lib/pinterest_sdk/models/targeting_spec.rb', line 255 def valid? warn '[DEPRECATED] the `valid?` method is obsolete' return false if !@maximum_age.nil? && @maximum_age !~ Regexp.new(/^\d+\+?$/) return false if !@minimum_age.nil? && @minimum_age !~ Regexp.new(/^\d+$/) true end |