Class: PinterestSdkClient::ConversionEventsDataInnerCustomData

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

Overview

Object containing other custom data.

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

Initializes the object

Parameters:

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

    Model attributes in the form of hash



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
206
207
208
209
210
211
212
213
# File 'lib/pinterest_sdk/models/conversion_events_data_inner_custom_data.rb', line 136

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

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

  if attributes.key?(:'content_ids')
    if (value = attributes[:'content_ids']).is_a?(Array)
      self.content_ids = value
    end
  end

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

  if attributes.key?(:'contents')
    if (value = attributes[:'contents']).is_a?(Array)
      self.contents = value
    end
  end

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

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

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

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

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

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

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

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

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

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

Instance Attribute Details

#content_brandObject

The brand of the content associated with the event.



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

def content_brand
  @content_brand
end

#content_categoryObject

The category of the content associated with the event.



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

def 
  @content_category
end

#content_idsObject

List of products IDs. We recommend using this if you are a merchant for PageVisit, AddToCart and Checkouts. For detail, please check <a href="help.pinterest.com/en/business/article/before-you-get-started-with-catalogs" target="_blank">here</a> (Install the Pinterest tag section).



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

def content_ids
  @content_ids
end

#content_nameObject

The name of the page or product associated with the event.



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

def content_name
  @content_name
end

#contentsObject

A list of objects containing information about products, such as price and quantity. We recommend using this if you are a merchant for PageVisit, AddToCart and Checkouts. For detail, please check <a href="help.pinterest.com/en/business/article/before-you-get-started-with-catalogs" target="_blank">here</a> (Install the Pinterest tag section).



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

def contents
  @contents
end

#currencyObject

The ISO-4217 currency code. If not provided, we will default to the advertiser’s currency set during account creation. Your campaign performance needs this field to report right ROAS/CPA.



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

def currency
  @currency
end

#external_measurement_idObject

Only use when instructed.



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

def external_measurement_id
  @external_measurement_id
end

#external_measurement_vendor_idObject

Only use when instructed.



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

def external_measurement_vendor_id
  @external_measurement_vendor_id
end

#npObject

Named partner. Not required, this is for Pinterest internal use only. Please do not use this unless specifically guided.



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

def np
  @np
end

#num_itemsObject

Total number of products of the event. For example, the total number of items purchased in a checkout event. We recommend using this if you are a merchant for AddToCart and Checkouts. For detail, please check <a href="help.pinterest.com/en/business/article/before-you-get-started-with-catalogs" target="_blank">here</a> (Install the Pinterest tag section).



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

def num_items
  @num_items
end

#opt_out_typeObject

Flags for different privacy rights laws to opt out users of sharing personal information. Separate values with commas. See the Help Center article about <a href="help.pinterest.com/en/business/article/limited-data-processing" target="_blank">limited data processing</a> and the developer’s guide for <a href="/docs/track-conversions/track-conversions-in-the-api/#whether-the-user-has-opted-out-of-web-or-offline-conversion-events" target="_blank">tracking conversion events</a> for help with using this parameter.



50
51
52
# File 'lib/pinterest_sdk/models/conversion_events_data_inner_custom_data.rb', line 50

def opt_out_type
  @opt_out_type
end

#order_idObject

The order ID. We recommend sending order_id to help us deduplicate events when necessary. This also helps to run other measurement products at Pinterest.



53
54
55
# File 'lib/pinterest_sdk/models/conversion_events_data_inner_custom_data.rb', line 53

def order_id
  @order_id
end

#predicted_ltvObject

Predicted lifetime value of user associated with the event. Accepted as a string in the request; it will be parsed into a double.



56
57
58
# File 'lib/pinterest_sdk/models/conversion_events_data_inner_custom_data.rb', line 56

def predicted_ltv
  @predicted_ltv
end

#search_stringObject

The search string related to the user conversion event.



59
60
61
# File 'lib/pinterest_sdk/models/conversion_events_data_inner_custom_data.rb', line 59

def search_string
  @search_string
end

#valueObject

Total value of the event. Accepted as a string in the request; it will be parsed into a double. For example, if there are two items in a checkout event, the value should be the total price. We recommend to use pre-tax, pre-shipping final value.



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

def value
  @value
end

Class Method Details

.acceptable_attribute_mapObject

Returns attribute mapping this model knows about



86
87
88
# File 'lib/pinterest_sdk/models/conversion_events_data_inner_custom_data.rb', line 86

def self.acceptable_attribute_map
  attribute_map
end

.acceptable_attributesObject

Returns all the JSON keys this model knows about



91
92
93
# File 'lib/pinterest_sdk/models/conversion_events_data_inner_custom_data.rb', line 91

def self.acceptable_attributes
  acceptable_attribute_map.values
end

.attribute_mapObject

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



65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
# File 'lib/pinterest_sdk/models/conversion_events_data_inner_custom_data.rb', line 65

def self.attribute_map
  {
    :'content_brand' => :'content_brand',
    :'content_category' => :'content_category',
    :'content_ids' => :'content_ids',
    :'content_name' => :'content_name',
    :'contents' => :'contents',
    :'currency' => :'currency',
    :'external_measurement_id' => :'external_measurement_id',
    :'external_measurement_vendor_id' => :'external_measurement_vendor_id',
    :'np' => :'np',
    :'num_items' => :'num_items',
    :'opt_out_type' => :'opt_out_type',
    :'order_id' => :'order_id',
    :'predicted_ltv' => :'predicted_ltv',
    :'search_string' => :'search_string',
    :'value' => :'value'
  }
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



267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
# File 'lib/pinterest_sdk/models/conversion_events_data_inner_custom_data.rb', line 267

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



117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
# File 'lib/pinterest_sdk/models/conversion_events_data_inner_custom_data.rb', line 117

def self.openapi_nullable
  Set.new([
    :'content_brand',
    :'content_category',
    :'content_name',
    :'currency',
    :'external_measurement_id',
    :'external_measurement_vendor_id',
    :'np',
    :'opt_out_type',
    :'order_id',
    :'predicted_ltv',
    :'search_string',
    :'value'
  ])
end

.openapi_typesObject

Attribute type mapping.



96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
# File 'lib/pinterest_sdk/models/conversion_events_data_inner_custom_data.rb', line 96

def self.openapi_types
  {
    :'content_brand' => :'String',
    :'content_category' => :'String',
    :'content_ids' => :'Array<String>',
    :'content_name' => :'String',
    :'contents' => :'Array<ConversionEventsDataInnerCustomDataContentsInner>',
    :'currency' => :'String',
    :'external_measurement_id' => :'String',
    :'external_measurement_vendor_id' => :'Integer',
    :'np' => :'String',
    :'num_items' => :'Integer',
    :'opt_out_type' => :'String',
    :'order_id' => :'String',
    :'predicted_ltv' => :'String',
    :'search_string' => :'String',
    :'value' => :'String'
  }
end

Instance Method Details

#==(o) ⇒ Object

Checks equality by comparing each attribute.

Parameters:

  • Object (Object)

    to be compared



232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
# File 'lib/pinterest_sdk/models/conversion_events_data_inner_custom_data.rb', line 232

def ==(o)
  return true if self.equal?(o)
  self.class == o.class &&
      content_brand == o.content_brand &&
       == o. &&
      content_ids == o.content_ids &&
      content_name == o.content_name &&
      contents == o.contents &&
      currency == o.currency &&
      external_measurement_id == o.external_measurement_id &&
      external_measurement_vendor_id == o.external_measurement_vendor_id &&
      np == o.np &&
      num_items == o.num_items &&
      opt_out_type == o.opt_out_type &&
      order_id == o.order_id &&
      predicted_ltv == o.predicted_ltv &&
      search_string == o.search_string &&
      value == o.value
end

#eql?(o) ⇒ Boolean

Parameters:

  • Object (Object)

    to be compared

Returns:

  • (Boolean)

See Also:

  • `==` method


254
255
256
# File 'lib/pinterest_sdk/models/conversion_events_data_inner_custom_data.rb', line 254

def eql?(o)
  self == o
end

#hashInteger

Calculates hash code according to all attributes.

Returns:

  • (Integer)

    Hash code



260
261
262
# File 'lib/pinterest_sdk/models/conversion_events_data_inner_custom_data.rb', line 260

def hash
  [content_brand, , content_ids, content_name, contents, currency, external_measurement_id, external_measurement_vendor_id, np, num_items, opt_out_type, order_id, predicted_ltv, search_string, value].hash
end

#list_invalid_propertiesObject

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

Returns:

  • Array for valid properties with the reasons



217
218
219
220
221
# File 'lib/pinterest_sdk/models/conversion_events_data_inner_custom_data.rb', line 217

def list_invalid_properties
  warn '[DEPRECATED] the `list_invalid_properties` method is obsolete'
  invalid_properties = Array.new
  invalid_properties
end

#to_hashHash

Returns the object in the form of hash

Returns:

  • (Hash)

    Returns the object in the form of hash



289
290
291
292
293
294
295
296
297
298
299
300
301
# File 'lib/pinterest_sdk/models/conversion_events_data_inner_custom_data.rb', line 289

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



225
226
227
228
# File 'lib/pinterest_sdk/models/conversion_events_data_inner_custom_data.rb', line 225

def valid?
  warn '[DEPRECATED] the `valid?` method is obsolete'
  true
end