snap_business 1.0.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (31) hide show
  1. checksums.yaml +7 -0
  2. data/lib/snap_business/api/conversion_api.rb +244 -0
  3. data/lib/snap_business/api/default_api.rb +266 -0
  4. data/lib/snap_business/api_client.rb +428 -0
  5. data/lib/snap_business/api_error.rb +57 -0
  6. data/lib/snap_business/configuration.rb +318 -0
  7. data/lib/snap_business/models/capi_event.rb +590 -0
  8. data/lib/snap_business/models/capi_event_ext.rb +58 -0
  9. data/lib/snap_business/models/response.rb +237 -0
  10. data/lib/snap_business/models/response_error_records.rb +228 -0
  11. data/lib/snap_business/models/response_logs.rb +237 -0
  12. data/lib/snap_business/models/response_logs_log.rb +284 -0
  13. data/lib/snap_business/models/response_stats.rb +235 -0
  14. data/lib/snap_business/models/response_stats_data.rb +226 -0
  15. data/lib/snap_business/models/response_stats_test.rb +226 -0
  16. data/lib/snap_business/models/test_response.rb +259 -0
  17. data/lib/snap_business/models/validated_fields.rb +226 -0
  18. data/lib/snap_business/models/validated_fields_items.rb +262 -0
  19. data/lib/snap_business/models/validated_fields_validated_fields.rb +262 -0
  20. data/lib/snap_business/util/capi_hash.rb +61 -0
  21. data/lib/snap_business/util/constants.rb +16 -0
  22. data/lib/snap_business/version.rb +15 -0
  23. data/lib/snap_business.rb +52 -0
  24. data/spec/api/conversion_api_spec.rb +203 -0
  25. data/spec/api/default_api_spec.rb +45 -0
  26. data/spec/api_client_spec.rb +188 -0
  27. data/spec/configuration_spec.rb +42 -0
  28. data/spec/models/capi_event_spec.rb +127 -0
  29. data/spec/spec_helper.rb +111 -0
  30. data/spec/util/capi_hash_spec.rb +62 -0
  31. metadata +178 -0
@@ -0,0 +1,590 @@
1
+ =begin
2
+ #Snap Conversions API
3
+
4
+ #No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)
5
+
6
+ The version of the OpenAPI document: 1.0.0
7
+
8
+ Generated by: https://openapi-generator.tech
9
+ OpenAPI Generator version: 6.0.1
10
+
11
+ =end
12
+
13
+ require 'date'
14
+ require 'time'
15
+
16
+ require_relative 'capi_event_ext'
17
+
18
+ module SnapBusinessSDK
19
+ class CapiEvent
20
+ prepend CapiEventExt
21
+
22
+ attr_accessor :pixel_id
23
+
24
+ attr_accessor :app_id
25
+
26
+ attr_accessor :snap_app_id
27
+
28
+ attr_accessor :event_type
29
+
30
+ attr_accessor :event_conversion_type
31
+
32
+ attr_accessor :event_tag
33
+
34
+ attr_accessor :timestamp
35
+
36
+ attr_accessor :hashed_email
37
+
38
+ attr_accessor :hashed_mobile_ad_id
39
+
40
+ attr_accessor :uuid_c1
41
+
42
+ attr_accessor :hashed_idfv
43
+
44
+ attr_accessor :hashed_phone_number
45
+
46
+ attr_accessor :user_agent
47
+
48
+ attr_accessor :hashed_ip_address
49
+
50
+ attr_accessor :item_category
51
+
52
+ attr_accessor :item_ids
53
+
54
+ attr_accessor :description
55
+
56
+ attr_accessor :number_items
57
+
58
+ attr_accessor :price
59
+
60
+ attr_accessor :currency
61
+
62
+ attr_accessor :transaction_id
63
+
64
+ attr_accessor :level
65
+
66
+ attr_accessor :client_dedup_id
67
+
68
+ attr_accessor :data_use
69
+
70
+ attr_accessor :search_string
71
+
72
+ attr_accessor :page_url
73
+
74
+ attr_accessor :sign_up_method
75
+
76
+ attr_accessor :hashed_first_name_sha
77
+
78
+ attr_accessor :hashed_first_name_sdx
79
+
80
+ attr_accessor :hashed_middle_name_sha
81
+
82
+ attr_accessor :hashed_middle_name_sdx
83
+
84
+ attr_accessor :hashed_last_name_sha
85
+
86
+ attr_accessor :hashed_last_name_sdx
87
+
88
+ attr_accessor :hashed_city_sha
89
+
90
+ attr_accessor :hashed_city_sdx
91
+
92
+ attr_accessor :hashed_state_sha
93
+
94
+ attr_accessor :hashed_state_sdx
95
+
96
+ attr_accessor :hashed_zip
97
+
98
+ attr_accessor :hashed_dob_month
99
+
100
+ attr_accessor :hashed_dob_day
101
+
102
+ attr_accessor :integration
103
+
104
+ attr_accessor :click_id
105
+
106
+ # Attribute mapping from ruby-style variable name to JSON key.
107
+ def self.attribute_map
108
+ {
109
+ :'pixel_id' => :'pixel_id',
110
+ :'app_id' => :'app_id',
111
+ :'snap_app_id' => :'snap_app_id',
112
+ :'event_type' => :'event_type',
113
+ :'event_conversion_type' => :'event_conversion_type',
114
+ :'event_tag' => :'event_tag',
115
+ :'timestamp' => :'timestamp',
116
+ :'hashed_email' => :'hashed_email',
117
+ :'hashed_mobile_ad_id' => :'hashed_mobile_ad_id',
118
+ :'uuid_c1' => :'uuid_c1',
119
+ :'hashed_idfv' => :'hashed_idfv',
120
+ :'hashed_phone_number' => :'hashed_phone_number',
121
+ :'user_agent' => :'user_agent',
122
+ :'hashed_ip_address' => :'hashed_ip_address',
123
+ :'item_category' => :'item_category',
124
+ :'item_ids' => :'item_ids',
125
+ :'description' => :'description',
126
+ :'number_items' => :'number_items',
127
+ :'price' => :'price',
128
+ :'currency' => :'currency',
129
+ :'transaction_id' => :'transaction_id',
130
+ :'level' => :'level',
131
+ :'client_dedup_id' => :'client_dedup_id',
132
+ :'data_use' => :'data_use',
133
+ :'search_string' => :'search_string',
134
+ :'page_url' => :'page_url',
135
+ :'sign_up_method' => :'sign_up_method',
136
+ :'hashed_first_name_sha' => :'hashed_first_name_sha',
137
+ :'hashed_first_name_sdx' => :'hashed_first_name_sdx',
138
+ :'hashed_middle_name_sha' => :'hashed_middle_name_sha',
139
+ :'hashed_middle_name_sdx' => :'hashed_middle_name_sdx',
140
+ :'hashed_last_name_sha' => :'hashed_last_name_sha',
141
+ :'hashed_last_name_sdx' => :'hashed_last_name_sdx',
142
+ :'hashed_city_sha' => :'hashed_city_sha',
143
+ :'hashed_city_sdx' => :'hashed_city_sdx',
144
+ :'hashed_state_sha' => :'hashed_state_sha',
145
+ :'hashed_state_sdx' => :'hashed_state_sdx',
146
+ :'hashed_zip' => :'hashed_zip',
147
+ :'hashed_dob_month' => :'hashed_dob_month',
148
+ :'hashed_dob_day' => :'hashed_dob_day',
149
+ :'integration' => :'integration',
150
+ :'click_id' => :'click_id'
151
+ }
152
+ end
153
+
154
+ # Returns all the JSON keys this model knows about
155
+ def self.acceptable_attributes
156
+ attribute_map.values
157
+ end
158
+
159
+ # Attribute type mapping.
160
+ def self.openapi_types
161
+ {
162
+ :'pixel_id' => :'String',
163
+ :'app_id' => :'String',
164
+ :'snap_app_id' => :'String',
165
+ :'event_type' => :'String',
166
+ :'event_conversion_type' => :'String',
167
+ :'event_tag' => :'String',
168
+ :'timestamp' => :'String',
169
+ :'hashed_email' => :'String',
170
+ :'hashed_mobile_ad_id' => :'String',
171
+ :'uuid_c1' => :'String',
172
+ :'hashed_idfv' => :'String',
173
+ :'hashed_phone_number' => :'String',
174
+ :'user_agent' => :'String',
175
+ :'hashed_ip_address' => :'String',
176
+ :'item_category' => :'String',
177
+ :'item_ids' => :'String',
178
+ :'description' => :'String',
179
+ :'number_items' => :'String',
180
+ :'price' => :'String',
181
+ :'currency' => :'String',
182
+ :'transaction_id' => :'String',
183
+ :'level' => :'String',
184
+ :'client_dedup_id' => :'String',
185
+ :'data_use' => :'String',
186
+ :'search_string' => :'String',
187
+ :'page_url' => :'String',
188
+ :'sign_up_method' => :'String',
189
+ :'hashed_first_name_sha' => :'String',
190
+ :'hashed_first_name_sdx' => :'String',
191
+ :'hashed_middle_name_sha' => :'String',
192
+ :'hashed_middle_name_sdx' => :'String',
193
+ :'hashed_last_name_sha' => :'String',
194
+ :'hashed_last_name_sdx' => :'String',
195
+ :'hashed_city_sha' => :'String',
196
+ :'hashed_city_sdx' => :'String',
197
+ :'hashed_state_sha' => :'String',
198
+ :'hashed_state_sdx' => :'String',
199
+ :'hashed_zip' => :'String',
200
+ :'hashed_dob_month' => :'String',
201
+ :'hashed_dob_day' => :'String',
202
+ :'integration' => :'String',
203
+ :'click_id' => :'String'
204
+ }
205
+ end
206
+
207
+ # List of attributes with nullable: true
208
+ def self.openapi_nullable
209
+ Set.new([
210
+ ])
211
+ end
212
+
213
+ # Initializes the object
214
+ # @param [Hash] attributes Model attributes in the form of hash
215
+ def initialize(attributes = {})
216
+ if (!attributes.is_a?(Hash))
217
+ fail ArgumentError, "The input argument (attributes) must be a hash in `SnapBusinessSDK::CapiEvent` initialize method"
218
+ end
219
+
220
+ # check to see if the attribute exists and convert string to symbol for hash key
221
+ attributes = attributes.each_with_object({}) { |(k, v), h|
222
+ if (!self.class.attribute_map.key?(k.to_sym))
223
+ fail ArgumentError, "`#{k}` is not a valid attribute in `SnapBusinessSDK::CapiEvent`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
224
+ end
225
+ h[k.to_sym] = v
226
+ }
227
+
228
+ if attributes.key?(:'pixel_id')
229
+ self.pixel_id = attributes[:'pixel_id']
230
+ end
231
+
232
+ if attributes.key?(:'app_id')
233
+ self.app_id = attributes[:'app_id']
234
+ end
235
+
236
+ if attributes.key?(:'snap_app_id')
237
+ self.snap_app_id = attributes[:'snap_app_id']
238
+ end
239
+
240
+ if attributes.key?(:'event_type')
241
+ self.event_type = attributes[:'event_type']
242
+ end
243
+
244
+ if attributes.key?(:'event_conversion_type')
245
+ self.event_conversion_type = attributes[:'event_conversion_type']
246
+ end
247
+
248
+ if attributes.key?(:'event_tag')
249
+ self.event_tag = attributes[:'event_tag']
250
+ end
251
+
252
+ if attributes.key?(:'timestamp')
253
+ self.timestamp = attributes[:'timestamp']
254
+ end
255
+
256
+ if attributes.key?(:'hashed_email')
257
+ self.hashed_email = attributes[:'hashed_email']
258
+ end
259
+
260
+ if attributes.key?(:'hashed_mobile_ad_id')
261
+ self.hashed_mobile_ad_id = attributes[:'hashed_mobile_ad_id']
262
+ end
263
+
264
+ if attributes.key?(:'uuid_c1')
265
+ self.uuid_c1 = attributes[:'uuid_c1']
266
+ end
267
+
268
+ if attributes.key?(:'hashed_idfv')
269
+ self.hashed_idfv = attributes[:'hashed_idfv']
270
+ end
271
+
272
+ if attributes.key?(:'hashed_phone_number')
273
+ self.hashed_phone_number = attributes[:'hashed_phone_number']
274
+ end
275
+
276
+ if attributes.key?(:'user_agent')
277
+ self.user_agent = attributes[:'user_agent']
278
+ end
279
+
280
+ if attributes.key?(:'hashed_ip_address')
281
+ self.hashed_ip_address = attributes[:'hashed_ip_address']
282
+ end
283
+
284
+ if attributes.key?(:'item_category')
285
+ self.item_category = attributes[:'item_category']
286
+ end
287
+
288
+ if attributes.key?(:'item_ids')
289
+ self.item_ids = attributes[:'item_ids']
290
+ end
291
+
292
+ if attributes.key?(:'description')
293
+ self.description = attributes[:'description']
294
+ end
295
+
296
+ if attributes.key?(:'number_items')
297
+ self.number_items = attributes[:'number_items']
298
+ end
299
+
300
+ if attributes.key?(:'price')
301
+ self.price = attributes[:'price']
302
+ end
303
+
304
+ if attributes.key?(:'currency')
305
+ self.currency = attributes[:'currency']
306
+ end
307
+
308
+ if attributes.key?(:'transaction_id')
309
+ self.transaction_id = attributes[:'transaction_id']
310
+ end
311
+
312
+ if attributes.key?(:'level')
313
+ self.level = attributes[:'level']
314
+ end
315
+
316
+ if attributes.key?(:'client_dedup_id')
317
+ self.client_dedup_id = attributes[:'client_dedup_id']
318
+ end
319
+
320
+ if attributes.key?(:'data_use')
321
+ self.data_use = attributes[:'data_use']
322
+ end
323
+
324
+ if attributes.key?(:'search_string')
325
+ self.search_string = attributes[:'search_string']
326
+ end
327
+
328
+ if attributes.key?(:'page_url')
329
+ self.page_url = attributes[:'page_url']
330
+ end
331
+
332
+ if attributes.key?(:'sign_up_method')
333
+ self.sign_up_method = attributes[:'sign_up_method']
334
+ end
335
+
336
+ if attributes.key?(:'hashed_first_name_sha')
337
+ self.hashed_first_name_sha = attributes[:'hashed_first_name_sha']
338
+ end
339
+
340
+ if attributes.key?(:'hashed_first_name_sdx')
341
+ self.hashed_first_name_sdx = attributes[:'hashed_first_name_sdx']
342
+ end
343
+
344
+ if attributes.key?(:'hashed_middle_name_sha')
345
+ self.hashed_middle_name_sha = attributes[:'hashed_middle_name_sha']
346
+ end
347
+
348
+ if attributes.key?(:'hashed_middle_name_sdx')
349
+ self.hashed_middle_name_sdx = attributes[:'hashed_middle_name_sdx']
350
+ end
351
+
352
+ if attributes.key?(:'hashed_last_name_sha')
353
+ self.hashed_last_name_sha = attributes[:'hashed_last_name_sha']
354
+ end
355
+
356
+ if attributes.key?(:'hashed_last_name_sdx')
357
+ self.hashed_last_name_sdx = attributes[:'hashed_last_name_sdx']
358
+ end
359
+
360
+ if attributes.key?(:'hashed_city_sha')
361
+ self.hashed_city_sha = attributes[:'hashed_city_sha']
362
+ end
363
+
364
+ if attributes.key?(:'hashed_city_sdx')
365
+ self.hashed_city_sdx = attributes[:'hashed_city_sdx']
366
+ end
367
+
368
+ if attributes.key?(:'hashed_state_sha')
369
+ self.hashed_state_sha = attributes[:'hashed_state_sha']
370
+ end
371
+
372
+ if attributes.key?(:'hashed_state_sdx')
373
+ self.hashed_state_sdx = attributes[:'hashed_state_sdx']
374
+ end
375
+
376
+ if attributes.key?(:'hashed_zip')
377
+ self.hashed_zip = attributes[:'hashed_zip']
378
+ end
379
+
380
+ if attributes.key?(:'hashed_dob_month')
381
+ self.hashed_dob_month = attributes[:'hashed_dob_month']
382
+ end
383
+
384
+ if attributes.key?(:'hashed_dob_day')
385
+ self.hashed_dob_day = attributes[:'hashed_dob_day']
386
+ end
387
+
388
+ if attributes.key?(:'integration')
389
+ self.integration = attributes[:'integration']
390
+ end
391
+
392
+ if attributes.key?(:'click_id')
393
+ self.click_id = attributes[:'click_id']
394
+ end
395
+ end
396
+
397
+ # Show invalid properties with the reasons. Usually used together with valid?
398
+ # @return Array for valid properties with the reasons
399
+ def list_invalid_properties
400
+ invalid_properties = Array.new
401
+ invalid_properties
402
+ end
403
+
404
+ # Check to see if the all the properties in the model are valid
405
+ # @return true if the model is valid
406
+ def valid?
407
+ true
408
+ end
409
+
410
+ # Checks equality by comparing each attribute.
411
+ # @param [Object] Object to be compared
412
+ def ==(o)
413
+ return true if self.equal?(o)
414
+ self.class == o.class &&
415
+ pixel_id == o.pixel_id &&
416
+ app_id == o.app_id &&
417
+ snap_app_id == o.snap_app_id &&
418
+ event_type == o.event_type &&
419
+ event_conversion_type == o.event_conversion_type &&
420
+ event_tag == o.event_tag &&
421
+ timestamp == o.timestamp &&
422
+ hashed_email == o.hashed_email &&
423
+ hashed_mobile_ad_id == o.hashed_mobile_ad_id &&
424
+ uuid_c1 == o.uuid_c1 &&
425
+ hashed_idfv == o.hashed_idfv &&
426
+ hashed_phone_number == o.hashed_phone_number &&
427
+ user_agent == o.user_agent &&
428
+ hashed_ip_address == o.hashed_ip_address &&
429
+ item_category == o.item_category &&
430
+ item_ids == o.item_ids &&
431
+ description == o.description &&
432
+ number_items == o.number_items &&
433
+ price == o.price &&
434
+ currency == o.currency &&
435
+ transaction_id == o.transaction_id &&
436
+ level == o.level &&
437
+ client_dedup_id == o.client_dedup_id &&
438
+ data_use == o.data_use &&
439
+ search_string == o.search_string &&
440
+ page_url == o.page_url &&
441
+ sign_up_method == o.sign_up_method &&
442
+ hashed_first_name_sha == o.hashed_first_name_sha &&
443
+ hashed_first_name_sdx == o.hashed_first_name_sdx &&
444
+ hashed_middle_name_sha == o.hashed_middle_name_sha &&
445
+ hashed_middle_name_sdx == o.hashed_middle_name_sdx &&
446
+ hashed_last_name_sha == o.hashed_last_name_sha &&
447
+ hashed_last_name_sdx == o.hashed_last_name_sdx &&
448
+ hashed_city_sha == o.hashed_city_sha &&
449
+ hashed_city_sdx == o.hashed_city_sdx &&
450
+ hashed_state_sha == o.hashed_state_sha &&
451
+ hashed_state_sdx == o.hashed_state_sdx &&
452
+ hashed_zip == o.hashed_zip &&
453
+ hashed_dob_month == o.hashed_dob_month &&
454
+ hashed_dob_day == o.hashed_dob_day &&
455
+ integration == o.integration &&
456
+ click_id == o.click_id
457
+ end
458
+
459
+ # @see the `==` method
460
+ # @param [Object] Object to be compared
461
+ def eql?(o)
462
+ self == o
463
+ end
464
+
465
+ # Calculates hash code according to all attributes.
466
+ # @return [Integer] Hash code
467
+ def hash
468
+ [pixel_id, app_id, snap_app_id, event_type, event_conversion_type, event_tag, timestamp, hashed_email, hashed_mobile_ad_id, uuid_c1, hashed_idfv, hashed_phone_number, user_agent, hashed_ip_address, item_category, item_ids, description, number_items, price, currency, transaction_id, level, client_dedup_id, data_use, search_string, page_url, sign_up_method, hashed_first_name_sha, hashed_first_name_sdx, hashed_middle_name_sha, hashed_middle_name_sdx, hashed_last_name_sha, hashed_last_name_sdx, hashed_city_sha, hashed_city_sdx, hashed_state_sha, hashed_state_sdx, hashed_zip, hashed_dob_month, hashed_dob_day, integration, click_id].hash
469
+ end
470
+
471
+ # Builds the object from hash
472
+ # @param [Hash] attributes Model attributes in the form of hash
473
+ # @return [Object] Returns the model itself
474
+ def self.build_from_hash(attributes)
475
+ new.build_from_hash(attributes)
476
+ end
477
+
478
+ # Builds the object from hash
479
+ # @param [Hash] attributes Model attributes in the form of hash
480
+ # @return [Object] Returns the model itself
481
+ def build_from_hash(attributes)
482
+ return nil unless attributes.is_a?(Hash)
483
+ attributes = attributes.transform_keys(&:to_sym)
484
+ self.class.openapi_types.each_pair do |key, type|
485
+ if attributes[self.class.attribute_map[key]].nil? && self.class.openapi_nullable.include?(key)
486
+ self.send("#{key}=", nil)
487
+ elsif type =~ /\AArray<(.*)>/i
488
+ # check to ensure the input is an array given that the attribute
489
+ # is documented as an array but the input is not
490
+ if attributes[self.class.attribute_map[key]].is_a?(Array)
491
+ self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
492
+ end
493
+ elsif !attributes[self.class.attribute_map[key]].nil?
494
+ self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
495
+ end
496
+ end
497
+
498
+ self
499
+ end
500
+
501
+ # Deserializes the data based on type
502
+ # @param string type Data type
503
+ # @param string value Value to be deserialized
504
+ # @return [Object] Deserialized data
505
+ def _deserialize(type, value)
506
+ case type.to_sym
507
+ when :Time
508
+ Time.parse(value)
509
+ when :Date
510
+ Date.parse(value)
511
+ when :String
512
+ value.to_s
513
+ when :Integer
514
+ value.to_i
515
+ when :Float
516
+ value.to_f
517
+ when :Boolean
518
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
519
+ true
520
+ else
521
+ false
522
+ end
523
+ when :Object
524
+ # generic object (usually a Hash), return directly
525
+ value
526
+ when /\AArray<(?<inner_type>.+)>\z/
527
+ inner_type = Regexp.last_match[:inner_type]
528
+ value.map { |v| _deserialize(inner_type, v) }
529
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
530
+ k_type = Regexp.last_match[:k_type]
531
+ v_type = Regexp.last_match[:v_type]
532
+ {}.tap do |hash|
533
+ value.each do |k, v|
534
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
535
+ end
536
+ end
537
+ else # model
538
+ # models (e.g. Pet) or oneOf
539
+ klass = SnapBusinessSDK.const_get(type)
540
+ klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
541
+ end
542
+ end
543
+
544
+ # Returns the string representation of the object
545
+ # @return [String] String presentation of the object
546
+ def to_s
547
+ to_hash.to_s
548
+ end
549
+
550
+ # to_body is an alias to to_hash (backward compatibility)
551
+ # @return [Hash] Returns the object in the form of hash
552
+ def to_body
553
+ to_hash
554
+ end
555
+
556
+ # Returns the object in the form of hash
557
+ # @return [Hash] Returns the object in the form of hash
558
+ def to_hash
559
+ hash = {}
560
+ self.class.attribute_map.each_pair do |attr, param|
561
+ value = self.send(attr)
562
+ if value.nil?
563
+ is_nullable = self.class.openapi_nullable.include?(attr)
564
+ next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
565
+ end
566
+
567
+ hash[param] = _to_hash(value)
568
+ end
569
+ hash
570
+ end
571
+
572
+ # Outputs non-array value in the form of hash
573
+ # For object, use to_hash. Otherwise, just return the value
574
+ # @param [Object] value Any valid value
575
+ # @return [Hash] Returns the value in the form of hash
576
+ def _to_hash(value)
577
+ if value.is_a?(Array)
578
+ value.compact.map { |v| _to_hash(v) }
579
+ elsif value.is_a?(Hash)
580
+ {}.tap do |hash|
581
+ value.each { |k, v| hash[k] = _to_hash(v) }
582
+ end
583
+ elsif value.respond_to? :to_hash
584
+ value.to_hash
585
+ else
586
+ value
587
+ end
588
+ end
589
+ end
590
+ end
@@ -0,0 +1,58 @@
1
+ require_relative '../util/capi_hash'
2
+
3
+ module SnapBusinessSDK
4
+ module CapiEventExt
5
+ def email=(email_plaintext)
6
+ self.hashed_email = CapiHash.norm_and_hash_str email_plaintext
7
+ end
8
+
9
+ def mobile_ad_id=(mobile_ad_id_plaintext)
10
+ self.hashed_mobile_ad_id = CapiHash.norm_and_hash_str mobile_ad_id_plaintext
11
+ end
12
+
13
+ def idfv=(idfv_plaintext)
14
+ self.hashed_idfv = CapiHash.norm_and_hash_str idfv_plaintext
15
+ end
16
+
17
+ def phone_number=(phone_number_plaintext)
18
+ self.hashed_phone_number = CapiHash.norm_and_hash_phone_num phone_number_plaintext
19
+ end
20
+
21
+ def ip_address=(ip_address_plaintext)
22
+ self.hashed_ip_address = CapiHash.norm_and_hash_str ip_address_plaintext
23
+ end
24
+
25
+ def first_name=(first_name_plaintext)
26
+ self.hashed_first_name_sha = CapiHash.norm_and_hash_str first_name_plaintext
27
+ self.hashed_first_name_sdx = CapiHash.norm_and_soundex_str first_name_plaintext
28
+ end
29
+
30
+ def middle_name=(middle_name_plaintext)
31
+ self.hashed_middle_name_sha = CapiHash.norm_and_hash_str middle_name_plaintext
32
+ self.hashed_middle_name_sdx = CapiHash.norm_and_soundex_str middle_name_plaintext
33
+ end
34
+
35
+ def last_name=(last_name_plaintext)
36
+ self.hashed_last_name_sha = CapiHash.norm_and_hash_str last_name_plaintext
37
+ self.hashed_last_name_sdx = CapiHash.norm_and_soundex_str last_name_plaintext
38
+ end
39
+
40
+ def city=(city_plaintext)
41
+ self.hashed_city_sha = CapiHash.norm_and_hash_str city_plaintext
42
+ self.hashed_city_sdx = CapiHash.norm_and_soundex_str city_plaintext
43
+ end
44
+
45
+ def state=(state_plaintext)
46
+ self.hashed_state_sha = CapiHash.norm_and_hash_str state_plaintext
47
+ self.hashed_state_sdx = CapiHash.norm_and_soundex_str state_plaintext
48
+ end
49
+
50
+ def zip=(zip_plaintext)
51
+ self.hashed_zip = CapiHash.norm_and_hash_str zip_plaintext
52
+ end
53
+
54
+ def dob=(dob_plaintext)
55
+ # TODO Parse and hash DD and MM after the format of unhashedDobStr is finalized
56
+ end
57
+ end
58
+ end