Class: PinterestSdkClient::ConversionEventAppInfo

Inherits:
ApiModelBase
  • Object
show all
Defined in:
lib/pinterest_sdk/models/conversion_event_app_info.rb

Overview

Object containing information about the application where event occurred.

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

Initializes the object

Parameters:

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

    Model attributes in the form of hash



94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
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
# File 'lib/pinterest_sdk/models/conversion_event_app_info.rb', line 94

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

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

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

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

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

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

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

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

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

Instance Attribute Details

#app_idObject

App ID in Google Play Store, AppStore or other stores.



20
21
22
# File 'lib/pinterest_sdk/models/conversion_event_app_info.rb', line 20

def app_id
  @app_id
end

#app_nameObject

Name of the app. Primarily used for Mobile Apps.



23
24
25
# File 'lib/pinterest_sdk/models/conversion_event_app_info.rb', line 23

def app_name
  @app_name
end

#app_package_nameObject

App package name



26
27
28
# File 'lib/pinterest_sdk/models/conversion_event_app_info.rb', line 26

def app_package_name
  @app_package_name
end

#app_storeObject

The name of the app distributor or store from which the app was installed. Some options: Samsung Galaxy Store, Google Play Store, Amazon Store, Apple App Store, F-Droid, Aptoide, Obtanium, Huawei AppGallery, Xiaomi Mi GetApps



29
30
31
# File 'lib/pinterest_sdk/models/conversion_event_app_info.rb', line 29

def app_store
  @app_store
end

#app_versionObject

App version. Primarily used for mobile apps



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

def app_version
  @app_version
end

#install_timeObject

App install time. Unix timestamp in seconds



35
36
37
# File 'lib/pinterest_sdk/models/conversion_event_app_info.rb', line 35

def install_time
  @install_time
end

#user_agentObject

User Agent request header. Primarily used for Web events



38
39
40
# File 'lib/pinterest_sdk/models/conversion_event_app_info.rb', line 38

def user_agent
  @user_agent
end

#window_heightObject

Inner height of the window or viewport.



41
42
43
# File 'lib/pinterest_sdk/models/conversion_event_app_info.rb', line 41

def window_height
  @window_height
end

#window_widthObject

Inner width of the window or viewport.



44
45
46
# File 'lib/pinterest_sdk/models/conversion_event_app_info.rb', line 44

def window_width
  @window_width
end

Class Method Details

.acceptable_attribute_mapObject

Returns attribute mapping this model knows about



62
63
64
# File 'lib/pinterest_sdk/models/conversion_event_app_info.rb', line 62

def self.acceptable_attribute_map
  attribute_map
end

.acceptable_attributesObject

Returns all the JSON keys this model knows about



67
68
69
# File 'lib/pinterest_sdk/models/conversion_event_app_info.rb', line 67

def self.acceptable_attributes
  acceptable_attribute_map.values
end

.attribute_mapObject

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



47
48
49
50
51
52
53
54
55
56
57
58
59
# File 'lib/pinterest_sdk/models/conversion_event_app_info.rb', line 47

def self.attribute_map
  {
    :'app_id' => :'app_id',
    :'app_name' => :'app_name',
    :'app_package_name' => :'app_package_name',
    :'app_store' => :'app_store',
    :'app_version' => :'app_version',
    :'install_time' => :'install_time',
    :'user_agent' => :'user_agent',
    :'window_height' => :'window_height',
    :'window_width' => :'window_width'
  }
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



380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
# File 'lib/pinterest_sdk/models/conversion_event_app_info.rb', line 380

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



87
88
89
90
# File 'lib/pinterest_sdk/models/conversion_event_app_info.rb', line 87

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

.openapi_typesObject

Attribute type mapping.



72
73
74
75
76
77
78
79
80
81
82
83
84
# File 'lib/pinterest_sdk/models/conversion_event_app_info.rb', line 72

def self.openapi_types
  {
    :'app_id' => :'String',
    :'app_name' => :'String',
    :'app_package_name' => :'String',
    :'app_store' => :'String',
    :'app_version' => :'String',
    :'install_time' => :'Integer',
    :'user_agent' => :'String',
    :'window_height' => :'Integer',
    :'window_width' => :'Integer'
  }
end

Instance Method Details

#==(o) ⇒ Object

Checks equality by comparing each attribute.

Parameters:

  • Object (Object)

    to be compared



351
352
353
354
355
356
357
358
359
360
361
362
363
# File 'lib/pinterest_sdk/models/conversion_event_app_info.rb', line 351

def ==(o)
  return true if self.equal?(o)
  self.class == o.class &&
      app_id == o.app_id &&
      app_name == o.app_name &&
      app_package_name == o.app_package_name &&
      app_store == o.app_store &&
      app_version == o.app_version &&
      install_time == o.install_time &&
      user_agent == o.user_agent &&
      window_height == o.window_height &&
      window_width == o.window_width
end

#eql?(o) ⇒ Boolean

Parameters:

  • Object (Object)

    to be compared

Returns:

  • (Boolean)

See Also:

  • `==` method


367
368
369
# File 'lib/pinterest_sdk/models/conversion_event_app_info.rb', line 367

def eql?(o)
  self == o
end

#hashInteger

Calculates hash code according to all attributes.

Returns:

  • (Integer)

    Hash code



373
374
375
# File 'lib/pinterest_sdk/models/conversion_event_app_info.rb', line 373

def hash
  [app_id, app_name, app_package_name, app_store, app_version, install_time, user_agent, window_height, window_width].hash
end

#list_invalid_propertiesObject

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

Returns:

  • Array for valid properties with the reasons



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/pinterest_sdk/models/conversion_event_app_info.rb', line 147

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

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

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

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

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

  if !@install_time.nil? && @install_time < 0
    invalid_properties.push('invalid value for "install_time", must be greater than or equal to 0.')
  end

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

  if !@window_height.nil? && @window_height > 30720
    invalid_properties.push('invalid value for "window_height", must be smaller than or equal to 30720.')
  end

  if !@window_height.nil? && @window_height < 0
    invalid_properties.push('invalid value for "window_height", must be greater than or equal to 0.')
  end

  if !@window_width.nil? && @window_width > 30720
    invalid_properties.push('invalid value for "window_width", must be smaller than or equal to 30720.')
  end

  if !@window_width.nil? && @window_width < 0
    invalid_properties.push('invalid value for "window_width", must be greater than or equal to 0.')
  end

  invalid_properties
end

#to_hashHash

Returns the object in the form of hash

Returns:

  • (Hash)

    Returns the object in the form of hash



402
403
404
405
406
407
408
409
410
411
412
413
414
# File 'lib/pinterest_sdk/models/conversion_event_app_info.rb', line 402

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



199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
# File 'lib/pinterest_sdk/models/conversion_event_app_info.rb', line 199

def valid?
  warn '[DEPRECATED] the `valid?` method is obsolete'
  return false if !@app_id.nil? && @app_id.to_s.length > 200
  return false if !@app_name.nil? && @app_name.to_s.length > 200
  return false if !@app_package_name.nil? && @app_package_name.to_s.length > 200
  return false if !@app_store.nil? && @app_store.to_s.length > 100
  return false if !@app_version.nil? && @app_version.to_s.length > 100
  return false if !@install_time.nil? && @install_time < 0
  return false if !@user_agent.nil? && @user_agent.to_s.length > 16384
  return false if !@window_height.nil? && @window_height > 30720
  return false if !@window_height.nil? && @window_height < 0
  return false if !@window_width.nil? && @window_width > 30720
  return false if !@window_width.nil? && @window_width < 0
  true
end