Class: Late::CreateAdAudienceRequest
- Inherits:
-
ApiModelBase
- Object
- ApiModelBase
- Late::CreateAdAudienceRequest
- Defined in:
- lib/late-sdk/models/create_ad_audience_request.rb
Defined Under Namespace
Classes: EnumAttributeValidator
Instance Attribute Summary collapse
-
#account_id ⇒ Object
Returns the value of attribute account_id.
-
#ad_account_id ⇒ Object
Must start with act_.
-
#country ⇒ Object
2-letter code, required for lookalike audiences.
-
#description ⇒ Object
Returns the value of attribute description.
-
#name ⇒ Object
Returns the value of attribute name.
-
#pixel_id ⇒ Object
Required for website audiences.
-
#ratio ⇒ Object
Required for lookalike audiences.
-
#retention_days ⇒ Object
Required for website audiences.
-
#source_audience_id ⇒ Object
Required for lookalike audiences.
-
#type ⇒ Object
Returns the value of attribute type.
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 = {}) ⇒ CreateAdAudienceRequest
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 = {}) ⇒ CreateAdAudienceRequest
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 |
# File 'lib/late-sdk/models/create_ad_audience_request.rb', line 116 def initialize(attributes = {}) if (!attributes.is_a?(Hash)) fail ArgumentError, "The input argument (attributes) must be a hash in `Late::CreateAdAudienceRequest` 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 `Late::CreateAdAudienceRequest`. 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?(:'description') self.description = attributes[:'description'] end if attributes.key?(:'type') self.type = attributes[:'type'] else self.type = nil end if attributes.key?(:'pixel_id') self.pixel_id = attributes[:'pixel_id'] end if attributes.key?(:'retention_days') self.retention_days = attributes[:'retention_days'] end if attributes.key?(:'source_audience_id') self.source_audience_id = attributes[:'source_audience_id'] end if attributes.key?(:'country') self.country = attributes[:'country'] end if attributes.key?(:'ratio') self.ratio = attributes[:'ratio'] end end |
Instance Attribute Details
#account_id ⇒ Object
Returns the value of attribute account_id.
18 19 20 |
# File 'lib/late-sdk/models/create_ad_audience_request.rb', line 18 def account_id @account_id end |
#ad_account_id ⇒ Object
Must start with act_
21 22 23 |
# File 'lib/late-sdk/models/create_ad_audience_request.rb', line 21 def ad_account_id @ad_account_id end |
#country ⇒ Object
2-letter code, required for lookalike audiences
39 40 41 |
# File 'lib/late-sdk/models/create_ad_audience_request.rb', line 39 def country @country end |
#description ⇒ Object
Returns the value of attribute description.
25 26 27 |
# File 'lib/late-sdk/models/create_ad_audience_request.rb', line 25 def description @description end |
#name ⇒ Object
Returns the value of attribute name.
23 24 25 |
# File 'lib/late-sdk/models/create_ad_audience_request.rb', line 23 def name @name end |
#pixel_id ⇒ Object
Required for website audiences
30 31 32 |
# File 'lib/late-sdk/models/create_ad_audience_request.rb', line 30 def pixel_id @pixel_id end |
#ratio ⇒ Object
Required for lookalike audiences
42 43 44 |
# File 'lib/late-sdk/models/create_ad_audience_request.rb', line 42 def ratio @ratio end |
#retention_days ⇒ Object
Required for website audiences
33 34 35 |
# File 'lib/late-sdk/models/create_ad_audience_request.rb', line 33 def retention_days @retention_days end |
#source_audience_id ⇒ Object
Required for lookalike audiences
36 37 38 |
# File 'lib/late-sdk/models/create_ad_audience_request.rb', line 36 def source_audience_id @source_audience_id end |
#type ⇒ Object
Returns the value of attribute type.
27 28 29 |
# File 'lib/late-sdk/models/create_ad_audience_request.rb', line 27 def type @type end |
Class Method Details
.acceptable_attribute_map ⇒ Object
Returns attribute mapping this model knows about
83 84 85 |
# File 'lib/late-sdk/models/create_ad_audience_request.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/late-sdk/models/create_ad_audience_request.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/late-sdk/models/create_ad_audience_request.rb', line 67 def self.attribute_map { :'account_id' => :'accountId', :'ad_account_id' => :'adAccountId', :'name' => :'name', :'description' => :'description', :'type' => :'type', :'pixel_id' => :'pixelId', :'retention_days' => :'retentionDays', :'source_audience_id' => :'sourceAudienceId', :'country' => :'country', :'ratio' => :'ratio' } end |
.build_from_hash(attributes) ⇒ Object
Builds the object from hash
353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 |
# File 'lib/late-sdk/models/create_ad_audience_request.rb', line 353 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/late-sdk/models/create_ad_audience_request.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/late-sdk/models/create_ad_audience_request.rb', line 93 def self.openapi_types { :'account_id' => :'String', :'ad_account_id' => :'String', :'name' => :'String', :'description' => :'String', :'type' => :'String', :'pixel_id' => :'String', :'retention_days' => :'Integer', :'source_audience_id' => :'String', :'country' => :'String', :'ratio' => :'Float' } end |
Instance Method Details
#==(o) ⇒ Object
Checks equality by comparing each attribute.
323 324 325 326 327 328 329 330 331 332 333 334 335 336 |
# File 'lib/late-sdk/models/create_ad_audience_request.rb', line 323 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 && description == o.description && type == o.type && pixel_id == o.pixel_id && retention_days == o.retention_days && source_audience_id == o.source_audience_id && country == o.country && ratio == o.ratio end |
#eql?(o) ⇒ Boolean
340 341 342 |
# File 'lib/late-sdk/models/create_ad_audience_request.rb', line 340 def eql?(o) self == o end |
#hash ⇒ Integer
Calculates hash code according to all attributes.
346 347 348 |
# File 'lib/late-sdk/models/create_ad_audience_request.rb', line 346 def hash [account_id, ad_account_id, name, description, type, pixel_id, retention_days, source_audience_id, country, ratio].hash end |
#list_invalid_properties ⇒ Object
Show invalid properties with the reasons. Usually used together with valid?
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 |
# File 'lib/late-sdk/models/create_ad_audience_request.rb', line 181 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 @type.nil? invalid_properties.push('invalid value for "type", type cannot be nil.') end if !@retention_days.nil? && @retention_days > 180 invalid_properties.push('invalid value for "retention_days", must be smaller than or equal to 180.') end if !@retention_days.nil? && @retention_days < 1 invalid_properties.push('invalid value for "retention_days", must be greater than or equal to 1.') end if !@ratio.nil? && @ratio > 0.2 invalid_properties.push('invalid value for "ratio", must be smaller than or equal to 0.2.') end if !@ratio.nil? && @ratio < 0.01 invalid_properties.push('invalid value for "ratio", must be greater than or equal to 0.01.') end invalid_properties end |
#to_hash ⇒ Hash
Returns the object in the form of hash
375 376 377 378 379 380 381 382 383 384 385 386 387 |
# File 'lib/late-sdk/models/create_ad_audience_request.rb', line 375 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
225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 |
# File 'lib/late-sdk/models/create_ad_audience_request.rb', line 225 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 @type.nil? type_validator = EnumAttributeValidator.new('String', ["customer_list", "website", "lookalike"]) return false unless type_validator.valid?(@type) return false if !@retention_days.nil? && @retention_days > 180 return false if !@retention_days.nil? && @retention_days < 1 return false if !@ratio.nil? && @ratio > 0.2 return false if !@ratio.nil? && @ratio < 0.01 true end |