Class: Late::CreateAdAudienceRequest

Inherits:
ApiModelBase show all
Defined in:
lib/late-sdk/models/create_ad_audience_request.rb

Defined Under Namespace

Classes: EnumAttributeValidator

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from ApiModelBase

_deserialize, #_to_hash, #to_body, #to_s

Constructor Details

#initialize(attributes = {}) ⇒ CreateAdAudienceRequest

Initializes the object

Parameters:

  • attributes (Hash) (defaults to: {})

    Model attributes in the form of hash



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
# File 'lib/late-sdk/models/create_ad_audience_request.rb', line 126

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. = attributes[:'account_id']
  else
    self. = nil
  end

  if attributes.key?(:'ad_account_id')
    self. = attributes[:'ad_account_id']
  else
    self. = 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

  if attributes.key?(:'rule')
    self.rule = attributes[:'rule']
  end

  if attributes.key?(:'customer_file_source')
    self.customer_file_source = attributes[:'customer_file_source']
  end
end

Instance Attribute Details

#account_idObject

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
end

#ad_account_idObject

Must start with act_



21
22
23
# File 'lib/late-sdk/models/create_ad_audience_request.rb', line 21

def 
  @ad_account_id
end

#countryObject

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

#customer_file_sourceObject

Data source declaration for GDPR compliance (customer_list only)



48
49
50
# File 'lib/late-sdk/models/create_ad_audience_request.rb', line 48

def customer_file_source
  @customer_file_source
end

#descriptionObject

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

#nameObject

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_idObject

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

#ratioObject

Required for lookalike audiences



42
43
44
# File 'lib/late-sdk/models/create_ad_audience_request.rb', line 42

def ratio
  @ratio
end

#retention_daysObject

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

#ruleObject

Pixel event rule for website audiences (optional)



45
46
47
# File 'lib/late-sdk/models/create_ad_audience_request.rb', line 45

def rule
  @rule
end

#source_audience_idObject

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

#typeObject

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_mapObject

Returns attribute mapping this model knows about



91
92
93
# File 'lib/late-sdk/models/create_ad_audience_request.rb', line 91

def self.acceptable_attribute_map
  attribute_map
end

.acceptable_attributesObject

Returns all the JSON keys this model knows about



96
97
98
# File 'lib/late-sdk/models/create_ad_audience_request.rb', line 96

def self.acceptable_attributes
  acceptable_attribute_map.values
end

.attribute_mapObject

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/late-sdk/models/create_ad_audience_request.rb', line 73

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',
    :'rule' => :'rule',
    :'customer_file_source' => :'customerFileSource'
  }
end

.build_from_hash(attributes) ⇒ Object

Builds the object from hash

Parameters:

  • attributes (Hash)

    Model attributes in the form of hash

Returns:

  • (Object)

    Returns the model itself



373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
# File 'lib/late-sdk/models/create_ad_audience_request.rb', line 373

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_nullableObject

List of attributes with nullable: true



119
120
121
122
# File 'lib/late-sdk/models/create_ad_audience_request.rb', line 119

def self.openapi_nullable
  Set.new([
  ])
end

.openapi_typesObject

Attribute type mapping.



101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
# File 'lib/late-sdk/models/create_ad_audience_request.rb', line 101

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',
    :'rule' => :'Object',
    :'customer_file_source' => :'String'
  }
end

Instance Method Details

#==(o) ⇒ Object

Checks equality by comparing each attribute.

Parameters:

  • Object (Object)

    to be compared



341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
# File 'lib/late-sdk/models/create_ad_audience_request.rb', line 341

def ==(o)
  return true if self.equal?(o)
  self.class == o.class &&
       == o. &&
       == o. &&
      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 &&
      rule == o.rule &&
      customer_file_source == o.customer_file_source
end

#eql?(o) ⇒ Boolean

Parameters:

  • Object (Object)

    to be compared

Returns:

  • (Boolean)

See Also:

  • `==` method


360
361
362
# File 'lib/late-sdk/models/create_ad_audience_request.rb', line 360

def eql?(o)
  self == o
end

#hashInteger

Calculates hash code according to all attributes.

Returns:

  • (Integer)

    Hash code



366
367
368
# File 'lib/late-sdk/models/create_ad_audience_request.rb', line 366

def hash
  [, , name, description, type, pixel_id, retention_days, source_audience_id, country, ratio, rule, customer_file_source].hash
end

#list_invalid_propertiesObject

Show invalid properties with the reasons. Usually used together with valid?

Returns:

  • Array for valid properties with the reasons



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
235
236
237
238
239
# File 'lib/late-sdk/models/create_ad_audience_request.rb', line 199

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_hashHash

Returns the object in the form of hash

Returns:

  • (Hash)

    Returns the object in the form of hash



395
396
397
398
399
400
401
402
403
404
405
406
407
# File 'lib/late-sdk/models/create_ad_audience_request.rb', line 395

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

Returns:

  • (Boolean)

    true if the model is valid



243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
# File 'lib/late-sdk/models/create_ad_audience_request.rb', line 243

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