Class: PinterestSdkClient::ConversionEventsUserDataProperties

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

Initializes the object

Parameters:

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

    Model attributes in the form of hash



130
131
132
133
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
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
# File 'lib/pinterest_sdk/models/conversion_events_user_data_properties.rb', line 130

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Instance Attribute Details

#click_idObject

The unique identifier stored in _epik cookie on your domain or &epik= query parameter in the URL. We highly recommend this on checkout events at least. It may improve reporting performance such as ROAS/CPA.



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

def click_id
  @click_id
end

#client_ip_addressObject

The user’s IP address, which can be either in IPv4 or IPv6 format. Used for matching. We highly recommend this for all events. It may improve reporting performance such as ROAS/CPA.



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

def client_ip_address
  @client_ip_address
end

#client_user_agentObject

The user agent string of the user’s web browser. We highly recommend this for all events. It may improve reporting performance such as ROAS/CPA.



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

def client_user_agent
  @client_user_agent
end

#countryObject

Sha256 hashes of two-character ISO-3166 country code indicating the user’s country, in lowercase. The string should be in the UTF-8 format.



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

def country
  @country
end

#ctObject

Sha256 hashes of user’s city, in lowercase, and without spaces or punctuation. User residency city (mostly billing). The string should be in the UTF-8 format.



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

def ct
  @ct
end

#dbObject

Sha256 hashes of user’s date of birthday, given as year, month, and day. The string should be in the UTF-8 format.



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

def db
  @db
end

#emObject

Sha256 hashes of lowercase version of user’s email addresses. Used for matching. We highly recommend this on checkout events at least. It may improve reporting performance such as ROAS/CPA. The string should be in the UTF-8 format.



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

def em
  @em
end

#external_idObject

Sha256 hashes of the unique id from the advertiser that identifies a user in their space, e.g. user id, loyalty id, etc. We highly recommend this on all events. It may improve reporting performance such as ROAS/CPA. The string should be in the UTF-8 format.



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

def external_id
  @external_id
end

#fnObject

Sha256 hashes of user’s first name, in lowercase. We highly recommend this on checkout events at least. It may improve reporting performance such as ROAS/CPA. The string should be in the UTF-8 format.



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

def fn
  @fn
end

#geObject

Sha256 hashes of user’s gender, in lowercase. Either "f" or "m" or "n" for non-binary gender. The string should be in the UTF-8 format.



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

def ge
  @ge
end

#hashed_maidsObject

Sha256 hashes of user’s "Google Advertising IDs" (GAIDs) or "Apple’s Identifier for Advertisers" (IDFAs). Used for matching. We highly recommend this on checkout events at least. It may improve reporting performance such as ROAS/CPA. The string should be in the UTF-8 format.



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

def hashed_maids
  @hashed_maids
end

#lnObject

Sha256 hashes of user’s last name, in lowercase. We highly recommend this on checkout events at least. It may improve reporting performance such as ROAS/CPA. The string should be in the UTF-8 format.



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

def ln
  @ln
end

#partner_idObject

A unique identifier of visitors’ information defined by third party partners. e.g RampID



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

def partner_id
  @partner_id
end

#phObject

Sha256 hashes of user’s phone numbers, only digits with country code, area code, and number. Remove any symbols, letters, spaces and leading zeros. We highly recommend this on checkout events at least. It may improve reporting performance such as ROAS/CPA. The string should be in the UTF-8 format.



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

def ph
  @ph
end

#stObject

Sha256 hashes of user’s state, given as a two-letter code in lowercase. User residency state (mostly billing). The string should be in the UTF-8 format.



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

def st
  @st
end

#zpObject

Sha256 hashes of user’s zipcode, only digits. User residency zipcode (mostly billing). The string should be in the UTF-8 format.



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

def zp
  @zp
end

Class Method Details

.acceptable_attribute_mapObject

Returns attribute mapping this model knows about



89
90
91
# File 'lib/pinterest_sdk/models/conversion_events_user_data_properties.rb', line 89

def self.acceptable_attribute_map
  attribute_map
end

.acceptable_attributesObject

Returns all the JSON keys this model knows about



94
95
96
# File 'lib/pinterest_sdk/models/conversion_events_user_data_properties.rb', line 94

def self.acceptable_attributes
  acceptable_attribute_map.values
end

.attribute_mapObject

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



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

def self.attribute_map
  {
    :'click_id' => :'click_id',
    :'client_ip_address' => :'client_ip_address',
    :'client_user_agent' => :'client_user_agent',
    :'country' => :'country',
    :'ct' => :'ct',
    :'db' => :'db',
    :'em' => :'em',
    :'external_id' => :'external_id',
    :'fn' => :'fn',
    :'ge' => :'ge',
    :'hashed_maids' => :'hashed_maids',
    :'ln' => :'ln',
    :'partner_id' => :'partner_id',
    :'ph' => :'ph',
    :'st' => :'st',
    :'zp' => :'zp'
  }
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



286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
# File 'lib/pinterest_sdk/models/conversion_events_user_data_properties.rb', line 286

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



121
122
123
124
125
126
# File 'lib/pinterest_sdk/models/conversion_events_user_data_properties.rb', line 121

def self.openapi_nullable
  Set.new([
    :'click_id',
    :'partner_id',
  ])
end

.openapi_typesObject

Attribute type mapping.



99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
# File 'lib/pinterest_sdk/models/conversion_events_user_data_properties.rb', line 99

def self.openapi_types
  {
    :'click_id' => :'String',
    :'client_ip_address' => :'String',
    :'client_user_agent' => :'String',
    :'country' => :'Array<String>',
    :'ct' => :'Array<String>',
    :'db' => :'Array<String>',
    :'em' => :'Array<String>',
    :'external_id' => :'Array<String>',
    :'fn' => :'Array<String>',
    :'ge' => :'Array<String>',
    :'hashed_maids' => :'Array<String>',
    :'ln' => :'Array<String>',
    :'partner_id' => :'String',
    :'ph' => :'Array<String>',
    :'st' => :'Array<String>',
    :'zp' => :'Array<String>'
  }
end

Instance Method Details

#==(o) ⇒ Object

Checks equality by comparing each attribute.

Parameters:

  • Object (Object)

    to be compared



250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
# File 'lib/pinterest_sdk/models/conversion_events_user_data_properties.rb', line 250

def ==(o)
  return true if self.equal?(o)
  self.class == o.class &&
      click_id == o.click_id &&
      client_ip_address == o.client_ip_address &&
      client_user_agent == o.client_user_agent &&
      country == o.country &&
      ct == o.ct &&
      db == o.db &&
      em == o.em &&
      external_id == o.external_id &&
      fn == o.fn &&
      ge == o.ge &&
      hashed_maids == o.hashed_maids &&
      ln == o.ln &&
      partner_id == o.partner_id &&
      ph == o.ph &&
      st == o.st &&
      zp == o.zp
end

#eql?(o) ⇒ Boolean

Parameters:

  • Object (Object)

    to be compared

Returns:

  • (Boolean)

See Also:

  • `==` method


273
274
275
# File 'lib/pinterest_sdk/models/conversion_events_user_data_properties.rb', line 273

def eql?(o)
  self == o
end

#hashInteger

Calculates hash code according to all attributes.

Returns:

  • (Integer)

    Hash code



279
280
281
# File 'lib/pinterest_sdk/models/conversion_events_user_data_properties.rb', line 279

def hash
  [click_id, client_ip_address, client_user_agent, country, ct, db, em, external_id, fn, ge, hashed_maids, ln, partner_id, ph, st, zp].hash
end

#list_invalid_propertiesObject

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

Returns:

  • Array for valid properties with the reasons



235
236
237
238
239
# File 'lib/pinterest_sdk/models/conversion_events_user_data_properties.rb', line 235

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



308
309
310
311
312
313
314
315
316
317
318
319
320
# File 'lib/pinterest_sdk/models/conversion_events_user_data_properties.rb', line 308

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



243
244
245
246
# File 'lib/pinterest_sdk/models/conversion_events_user_data_properties.rb', line 243

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