Class: PinterestSdkClient::AdAccountsAudience

Inherits:
ApiModelBase
  • Object
show all
Defined in:
lib/pinterest_sdk/models/ad_accounts_audience.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 = {}) ⇒ AdAccountsAudience

Initializes the object

Parameters:

  • (defaults to: {})

    Model attributes in the form of hash



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
200
201
202
203
204
205
206
# File 'lib/pinterest_sdk/models/ad_accounts_audience.rb', line 139

def initialize(attributes = {})
  if (!attributes.is_a?(Hash))
    fail ArgumentError, "The input argument (attributes) must be a hash in `PinterestSdkClient::AdAccountsAudience` 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::AdAccountsAudience`. 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?(:'ad_account_id')
    self. = attributes[:'ad_account_id']
  end

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

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

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

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

  if attributes.key?(:'id')
    self.id = attributes[:'id']
  else
    self.id = nil
  end

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

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

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

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

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

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

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

Instance Attribute Details

#ad_account_idObject

Ad account ID.



19
20
21
# File 'lib/pinterest_sdk/models/ad_accounts_audience.rb', line 19

def 
  @ad_account_id
end

#audience_typeObject

[Audience types](/docs/reference/glossary/#Audience Types): ACTALIKE, ENGAGEMENT, CUSTOMER_LIST and VISITOR



22
23
24
# File 'lib/pinterest_sdk/models/ad_accounts_audience.rb', line 22

def audience_type
  @audience_type
end

#created_by_company_nameObject

The company that created this audience.



25
26
27
# File 'lib/pinterest_sdk/models/ad_accounts_audience.rb', line 25

def created_by_company_name
  @created_by_company_name
end

#created_timestampObject

Creation time. Unix timestamp in seconds.



28
29
30
# File 'lib/pinterest_sdk/models/ad_accounts_audience.rb', line 28

def created_timestamp
  @created_timestamp
end

#descriptionObject

Audience description.



31
32
33
# File 'lib/pinterest_sdk/models/ad_accounts_audience.rb', line 31

def description
  @description
end

#idObject

Audience ID.



34
35
36
# File 'lib/pinterest_sdk/models/ad_accounts_audience.rb', line 34

def id
  @id
end

#is_ncaObject

Whether the audience derives from a new customer acquisition (expanded matching) customer list. Read-only.



37
38
39
# File 'lib/pinterest_sdk/models/ad_accounts_audience.rb', line 37

def is_nca
  @is_nca
end

#nameObject

Audience name.



40
41
42
# File 'lib/pinterest_sdk/models/ad_accounts_audience.rb', line 40

def name
  @name
end

#ruleObject

Returns the value of attribute rule.



42
43
44
# File 'lib/pinterest_sdk/models/ad_accounts_audience.rb', line 42

def rule
  @rule
end

#sizeObject

Audience size.



45
46
47
# File 'lib/pinterest_sdk/models/ad_accounts_audience.rb', line 45

def size
  @size
end

#statusObject

Audience status. READY, INITIALIZING, TOO_SMALL - Each audience list needs to have at least 100 people with Pinterest accounts before you can start using it.



48
49
50
# File 'lib/pinterest_sdk/models/ad_accounts_audience.rb', line 48

def status
  @status
end

#typeObject

Always "audience".



51
52
53
# File 'lib/pinterest_sdk/models/ad_accounts_audience.rb', line 51

def type
  @type
end

#updated_timestampObject

Last update time. Unix timestamp in seconds.



54
55
56
# File 'lib/pinterest_sdk/models/ad_accounts_audience.rb', line 54

def updated_timestamp
  @updated_timestamp
end

Class Method Details

.acceptable_attribute_mapObject

Returns attribute mapping this model knows about



98
99
100
# File 'lib/pinterest_sdk/models/ad_accounts_audience.rb', line 98

def self.acceptable_attribute_map
  attribute_map
end

.acceptable_attributesObject

Returns all the JSON keys this model knows about



103
104
105
# File 'lib/pinterest_sdk/models/ad_accounts_audience.rb', line 103

def self.acceptable_attributes
  acceptable_attribute_map.values
end

.attribute_mapObject

Attribute mapping from ruby-style variable name to JSON key.



79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
# File 'lib/pinterest_sdk/models/ad_accounts_audience.rb', line 79

def self.attribute_map
  {
    :'ad_account_id' => :'ad_account_id',
    :'audience_type' => :'audience_type',
    :'created_by_company_name' => :'created_by_company_name',
    :'created_timestamp' => :'created_timestamp',
    :'description' => :'description',
    :'id' => :'id',
    :'is_nca' => :'is_nca',
    :'name' => :'name',
    :'rule' => :'rule',
    :'size' => :'size',
    :'status' => :'status',
    :'type' => :'type',
    :'updated_timestamp' => :'updated_timestamp'
  }
end

.build_from_hash(attributes) ⇒ Object

Builds the object from hash

Parameters:

  • Model attributes in the form of hash

Returns:

  • Returns the model itself



305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
# File 'lib/pinterest_sdk/models/ad_accounts_audience.rb', line 305

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



127
128
129
130
131
132
133
134
135
# File 'lib/pinterest_sdk/models/ad_accounts_audience.rb', line 127

def self.openapi_nullable
  Set.new([
    :'created_by_company_name',
    :'created_timestamp',
    :'description',
    :'size',
    :'updated_timestamp'
  ])
end

.openapi_typesObject

Attribute type mapping.



108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
# File 'lib/pinterest_sdk/models/ad_accounts_audience.rb', line 108

def self.openapi_types
  {
    :'ad_account_id' => :'String',
    :'audience_type' => :'AudienceType',
    :'created_by_company_name' => :'String',
    :'created_timestamp' => :'Integer',
    :'description' => :'String',
    :'id' => :'String',
    :'is_nca' => :'Boolean',
    :'name' => :'String',
    :'rule' => :'AdAccountsAudienceRule',
    :'size' => :'Integer',
    :'status' => :'AudienceStatus',
    :'type' => :'String',
    :'updated_timestamp' => :'Integer'
  }
end

Instance Method Details

#==(o) ⇒ Object

Checks equality by comparing each attribute.

Parameters:

  • to be compared



272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
# File 'lib/pinterest_sdk/models/ad_accounts_audience.rb', line 272

def ==(o)
  return true if self.equal?(o)
  self.class == o.class &&
       == o. &&
      audience_type == o.audience_type &&
      created_by_company_name == o.created_by_company_name &&
      created_timestamp == o.created_timestamp &&
      description == o.description &&
      id == o.id &&
      is_nca == o.is_nca &&
      name == o.name &&
      rule == o.rule &&
      size == o.size &&
      status == o.status &&
      type == o.type &&
      updated_timestamp == o.updated_timestamp
end

#eql?(o) ⇒ Boolean

Parameters:

  • to be compared

Returns:

See Also:

  • `==` method


292
293
294
# File 'lib/pinterest_sdk/models/ad_accounts_audience.rb', line 292

def eql?(o)
  self == o
end

#hashInteger

Calculates hash code according to all attributes.

Returns:

  • Hash code



298
299
300
# File 'lib/pinterest_sdk/models/ad_accounts_audience.rb', line 298

def hash
  [, audience_type, created_by_company_name, created_timestamp, description, id, is_nca, name, rule, size, status, type, updated_timestamp].hash
end

#list_invalid_propertiesObject

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

Returns:

  • Array for valid properties with the reasons



210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
# File 'lib/pinterest_sdk/models/ad_accounts_audience.rb', line 210

def list_invalid_properties
  warn '[DEPRECATED] the `list_invalid_properties` method is obsolete'
  invalid_properties = Array.new
  pattern = Regexp.new(/^\d+$/)
  if !@ad_account_id.nil? && @ad_account_id !~ pattern
    invalid_properties.push("invalid value for \"ad_account_id\", must conform to the pattern #{pattern}.")
  end

  if @id.nil?
    invalid_properties.push('invalid value for "id", id cannot be nil.')
  end

  pattern = Regexp.new(/^\d+$/)
  if @id !~ pattern
    invalid_properties.push("invalid value for \"id\", must conform to the pattern #{pattern}.")
  end

  invalid_properties
end

#to_hashHash

Returns the object in the form of hash

Returns:

  • Returns the object in the form of hash



327
328
329
330
331
332
333
334
335
336
337
338
339
# File 'lib/pinterest_sdk/models/ad_accounts_audience.rb', line 327

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:

  • true if the model is valid



232
233
234
235
236
237
238
# File 'lib/pinterest_sdk/models/ad_accounts_audience.rb', line 232

def valid?
  warn '[DEPRECATED] the `valid?` method is obsolete'
  return false if !@ad_account_id.nil? && @ad_account_id !~ Regexp.new(/^\d+$/)
  return false if @id.nil?
  return false if @id !~ Regexp.new(/^\d+$/)
  true
end