klaviyo_sdk 1.0.1.20220329 → 1.0.4.20220329

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 (121) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +13 -0
  3. data/README.md +121 -99
  4. data/klaviyo_sdk.gemspec +1 -1
  5. data/lib/klaviyo_sdk/api/campaigns_api.rb +1 -1
  6. data/lib/klaviyo_sdk/api/data_privacy_api.rb +3 -3
  7. data/lib/klaviyo_sdk/api/lists_segments_api.rb +1 -1
  8. data/lib/klaviyo_sdk/api/metrics_api.rb +1 -1
  9. data/lib/klaviyo_sdk/api/profiles_api.rb +67 -1
  10. data/lib/klaviyo_sdk/api/templates_api.rb +1 -1
  11. data/lib/klaviyo_sdk/api/track_identify_api.rb +1 -1
  12. data/lib/klaviyo_sdk/api_client.rb +2 -2
  13. data/lib/klaviyo_sdk/api_error.rb +1 -1
  14. data/lib/klaviyo_sdk/configuration.rb +1 -1
  15. data/lib/klaviyo_sdk/models/campaign.rb +202 -22
  16. data/lib/klaviyo_sdk/models/campaign_lists.rb +318 -0
  17. data/lib/klaviyo_sdk/models/campaigns.rb +487 -0
  18. data/lib/klaviyo_sdk/models/check_membership_request.rb +4 -4
  19. data/lib/klaviyo_sdk/models/delete_email.rb +4 -4
  20. data/lib/klaviyo_sdk/models/delete_person.rb +4 -4
  21. data/lib/klaviyo_sdk/models/delete_phone.rb +4 -4
  22. data/lib/klaviyo_sdk/models/deprecated_get_list_response.rb +4 -4
  23. data/lib/klaviyo_sdk/models/deprecated_get_list_response_data.rb +4 -4
  24. data/lib/klaviyo_sdk/models/global_exclusion_response_data.rb +4 -4
  25. data/lib/klaviyo_sdk/models/identify_payload.rb +4 -4
  26. data/lib/klaviyo_sdk/models/identify_payload_properties.rb +4 -4
  27. data/lib/klaviyo_sdk/models/inline_object.rb +9 -4
  28. data/lib/klaviyo_sdk/models/inline_object3.rb +4 -4
  29. data/lib/klaviyo_sdk/models/inline_object4.rb +4 -4
  30. data/lib/klaviyo_sdk/models/inline_object5.rb +4 -5
  31. data/lib/klaviyo_sdk/models/inline_response200.rb +218 -0
  32. data/lib/klaviyo_sdk/models/metric.rb +4 -4
  33. data/lib/klaviyo_sdk/models/metric_export.rb +4 -4
  34. data/lib/klaviyo_sdk/models/metric_timeline.rb +4 -4
  35. data/lib/klaviyo_sdk/models/metric_timeline_data.rb +4 -4
  36. data/lib/klaviyo_sdk/models/person.rb +4 -4
  37. data/lib/klaviyo_sdk/models/person.rb.bak +4 -4
  38. data/lib/klaviyo_sdk/models/privacy_email.rb +4 -4
  39. data/lib/klaviyo_sdk/models/privacy_id.rb +4 -4
  40. data/lib/klaviyo_sdk/models/privacy_phone.rb +4 -4
  41. data/lib/klaviyo_sdk/models/rendered_template.rb +4 -4
  42. data/lib/klaviyo_sdk/models/template.rb +4 -4
  43. data/lib/klaviyo_sdk/models/track_payload.rb +4 -4
  44. data/lib/klaviyo_sdk/models/track_payload_customer_properties.rb +4 -4
  45. data/lib/klaviyo_sdk/models/track_payload_properties.rb +4 -4
  46. data/lib/klaviyo_sdk/version.rb +1 -1
  47. data/lib/klaviyo_sdk.rb +10 -7
  48. metadata +6 -76
  49. data/docs/Campaign.md +0 -38
  50. data/docs/CampaignsApi.md +0 -707
  51. data/docs/CheckMembershipRequest.md +0 -22
  52. data/docs/DataPrivacyApi.md +0 -81
  53. data/docs/DeleteEmail.md +0 -18
  54. data/docs/DeletePerson.md +0 -18
  55. data/docs/DeletePhone.md +0 -18
  56. data/docs/DeprecatedGetListResponse.md +0 -30
  57. data/docs/DeprecatedGetListResponseData.md +0 -28
  58. data/docs/GlobalExclusionResponseData.md +0 -30
  59. data/docs/IdentifyPayload.md +0 -20
  60. data/docs/IdentifyPayloadProperties.md +0 -42
  61. data/docs/InlineObject.md +0 -18
  62. data/docs/InlineObject3.md +0 -18
  63. data/docs/InlineObject4.md +0 -18
  64. data/docs/InlineObject5.md +0 -22
  65. data/docs/ListsSegmentsApi.md +0 -1198
  66. data/docs/Metric.md +0 -28
  67. data/docs/MetricExport.md +0 -32
  68. data/docs/MetricTimeline.md +0 -24
  69. data/docs/MetricTimelineData.md +0 -34
  70. data/docs/MetricsApi.md +0 -329
  71. data/docs/Person.md +0 -56
  72. data/docs/PrivacyEmail.md +0 -18
  73. data/docs/PrivacyId.md +0 -18
  74. data/docs/PrivacyPhone.md +0 -18
  75. data/docs/ProfilesApi.md +0 -391
  76. data/docs/RenderedTemplate.md +0 -24
  77. data/docs/Template.md +0 -30
  78. data/docs/TemplatesApi.md +0 -541
  79. data/docs/TrackIdentifyApi.md +0 -267
  80. data/docs/TrackPayload.md +0 -24
  81. data/docs/TrackPayloadCustomerProperties.md +0 -20
  82. data/docs/TrackPayloadProperties.md +0 -22
  83. data/git_push.sh +0 -57
  84. data/klaviyo_sdk-1.0.0.20220329.gem +0 -0
  85. data/spec/api/campaigns_api_spec.rb +0 -165
  86. data/spec/api/data_privacy_api_spec.rb +0 -47
  87. data/spec/api/lists_segments_api_spec.rb +0 -239
  88. data/spec/api/metrics_api_spec.rb +0 -96
  89. data/spec/api/profiles_api_spec.rb +0 -103
  90. data/spec/api/templates_api_spec.rb +0 -130
  91. data/spec/api/track_identify_api_spec.rb +0 -83
  92. data/spec/api_client_spec.rb +0 -226
  93. data/spec/configuration_spec.rb +0 -42
  94. data/spec/models/campaign_spec.rb +0 -94
  95. data/spec/models/check_membership_request_spec.rb +0 -46
  96. data/spec/models/delete_email_spec.rb +0 -34
  97. data/spec/models/delete_person_spec.rb +0 -34
  98. data/spec/models/delete_phone_spec.rb +0 -34
  99. data/spec/models/deprecated_get_list_response_data_spec.rb +0 -64
  100. data/spec/models/deprecated_get_list_response_spec.rb +0 -70
  101. data/spec/models/global_exclusion_response_data_spec.rb +0 -70
  102. data/spec/models/identify_payload_properties_spec.rb +0 -106
  103. data/spec/models/identify_payload_spec.rb +0 -40
  104. data/spec/models/inline_object3_spec.rb +0 -34
  105. data/spec/models/inline_object4_spec.rb +0 -34
  106. data/spec/models/inline_object5_spec.rb +0 -46
  107. data/spec/models/inline_object_spec.rb +0 -34
  108. data/spec/models/metric_export_spec.rb +0 -76
  109. data/spec/models/metric_spec.rb +0 -64
  110. data/spec/models/metric_timeline_data_spec.rb +0 -82
  111. data/spec/models/metric_timeline_spec.rb +0 -52
  112. data/spec/models/person_spec.rb +0 -148
  113. data/spec/models/privacy_email_spec.rb +0 -34
  114. data/spec/models/privacy_id_spec.rb +0 -34
  115. data/spec/models/privacy_phone_spec.rb +0 -34
  116. data/spec/models/rendered_template_spec.rb +0 -52
  117. data/spec/models/template_spec.rb +0 -70
  118. data/spec/models/track_payload_customer_properties_spec.rb +0 -40
  119. data/spec/models/track_payload_properties_spec.rb +0 -46
  120. data/spec/models/track_payload_spec.rb +0 -52
  121. data/spec/spec_helper.rb +0 -111
@@ -0,0 +1,487 @@
1
+ =begin
2
+ #Klaviyo API
3
+
4
+ #Empowering creators to own their destiny
5
+
6
+ The version of the OpenAPI document: 2022.03.29
7
+
8
+ Generated by: https://openapi-generator.tech
9
+ OpenAPI Generator version: 5.4.0
10
+
11
+ =end
12
+
13
+ require 'date'
14
+ require 'time'
15
+
16
+ module Klaviyo
17
+ class Campaigns
18
+ attr_accessor :object
19
+
20
+ attr_accessor :id
21
+
22
+ attr_accessor :name
23
+
24
+ attr_accessor :subject
25
+
26
+ attr_accessor :from_email
27
+
28
+ attr_accessor :from_name
29
+
30
+ attr_accessor :lists
31
+
32
+ attr_accessor :excluded_lists
33
+
34
+ attr_accessor :status
35
+
36
+ attr_accessor :status_id
37
+
38
+ attr_accessor :status_label
39
+
40
+ attr_accessor :sent_at
41
+
42
+ attr_accessor :send_time
43
+
44
+ attr_accessor :created
45
+
46
+ attr_accessor :updated
47
+
48
+ attr_accessor :num_recipients
49
+
50
+ attr_accessor :campaign_type
51
+
52
+ attr_accessor :is_segmented
53
+
54
+ attr_accessor :message_type
55
+
56
+ attr_accessor :template_id
57
+
58
+ class EnumAttributeValidator
59
+ attr_reader :datatype
60
+ attr_reader :allowable_values
61
+
62
+ def initialize(datatype, allowable_values)
63
+ @allowable_values = allowable_values.map do |value|
64
+ case datatype.to_s
65
+ when /Integer/i
66
+ value.to_i
67
+ when /Float/i
68
+ value.to_f
69
+ else
70
+ value
71
+ end
72
+ end
73
+ end
74
+
75
+ def valid?(value)
76
+ !value || allowable_values.include?(value)
77
+ end
78
+ end
79
+
80
+ # Attribute mapping from ruby-style variable name to JSON key.
81
+ def self.attribute_map
82
+ {
83
+ :'object' => :'object',
84
+ :'id' => :'id',
85
+ :'name' => :'name',
86
+ :'subject' => :'subject',
87
+ :'from_email' => :'from_email',
88
+ :'from_name' => :'from_name',
89
+ :'lists' => :'lists',
90
+ :'excluded_lists' => :'excluded_lists',
91
+ :'status' => :'status',
92
+ :'status_id' => :'status_id',
93
+ :'status_label' => :'status_label',
94
+ :'sent_at' => :'sent_at',
95
+ :'send_time' => :'send_time',
96
+ :'created' => :'created',
97
+ :'updated' => :'updated',
98
+ :'num_recipients' => :'num_recipients',
99
+ :'campaign_type' => :'campaign_type',
100
+ :'is_segmented' => :'is_segmented',
101
+ :'message_type' => :'message_type',
102
+ :'template_id' => :'template_id'
103
+ }
104
+ end
105
+
106
+ # Returns all the JSON keys this model knows about
107
+ def self.acceptable_attributes
108
+ attribute_map.values
109
+ end
110
+
111
+ # Attribute type mapping.
112
+ def self.openapi_types
113
+ {
114
+ :'object' => :'String',
115
+ :'id' => :'String',
116
+ :'name' => :'String',
117
+ :'subject' => :'String',
118
+ :'from_email' => :'String',
119
+ :'from_name' => :'String',
120
+ :'lists' => :'Array<CampaignLists>',
121
+ :'excluded_lists' => :'Array<CampaignLists>',
122
+ :'status' => :'String',
123
+ :'status_id' => :'Integer',
124
+ :'status_label' => :'String',
125
+ :'sent_at' => :'Time',
126
+ :'send_time' => :'Time',
127
+ :'created' => :'Time',
128
+ :'updated' => :'Time',
129
+ :'num_recipients' => :'Integer',
130
+ :'campaign_type' => :'String',
131
+ :'is_segmented' => :'Boolean',
132
+ :'message_type' => :'String',
133
+ :'template_id' => :'String'
134
+ }
135
+ end
136
+
137
+ # List of attributes with nullable: true
138
+ def self.openapi_nullable
139
+ Set.new([
140
+ ])
141
+ end
142
+
143
+ # Initializes the object
144
+ # @param [Hash] attributes Model attributes in the form of hash
145
+ def initialize(attributes = {})
146
+ if (!attributes.is_a?(Hash))
147
+ fail ArgumentError, "The input argument (attributes) must be a hash in `Klaviyo::Campaigns` initialize method"
148
+ end
149
+
150
+ # check to see if the attribute exists and convert string to symbol for hash key
151
+ attributes = attributes.each_with_object({}) { |(k, v), h|
152
+ if (!self.class.attribute_map.key?(k.to_sym))
153
+ fail ArgumentError, "`#{k}` is not a valid attribute in `Klaviyo::Campaigns`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
154
+ end
155
+ h[k.to_sym] = v
156
+ }
157
+
158
+ if attributes.key?(:'object')
159
+ self.object = attributes[:'object']
160
+ end
161
+
162
+ if attributes.key?(:'id')
163
+ self.id = attributes[:'id']
164
+ end
165
+
166
+ if attributes.key?(:'name')
167
+ self.name = attributes[:'name']
168
+ end
169
+
170
+ if attributes.key?(:'subject')
171
+ self.subject = attributes[:'subject']
172
+ end
173
+
174
+ if attributes.key?(:'from_email')
175
+ self.from_email = attributes[:'from_email']
176
+ end
177
+
178
+ if attributes.key?(:'from_name')
179
+ self.from_name = attributes[:'from_name']
180
+ end
181
+
182
+ if attributes.key?(:'lists')
183
+ if (value = attributes[:'lists']).is_a?(Array)
184
+ self.lists = value
185
+ end
186
+ end
187
+
188
+ if attributes.key?(:'excluded_lists')
189
+ if (value = attributes[:'excluded_lists']).is_a?(Array)
190
+ self.excluded_lists = value
191
+ end
192
+ end
193
+
194
+ if attributes.key?(:'status')
195
+ self.status = attributes[:'status']
196
+ end
197
+
198
+ if attributes.key?(:'status_id')
199
+ self.status_id = attributes[:'status_id']
200
+ end
201
+
202
+ if attributes.key?(:'status_label')
203
+ self.status_label = attributes[:'status_label']
204
+ end
205
+
206
+ if attributes.key?(:'sent_at')
207
+ self.sent_at = attributes[:'sent_at']
208
+ end
209
+
210
+ if attributes.key?(:'send_time')
211
+ self.send_time = attributes[:'send_time']
212
+ end
213
+
214
+ if attributes.key?(:'created')
215
+ self.created = attributes[:'created']
216
+ end
217
+
218
+ if attributes.key?(:'updated')
219
+ self.updated = attributes[:'updated']
220
+ end
221
+
222
+ if attributes.key?(:'num_recipients')
223
+ self.num_recipients = attributes[:'num_recipients']
224
+ end
225
+
226
+ if attributes.key?(:'campaign_type')
227
+ self.campaign_type = attributes[:'campaign_type']
228
+ end
229
+
230
+ if attributes.key?(:'is_segmented')
231
+ self.is_segmented = attributes[:'is_segmented']
232
+ end
233
+
234
+ if attributes.key?(:'message_type')
235
+ self.message_type = attributes[:'message_type']
236
+ end
237
+
238
+ if attributes.key?(:'template_id')
239
+ self.template_id = attributes[:'template_id']
240
+ end
241
+ end
242
+
243
+ # Show invalid properties with the reasons. Usually used together with valid?
244
+ # @return Array for valid properties with the reasons
245
+ def list_invalid_properties
246
+ invalid_properties = Array.new
247
+ if !@status_id.nil? && @status_id > 13
248
+ invalid_properties.push('invalid value for "status_id", must be smaller than or equal to 13.')
249
+ end
250
+
251
+ if !@status_id.nil? && @status_id < 0
252
+ invalid_properties.push('invalid value for "status_id", must be greater than or equal to 0.')
253
+ end
254
+
255
+ invalid_properties
256
+ end
257
+
258
+ # Check to see if the all the properties in the model are valid
259
+ # @return true if the model is valid
260
+ def valid?
261
+ status_validator = EnumAttributeValidator.new('String', ["draft", "sent", "cancelled", "queued", "cancelled_no_recipients_smart_sending", "cancelled_no_recipients_scheduling", "cancelled_account_disabled", "scheduling", "sending", "sending_timezones", "variations_sent", "preparing_to_schedule", "cancelled_internal_error"])
262
+ return false unless status_validator.valid?(@status)
263
+ return false if !@status_id.nil? && @status_id > 13
264
+ return false if !@status_id.nil? && @status_id < 0
265
+ status_label_validator = EnumAttributeValidator.new('String', ["Scheduled", "Sent", "Draft", "Cancelled", "Adding Recipients", "Sending", "Variations Sent", "Sending Segments", "Cancelled: Smart Sending", "Preparing to send", "Cancelled: Account Disabled", "Cancelled: No Recipients", "Preparing to schedule", "Cancelled: Internal Error"])
266
+ return false unless status_label_validator.valid?(@status_label)
267
+ campaign_type_validator = EnumAttributeValidator.new('String', ["Timezone", "REGULAR", "A/B Content", "A/B Send Time", "Batch", "A/B Segments by Send Time", "A/B Segments by Send Time (STO)", "SMS Segments by Message Per Second"])
268
+ return false unless campaign_type_validator.valid?(@campaign_type)
269
+ message_type_validator = EnumAttributeValidator.new('String', ["email", "sms", "push"])
270
+ return false unless message_type_validator.valid?(@message_type)
271
+ true
272
+ end
273
+
274
+ # Custom attribute writer method checking allowed values (enum).
275
+ # @param [Object] status Object to be assigned
276
+ def status=(status)
277
+ validator = EnumAttributeValidator.new('String', ["draft", "sent", "cancelled", "queued", "cancelled_no_recipients_smart_sending", "cancelled_no_recipients_scheduling", "cancelled_account_disabled", "scheduling", "sending", "sending_timezones", "variations_sent", "preparing_to_schedule", "cancelled_internal_error"])
278
+ unless validator.valid?(status)
279
+ fail ArgumentError, "invalid value for \"status\", must be one of #{validator.allowable_values}."
280
+ end
281
+ @status = status
282
+ end
283
+
284
+ # Custom attribute writer method with validation
285
+ # @param [Object] status_id Value to be assigned
286
+ def status_id=(status_id)
287
+ if !status_id.nil? && status_id > 13
288
+ fail ArgumentError, 'invalid value for "status_id", must be smaller than or equal to 13.'
289
+ end
290
+
291
+ if !status_id.nil? && status_id < 0
292
+ fail ArgumentError, 'invalid value for "status_id", must be greater than or equal to 0.'
293
+ end
294
+
295
+ @status_id = status_id
296
+ end
297
+
298
+ # Custom attribute writer method checking allowed values (enum).
299
+ # @param [Object] status_label Object to be assigned
300
+ def status_label=(status_label)
301
+ validator = EnumAttributeValidator.new('String', ["Scheduled", "Sent", "Draft", "Cancelled", "Adding Recipients", "Sending", "Variations Sent", "Sending Segments", "Cancelled: Smart Sending", "Preparing to send", "Cancelled: Account Disabled", "Cancelled: No Recipients", "Preparing to schedule", "Cancelled: Internal Error"])
302
+ unless validator.valid?(status_label)
303
+ fail ArgumentError, "invalid value for \"status_label\", must be one of #{validator.allowable_values}."
304
+ end
305
+ @status_label = status_label
306
+ end
307
+
308
+ # Custom attribute writer method checking allowed values (enum).
309
+ # @param [Object] campaign_type Object to be assigned
310
+ def campaign_type=(campaign_type)
311
+ validator = EnumAttributeValidator.new('String', ["Timezone", "REGULAR", "A/B Content", "A/B Send Time", "Batch", "A/B Segments by Send Time", "A/B Segments by Send Time (STO)", "SMS Segments by Message Per Second"])
312
+ unless validator.valid?(campaign_type)
313
+ fail ArgumentError, "invalid value for \"campaign_type\", must be one of #{validator.allowable_values}."
314
+ end
315
+ @campaign_type = campaign_type
316
+ end
317
+
318
+ # Custom attribute writer method checking allowed values (enum).
319
+ # @param [Object] message_type Object to be assigned
320
+ def message_type=(message_type)
321
+ validator = EnumAttributeValidator.new('String', ["email", "sms", "push"])
322
+ unless validator.valid?(message_type)
323
+ fail ArgumentError, "invalid value for \"message_type\", must be one of #{validator.allowable_values}."
324
+ end
325
+ @message_type = message_type
326
+ end
327
+
328
+ # Checks equality by comparing each attribute.
329
+ # @param [Object] Object to be compared
330
+ def ==(o)
331
+ return true if self.equal?(o)
332
+ self.class == o.class &&
333
+ object == o.object &&
334
+ id == o.id &&
335
+ name == o.name &&
336
+ subject == o.subject &&
337
+ from_email == o.from_email &&
338
+ from_name == o.from_name &&
339
+ lists == o.lists &&
340
+ excluded_lists == o.excluded_lists &&
341
+ status == o.status &&
342
+ status_id == o.status_id &&
343
+ status_label == o.status_label &&
344
+ sent_at == o.sent_at &&
345
+ send_time == o.send_time &&
346
+ created == o.created &&
347
+ updated == o.updated &&
348
+ num_recipients == o.num_recipients &&
349
+ campaign_type == o.campaign_type &&
350
+ is_segmented == o.is_segmented &&
351
+ message_type == o.message_type &&
352
+ template_id == o.template_id
353
+ end
354
+
355
+ # @see the `==` method
356
+ # @param [Object] Object to be compared
357
+ def eql?(o)
358
+ self == o
359
+ end
360
+
361
+ # Calculates hash code according to all attributes.
362
+ # @return [Integer] Hash code
363
+ def hash
364
+ [object, id, name, subject, from_email, from_name, lists, excluded_lists, status, status_id, status_label, sent_at, send_time, created, updated, num_recipients, campaign_type, is_segmented, message_type, template_id].hash
365
+ end
366
+
367
+ # Builds the object from hash
368
+ # @param [Hash] attributes Model attributes in the form of hash
369
+ # @return [Object] Returns the model itself
370
+ def self.build_from_hash(attributes)
371
+ new.build_from_hash(attributes)
372
+ end
373
+
374
+ # Builds the object from hash
375
+ # @param [Hash] attributes Model attributes in the form of hash
376
+ # @return [Object] Returns the model itself
377
+ def build_from_hash(attributes)
378
+ return nil unless attributes.is_a?(Hash)
379
+ self.class.openapi_types.each_pair do |key, type|
380
+ if attributes[self.class.attribute_map[key]].nil? && self.class.openapi_nullable.include?(key)
381
+ self.send("#{key}=", nil)
382
+ elsif type =~ /\AArray<(.*)>/i
383
+ # check to ensure the input is an array given that the attribute
384
+ # is documented as an array but the input is not
385
+ if attributes[self.class.attribute_map[key]].is_a?(Array)
386
+ self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
387
+ end
388
+ elsif !attributes[self.class.attribute_map[key]].nil?
389
+ self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
390
+ end
391
+ end
392
+
393
+ self
394
+ end
395
+
396
+ # Deserializes the data based on type
397
+ # @param string type Data type
398
+ # @param string value Value to be deserialized
399
+ # @return [Object] Deserialized data
400
+ def _deserialize(type, value)
401
+ case type.to_sym
402
+ when :Time
403
+ Time.parse(value)
404
+ when :Date
405
+ Date.parse(value)
406
+ when :String
407
+ value.to_s
408
+ when :Integer
409
+ value.to_i
410
+ when :Float
411
+ value.to_f
412
+ when :Boolean
413
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
414
+ true
415
+ else
416
+ false
417
+ end
418
+ when :Object
419
+ # generic object (usually a Hash), return directly
420
+ value
421
+ when /\AArray<(?<inner_type>.+)>\z/
422
+ inner_type = Regexp.last_match[:inner_type]
423
+ value.map { |v| _deserialize(inner_type, v) }
424
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
425
+ k_type = Regexp.last_match[:k_type]
426
+ v_type = Regexp.last_match[:v_type]
427
+ {}.tap do |hash|
428
+ value.each do |k, v|
429
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
430
+ end
431
+ end
432
+ else # model
433
+ # models (e.g. Pet) or oneOf
434
+ klass = Klaviyo.const_get(type)
435
+ klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
436
+ end
437
+ end
438
+
439
+ # Returns the string representation of the object
440
+ # @return [String] String presentation of the object
441
+ def to_s
442
+ to_hash.to_s
443
+ end
444
+
445
+ # to_body is an alias to to_hash (backward compatibility)
446
+ # @return [Hash] Returns the object in the form of hash
447
+ def to_body
448
+ to_hash
449
+ end
450
+
451
+ # Returns the object in the form of hash
452
+ # @return [Hash] Returns the object in the form of hash
453
+ def to_hash
454
+ hash = {}
455
+ self.class.attribute_map.each_pair do |attr, param|
456
+ value = self.send(attr)
457
+ if value.nil?
458
+ is_nullable = self.class.openapi_nullable.include?(attr)
459
+ next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
460
+ end
461
+
462
+ hash[param] = _to_hash(value)
463
+ end
464
+ hash
465
+ end
466
+
467
+ # Outputs non-array value in the form of hash
468
+ # For object, use to_hash. Otherwise, just return the value
469
+ # @param [Object] value Any valid value
470
+ # @return [Hash] Returns the value in the form of hash
471
+ def _to_hash(value)
472
+ if value.is_a?(Array)
473
+ value.compact.map { |v| _to_hash(v) }
474
+ elsif value.is_a?(Hash)
475
+ {}.tap do |hash|
476
+ value.each { |k, v| hash[k] = _to_hash(v) }
477
+ end
478
+ elsif value.respond_to? :to_hash
479
+ value.to_hash
480
+ else
481
+ value
482
+ end
483
+ end
484
+
485
+ end
486
+
487
+ end
@@ -13,7 +13,7 @@ OpenAPI Generator version: 5.4.0
13
13
  require 'date'
14
14
  require 'time'
15
15
 
16
- module Client
16
+ module Klaviyo
17
17
  class CheckMembershipRequest
18
18
  # List of email addresses
19
19
  attr_accessor :emails
@@ -56,13 +56,13 @@ module Client
56
56
  # @param [Hash] attributes Model attributes in the form of hash
57
57
  def initialize(attributes = {})
58
58
  if (!attributes.is_a?(Hash))
59
- fail ArgumentError, "The input argument (attributes) must be a hash in `Client::CheckMembershipRequest` initialize method"
59
+ fail ArgumentError, "The input argument (attributes) must be a hash in `Klaviyo::CheckMembershipRequest` initialize method"
60
60
  end
61
61
 
62
62
  # check to see if the attribute exists and convert string to symbol for hash key
63
63
  attributes = attributes.each_with_object({}) { |(k, v), h|
64
64
  if (!self.class.attribute_map.key?(k.to_sym))
65
- fail ArgumentError, "`#{k}` is not a valid attribute in `Client::CheckMembershipRequest`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
65
+ fail ArgumentError, "`#{k}` is not a valid attribute in `Klaviyo::CheckMembershipRequest`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
66
66
  end
67
67
  h[k.to_sym] = v
68
68
  }
@@ -188,7 +188,7 @@ module Client
188
188
  end
189
189
  else # model
190
190
  # models (e.g. Pet) or oneOf
191
- klass = Client.const_get(type)
191
+ klass = Klaviyo.const_get(type)
192
192
  klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
193
193
  end
194
194
  end
@@ -13,7 +13,7 @@ OpenAPI Generator version: 5.4.0
13
13
  require 'date'
14
14
  require 'time'
15
15
 
16
- module Client
16
+ module Klaviyo
17
17
  class DeleteEmail
18
18
  attr_accessor :email
19
19
 
@@ -46,13 +46,13 @@ module Client
46
46
  # @param [Hash] attributes Model attributes in the form of hash
47
47
  def initialize(attributes = {})
48
48
  if (!attributes.is_a?(Hash))
49
- fail ArgumentError, "The input argument (attributes) must be a hash in `Client::DeleteEmail` initialize method"
49
+ fail ArgumentError, "The input argument (attributes) must be a hash in `Klaviyo::DeleteEmail` initialize method"
50
50
  end
51
51
 
52
52
  # check to see if the attribute exists and convert string to symbol for hash key
53
53
  attributes = attributes.each_with_object({}) { |(k, v), h|
54
54
  if (!self.class.attribute_map.key?(k.to_sym))
55
- fail ArgumentError, "`#{k}` is not a valid attribute in `Client::DeleteEmail`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
55
+ fail ArgumentError, "`#{k}` is not a valid attribute in `Klaviyo::DeleteEmail`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
56
56
  end
57
57
  h[k.to_sym] = v
58
58
  }
@@ -162,7 +162,7 @@ module Client
162
162
  end
163
163
  else # model
164
164
  # models (e.g. Pet) or oneOf
165
- klass = Client.const_get(type)
165
+ klass = Klaviyo.const_get(type)
166
166
  klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
167
167
  end
168
168
  end
@@ -13,7 +13,7 @@ OpenAPI Generator version: 5.4.0
13
13
  require 'date'
14
14
  require 'time'
15
15
 
16
- module Client
16
+ module Klaviyo
17
17
  class DeletePerson
18
18
  attr_accessor :person_id
19
19
 
@@ -46,13 +46,13 @@ module Client
46
46
  # @param [Hash] attributes Model attributes in the form of hash
47
47
  def initialize(attributes = {})
48
48
  if (!attributes.is_a?(Hash))
49
- fail ArgumentError, "The input argument (attributes) must be a hash in `Client::DeletePerson` initialize method"
49
+ fail ArgumentError, "The input argument (attributes) must be a hash in `Klaviyo::DeletePerson` initialize method"
50
50
  end
51
51
 
52
52
  # check to see if the attribute exists and convert string to symbol for hash key
53
53
  attributes = attributes.each_with_object({}) { |(k, v), h|
54
54
  if (!self.class.attribute_map.key?(k.to_sym))
55
- fail ArgumentError, "`#{k}` is not a valid attribute in `Client::DeletePerson`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
55
+ fail ArgumentError, "`#{k}` is not a valid attribute in `Klaviyo::DeletePerson`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
56
56
  end
57
57
  h[k.to_sym] = v
58
58
  }
@@ -162,7 +162,7 @@ module Client
162
162
  end
163
163
  else # model
164
164
  # models (e.g. Pet) or oneOf
165
- klass = Client.const_get(type)
165
+ klass = Klaviyo.const_get(type)
166
166
  klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
167
167
  end
168
168
  end
@@ -13,7 +13,7 @@ OpenAPI Generator version: 5.4.0
13
13
  require 'date'
14
14
  require 'time'
15
15
 
16
- module Client
16
+ module Klaviyo
17
17
  class DeletePhone
18
18
  # Phone Number
19
19
  attr_accessor :phone_number
@@ -47,13 +47,13 @@ module Client
47
47
  # @param [Hash] attributes Model attributes in the form of hash
48
48
  def initialize(attributes = {})
49
49
  if (!attributes.is_a?(Hash))
50
- fail ArgumentError, "The input argument (attributes) must be a hash in `Client::DeletePhone` initialize method"
50
+ fail ArgumentError, "The input argument (attributes) must be a hash in `Klaviyo::DeletePhone` initialize method"
51
51
  end
52
52
 
53
53
  # check to see if the attribute exists and convert string to symbol for hash key
54
54
  attributes = attributes.each_with_object({}) { |(k, v), h|
55
55
  if (!self.class.attribute_map.key?(k.to_sym))
56
- fail ArgumentError, "`#{k}` is not a valid attribute in `Client::DeletePhone`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
56
+ fail ArgumentError, "`#{k}` is not a valid attribute in `Klaviyo::DeletePhone`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
57
57
  end
58
58
  h[k.to_sym] = v
59
59
  }
@@ -163,7 +163,7 @@ module Client
163
163
  end
164
164
  else # model
165
165
  # models (e.g. Pet) or oneOf
166
- klass = Client.const_get(type)
166
+ klass = Klaviyo.const_get(type)
167
167
  klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
168
168
  end
169
169
  end
@@ -13,7 +13,7 @@ OpenAPI Generator version: 5.4.0
13
13
  require 'date'
14
14
  require 'time'
15
15
 
16
- module Client
16
+ module Klaviyo
17
17
  class DeprecatedGetListResponse
18
18
  attr_accessor :object
19
19
 
@@ -70,13 +70,13 @@ module Client
70
70
  # @param [Hash] attributes Model attributes in the form of hash
71
71
  def initialize(attributes = {})
72
72
  if (!attributes.is_a?(Hash))
73
- fail ArgumentError, "The input argument (attributes) must be a hash in `Client::DeprecatedGetListResponse` initialize method"
73
+ fail ArgumentError, "The input argument (attributes) must be a hash in `Klaviyo::DeprecatedGetListResponse` initialize method"
74
74
  end
75
75
 
76
76
  # check to see if the attribute exists and convert string to symbol for hash key
77
77
  attributes = attributes.each_with_object({}) { |(k, v), h|
78
78
  if (!self.class.attribute_map.key?(k.to_sym))
79
- fail ArgumentError, "`#{k}` is not a valid attribute in `Client::DeprecatedGetListResponse`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
79
+ fail ArgumentError, "`#{k}` is not a valid attribute in `Klaviyo::DeprecatedGetListResponse`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
80
80
  end
81
81
  h[k.to_sym] = v
82
82
  }
@@ -242,7 +242,7 @@ module Client
242
242
  end
243
243
  else # model
244
244
  # models (e.g. Pet) or oneOf
245
- klass = Client.const_get(type)
245
+ klass = Klaviyo.const_get(type)
246
246
  klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
247
247
  end
248
248
  end
@@ -13,7 +13,7 @@ OpenAPI Generator version: 5.4.0
13
13
  require 'date'
14
14
  require 'time'
15
15
 
16
- module Client
16
+ module Klaviyo
17
17
  class DeprecatedGetListResponseData
18
18
  attr_accessor :object
19
19
 
@@ -66,13 +66,13 @@ module Client
66
66
  # @param [Hash] attributes Model attributes in the form of hash
67
67
  def initialize(attributes = {})
68
68
  if (!attributes.is_a?(Hash))
69
- fail ArgumentError, "The input argument (attributes) must be a hash in `Client::DeprecatedGetListResponseData` initialize method"
69
+ fail ArgumentError, "The input argument (attributes) must be a hash in `Klaviyo::DeprecatedGetListResponseData` initialize method"
70
70
  end
71
71
 
72
72
  # check to see if the attribute exists and convert string to symbol for hash key
73
73
  attributes = attributes.each_with_object({}) { |(k, v), h|
74
74
  if (!self.class.attribute_map.key?(k.to_sym))
75
- fail ArgumentError, "`#{k}` is not a valid attribute in `Client::DeprecatedGetListResponseData`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
75
+ fail ArgumentError, "`#{k}` is not a valid attribute in `Klaviyo::DeprecatedGetListResponseData`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
76
76
  end
77
77
  h[k.to_sym] = v
78
78
  }
@@ -207,7 +207,7 @@ module Client
207
207
  end
208
208
  else # model
209
209
  # models (e.g. Pet) or oneOf
210
- klass = Client.const_get(type)
210
+ klass = Klaviyo.const_get(type)
211
211
  klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
212
212
  end
213
213
  end