Class: PinterestSdkClient::ConversionEventsDataInner

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

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

Initializes the object

Parameters:

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

    Model attributes in the form of hash



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
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
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
# File 'lib/pinterest_sdk/models/conversion_events_data_inner.rb', line 160

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Instance Attribute Details

#action_sourceObject

<p>The source indicating where the conversion event occurred.</p> - app_android - app_ios - web - offline



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

def action_source
  @action_source
end

#app_idObject

The app store app ID.



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

def app_id
  @app_id
end

#app_infoObject

Returns the value of attribute app_info.



24
25
26
# File 'lib/pinterest_sdk/models/conversion_events_data_inner.rb', line 24

def app_info
  @app_info
end

#app_nameObject

Name of the app.



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

def app_name
  @app_name
end

#app_versionObject

Version of the app.



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

def app_version
  @app_version
end

#custom_dataObject

Returns the value of attribute custom_data.



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

def custom_data
  @custom_data
end

#device_brandObject

Brand of the user device.



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

def device_brand
  @device_brand
end

#device_carrierObject

User device’s mobile carrier.



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

def device_carrier
  @device_carrier
end

#device_infoObject

Returns the value of attribute device_info.



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

def device_info
  @device_info
end

#device_modelObject

Model of the user device.



43
44
45
# File 'lib/pinterest_sdk/models/conversion_events_data_inner.rb', line 43

def device_model
  @device_model
end

#device_typeObject

Type of the user device.



46
47
48
# File 'lib/pinterest_sdk/models/conversion_events_data_inner.rb', line 46

def device_type
  @device_type
end

#event_idObject

A unique id string that identifies this event and can be used for deduping between events ingested via both the conversion API and Pinterest tracking. Without this, event’s data is likely to be double counted and will cause report metric inflation. Third-party vendors make sure this field is updated on both Pinterest tag and Conversions API side before rolling out template for Conversions API.



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

def event_id
  @event_id
end

#event_nameObject

<p>The type of the user event. Please use the right event_name; otherwise the event will not be accepted and show up correctly in reports.</p> - add_payment_info - add_to_cart - add_to_wishlist - app_install - checkout - custom - initiate_checkout - lead - page_visit - search - signup - subscribe - view_category - view_content - watch_video



52
53
54
# File 'lib/pinterest_sdk/models/conversion_events_data_inner.rb', line 52

def event_name
  @event_name
end

#event_source_urlObject

URL of the web conversion event.



55
56
57
# File 'lib/pinterest_sdk/models/conversion_events_data_inner.rb', line 55

def event_source_url
  @event_source_url
end

#event_timeObject

The time when the event happened. Unix timestamp in seconds.



58
59
60
# File 'lib/pinterest_sdk/models/conversion_events_data_inner.rb', line 58

def event_time
  @event_time
end

#languageObject

Two-character ISO-639-1 language code indicating the user’s language.



61
62
63
# File 'lib/pinterest_sdk/models/conversion_events_data_inner.rb', line 61

def language
  @language
end

#opt_outObject

When action_source is web or offline, it defines whether the user has opted out of tracking for web conversion events. While when action_source is app_android or app_ios, it defines whether the user has enabled Limit Ad Tracking on their iOS device, or opted out of Ads Personalization on their Android device.



64
65
66
# File 'lib/pinterest_sdk/models/conversion_events_data_inner.rb', line 64

def opt_out
  @opt_out
end

#os_versionObject

Version of the device operating system.



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

def os_version
  @os_version
end

#partner_nameObject

The third party partner name responsible to send the event to Conversions API on behalf of the advertiser. The naming convention is "ss-partnername" lowercase. E.g ‘ss-shopify’



70
71
72
# File 'lib/pinterest_sdk/models/conversion_events_data_inner.rb', line 70

def partner_name
  @partner_name
end

#user_dataObject

Returns the value of attribute user_data.



72
73
74
# File 'lib/pinterest_sdk/models/conversion_events_data_inner.rb', line 72

def user_data
  @user_data
end

#wifiObject

Whether the event occurred when the user device was connected to wifi.



75
76
77
# File 'lib/pinterest_sdk/models/conversion_events_data_inner.rb', line 75

def wifi
  @wifi
end

Class Method Details

.acceptable_attribute_mapObject

Returns attribute mapping this model knows about



105
106
107
# File 'lib/pinterest_sdk/models/conversion_events_data_inner.rb', line 105

def self.acceptable_attribute_map
  attribute_map
end

.acceptable_attributesObject

Returns all the JSON keys this model knows about



110
111
112
# File 'lib/pinterest_sdk/models/conversion_events_data_inner.rb', line 110

def self.acceptable_attributes
  acceptable_attribute_map.values
end

.attribute_mapObject

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



78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
# File 'lib/pinterest_sdk/models/conversion_events_data_inner.rb', line 78

def self.attribute_map
  {
    :'action_source' => :'action_source',
    :'app_id' => :'app_id',
    :'app_info' => :'app_info',
    :'app_name' => :'app_name',
    :'app_version' => :'app_version',
    :'custom_data' => :'custom_data',
    :'device_brand' => :'device_brand',
    :'device_carrier' => :'device_carrier',
    :'device_info' => :'device_info',
    :'device_model' => :'device_model',
    :'device_type' => :'device_type',
    :'event_id' => :'event_id',
    :'event_name' => :'event_name',
    :'event_source_url' => :'event_source_url',
    :'event_time' => :'event_time',
    :'language' => :'language',
    :'opt_out' => :'opt_out',
    :'os_version' => :'os_version',
    :'partner_name' => :'partner_name',
    :'user_data' => :'user_data',
    :'wifi' => :'wifi'
  }
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



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

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



142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
# File 'lib/pinterest_sdk/models/conversion_events_data_inner.rb', line 142

def self.openapi_nullable
  Set.new([
    :'app_id',
    :'app_name',
    :'app_version',
    :'device_brand',
    :'device_carrier',
    :'device_model',
    :'device_type',
    :'event_source_url',
    :'language',
    :'os_version',
    :'partner_name',
  ])
end

.openapi_typesObject

Attribute type mapping.



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
# File 'lib/pinterest_sdk/models/conversion_events_data_inner.rb', line 115

def self.openapi_types
  {
    :'action_source' => :'String',
    :'app_id' => :'String',
    :'app_info' => :'ConversionEventAppInfo',
    :'app_name' => :'String',
    :'app_version' => :'String',
    :'custom_data' => :'ConversionEventsDataInnerCustomData',
    :'device_brand' => :'String',
    :'device_carrier' => :'String',
    :'device_info' => :'ConversionEventDeviceInfo',
    :'device_model' => :'String',
    :'device_type' => :'String',
    :'event_id' => :'String',
    :'event_name' => :'String',
    :'event_source_url' => :'String',
    :'event_time' => :'Integer',
    :'language' => :'String',
    :'opt_out' => :'Boolean',
    :'os_version' => :'String',
    :'partner_name' => :'String',
    :'user_data' => :'ConversionEventsUserData',
    :'wifi' => :'Boolean'
  }
end

Instance Method Details

#==(o) ⇒ Object

Checks equality by comparing each attribute.

Parameters:

  • Object (Object)

    to be compared



361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
# File 'lib/pinterest_sdk/models/conversion_events_data_inner.rb', line 361

def ==(o)
  return true if self.equal?(o)
  self.class == o.class &&
      action_source == o.action_source &&
      app_id == o.app_id &&
      app_info == o.app_info &&
      app_name == o.app_name &&
      app_version == o.app_version &&
      custom_data == o.custom_data &&
      device_brand == o.device_brand &&
      device_carrier == o.device_carrier &&
      device_info == o.device_info &&
      device_model == o.device_model &&
      device_type == o.device_type &&
      event_id == o.event_id &&
      event_name == o.event_name &&
      event_source_url == o.event_source_url &&
      event_time == o.event_time &&
      language == o.language &&
      opt_out == o.opt_out &&
      os_version == o.os_version &&
      partner_name == o.partner_name &&
      user_data == o.user_data &&
      wifi == o.wifi
end

#eql?(o) ⇒ Boolean

Parameters:

  • Object (Object)

    to be compared

Returns:

  • (Boolean)

See Also:

  • `==` method


389
390
391
# File 'lib/pinterest_sdk/models/conversion_events_data_inner.rb', line 389

def eql?(o)
  self == o
end

#hashInteger

Calculates hash code according to all attributes.

Returns:

  • (Integer)

    Hash code



395
396
397
# File 'lib/pinterest_sdk/models/conversion_events_data_inner.rb', line 395

def hash
  [action_source, app_id, app_info, app_name, app_version, custom_data, device_brand, device_carrier, device_info, device_model, device_type, event_id, event_name, event_source_url, event_time, language, opt_out, os_version, partner_name, user_data, wifi].hash
end

#list_invalid_propertiesObject

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

Returns:

  • Array for valid properties with the reasons



271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
# File 'lib/pinterest_sdk/models/conversion_events_data_inner.rb', line 271

def list_invalid_properties
  warn '[DEPRECATED] the `list_invalid_properties` method is obsolete'
  invalid_properties = Array.new
  if @action_source.nil?
    invalid_properties.push('invalid value for "action_source", action_source cannot be nil.')
  end

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

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

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

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

  invalid_properties
end

#to_hashHash

Returns the object in the form of hash

Returns:

  • (Hash)

    Returns the object in the form of hash



424
425
426
427
428
429
430
431
432
433
434
435
436
# File 'lib/pinterest_sdk/models/conversion_events_data_inner.rb', line 424

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



299
300
301
302
303
304
305
306
307
# File 'lib/pinterest_sdk/models/conversion_events_data_inner.rb', line 299

def valid?
  warn '[DEPRECATED] the `valid?` method is obsolete'
  return false if @action_source.nil?
  return false if @event_id.nil?
  return false if @event_name.nil?
  return false if @event_time.nil?
  return false if @user_data.nil?
  true
end