Class: PinterestSdkClient::IntegrationLog

Inherits:
ApiModelBase show all
Defined in:
lib/pinterest_sdk/models/integration_log.rb

Overview

Schema for log sent from an integration application.

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 = {}) ⇒ IntegrationLog

Initializes the object

Parameters:

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

    Model attributes in the form of hash



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

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

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

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

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

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

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

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

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

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

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

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

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

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

Instance Attribute Details

#advertiser_idObject

Returns the value of attribute advertiser_id.



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

def advertiser_id
  @advertiser_id
end

#app_version_numberObject

Version number of the integration application.



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

def app_version_number
  @app_version_number
end

#client_timestampObject

Timestamp in milliseconds of when the log was executed at the client.



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

def client_timestamp
  @client_timestamp
end

#errorObject

Returns the value of attribute error.



27
28
29
# File 'lib/pinterest_sdk/models/integration_log.rb', line 27

def error
  @error
end

#event_typeObject

Log event type



30
31
32
# File 'lib/pinterest_sdk/models/integration_log.rb', line 30

def event_type
  @event_type
end

#external_business_idObject

Returns the value of attribute external_business_id.



32
33
34
# File 'lib/pinterest_sdk/models/integration_log.rb', line 32

def external_business_id
  @external_business_id
end

#feed_profile_idObject

Returns the value of attribute feed_profile_id.



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

def feed_profile_id
  @feed_profile_id
end

#log_levelObject

Log level type



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

def log_level
  @log_level
end

#merchant_idObject

Returns the value of attribute merchant_id.



39
40
41
# File 'lib/pinterest_sdk/models/integration_log.rb', line 39

def merchant_id
  @merchant_id
end

#messageObject

Explanation of the event that occured.



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

def message
  @message
end

#platform_version_numberObject

Version number of the platform the integration application is running on.



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

def platform_version_number
  @platform_version_number
end

#requestObject

Returns the value of attribute request.



47
48
49
# File 'lib/pinterest_sdk/models/integration_log.rb', line 47

def request
  @request
end

#tag_idObject

Returns the value of attribute tag_id.



49
50
51
# File 'lib/pinterest_sdk/models/integration_log.rb', line 49

def tag_id
  @tag_id
end

Class Method Details

.acceptable_attribute_mapObject

Returns attribute mapping this model knows about



93
94
95
# File 'lib/pinterest_sdk/models/integration_log.rb', line 93

def self.acceptable_attribute_map
  attribute_map
end

.acceptable_attributesObject

Returns all the JSON keys this model knows about



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

def self.acceptable_attributes
  acceptable_attribute_map.values
end

.attribute_mapObject

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



74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
# File 'lib/pinterest_sdk/models/integration_log.rb', line 74

def self.attribute_map
  {
    :'advertiser_id' => :'advertiser_id',
    :'app_version_number' => :'app_version_number',
    :'client_timestamp' => :'client_timestamp',
    :'error' => :'error',
    :'event_type' => :'event_type',
    :'external_business_id' => :'external_business_id',
    :'feed_profile_id' => :'feed_profile_id',
    :'log_level' => :'log_level',
    :'merchant_id' => :'merchant_id',
    :'message' => :'message',
    :'platform_version_number' => :'platform_version_number',
    :'request' => :'request',
    :'tag_id' => :'tag_id'
  }
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



438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
# File 'lib/pinterest_sdk/models/integration_log.rb', line 438

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



122
123
124
125
126
127
128
129
130
# File 'lib/pinterest_sdk/models/integration_log.rb', line 122

def self.openapi_nullable
  Set.new([
    :'advertiser_id',
    :'external_business_id',
    :'feed_profile_id',
    :'merchant_id',
    :'tag_id'
  ])
end

.openapi_typesObject

Attribute type mapping.



103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
# File 'lib/pinterest_sdk/models/integration_log.rb', line 103

def self.openapi_types
  {
    :'advertiser_id' => :'String',
    :'app_version_number' => :'String',
    :'client_timestamp' => :'Integer',
    :'error' => :'IntegrationLogClientError',
    :'event_type' => :'String',
    :'external_business_id' => :'String',
    :'feed_profile_id' => :'String',
    :'log_level' => :'String',
    :'merchant_id' => :'String',
    :'message' => :'String',
    :'platform_version_number' => :'String',
    :'request' => :'IntegrationLogClientRequest',
    :'tag_id' => :'String'
  }
end

Instance Method Details

#==(o) ⇒ Object

Checks equality by comparing each attribute.

Parameters:

  • Object (Object)

    to be compared



405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
# File 'lib/pinterest_sdk/models/integration_log.rb', line 405

def ==(o)
  return true if self.equal?(o)
  self.class == o.class &&
      advertiser_id == o.advertiser_id &&
      app_version_number == o.app_version_number &&
      client_timestamp == o.client_timestamp &&
      error == o.error &&
      event_type == o.event_type &&
      external_business_id == o.external_business_id &&
      feed_profile_id == o.feed_profile_id &&
      log_level == o.log_level &&
      merchant_id == o.merchant_id &&
      message == o.message &&
      platform_version_number == o.platform_version_number &&
      request == o.request &&
      tag_id == o.tag_id
end

#eql?(o) ⇒ Boolean

Parameters:

  • Object (Object)

    to be compared

Returns:

  • (Boolean)

See Also:

  • `==` method


425
426
427
# File 'lib/pinterest_sdk/models/integration_log.rb', line 425

def eql?(o)
  self == o
end

#hashInteger

Calculates hash code according to all attributes.

Returns:

  • (Integer)

    Hash code



431
432
433
# File 'lib/pinterest_sdk/models/integration_log.rb', line 431

def hash
  [advertiser_id, app_version_number, client_timestamp, error, event_type, external_business_id, feed_profile_id, log_level, merchant_id, message, platform_version_number, request, tag_id].hash
end

#list_invalid_propertiesObject

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

Returns:

  • Array for valid properties with the reasons



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
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
# File 'lib/pinterest_sdk/models/integration_log.rb', line 209

def list_invalid_properties
  warn '[DEPRECATED] the `list_invalid_properties` method is obsolete'
  invalid_properties = Array.new
  if !@advertiser_id.nil? && @advertiser_id.to_s.length > 128
    invalid_properties.push('invalid value for "advertiser_id", the character length must be smaller than or equal to 128.')
  end

  if !@app_version_number.nil? && @app_version_number.to_s.length > 20
    invalid_properties.push('invalid value for "app_version_number", the character length must be smaller than or equal to 20.')
  end

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

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

  if !@external_business_id.nil? && @external_business_id.to_s.length > 2048
    invalid_properties.push('invalid value for "external_business_id", the character length must be smaller than or equal to 2048.')
  end

  if !@feed_profile_id.nil? && @feed_profile_id.to_s.length > 128
    invalid_properties.push('invalid value for "feed_profile_id", the character length must be smaller than or equal to 128.')
  end

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

  if !@merchant_id.nil? && @merchant_id.to_s.length > 128
    invalid_properties.push('invalid value for "merchant_id", the character length must be smaller than or equal to 128.')
  end

  if !@message.nil? && @message.to_s.length > 8192
    invalid_properties.push('invalid value for "message", the character length must be smaller than or equal to 8192.')
  end

  if !@platform_version_number.nil? && @platform_version_number.to_s.length > 20
    invalid_properties.push('invalid value for "platform_version_number", the character length must be smaller than or equal to 20.')
  end

  if !@tag_id.nil? && @tag_id.to_s.length > 128
    invalid_properties.push('invalid value for "tag_id", the character length must be smaller than or equal to 128.')
  end

  invalid_properties
end

#to_hashHash

Returns the object in the form of hash

Returns:

  • (Hash)

    Returns the object in the form of hash



460
461
462
463
464
465
466
467
468
469
470
471
472
# File 'lib/pinterest_sdk/models/integration_log.rb', line 460

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



261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
# File 'lib/pinterest_sdk/models/integration_log.rb', line 261

def valid?
  warn '[DEPRECATED] the `valid?` method is obsolete'
  return false if !@advertiser_id.nil? && @advertiser_id.to_s.length > 128
  return false if !@app_version_number.nil? && @app_version_number.to_s.length > 20
  return false if @client_timestamp.nil?
  return false if @event_type.nil?
  event_type_validator = EnumAttributeValidator.new('String', ["APP", "API"])
  return false unless event_type_validator.valid?(@event_type)
  return false if !@external_business_id.nil? && @external_business_id.to_s.length > 2048
  return false if !@feed_profile_id.nil? && @feed_profile_id.to_s.length > 128
  return false if @log_level.nil?
  log_level_validator = EnumAttributeValidator.new('String', ["INFO", "WARN", "ERROR"])
  return false unless log_level_validator.valid?(@log_level)
  return false if !@merchant_id.nil? && @merchant_id.to_s.length > 128
  return false if !@message.nil? && @message.to_s.length > 8192
  return false if !@platform_version_number.nil? && @platform_version_number.to_s.length > 20
  return false if !@tag_id.nil? && @tag_id.to_s.length > 128
  true
end