klaviyo_sdk 1.0.3.20220329 → 1.0.4.20220329
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +7 -0
- data/README.md +25 -3
- data/klaviyo_sdk.gemspec +1 -1
- data/lib/klaviyo_sdk/api/data_privacy_api.rb +2 -2
- data/lib/klaviyo_sdk/api/profiles_api.rb +66 -0
- data/lib/klaviyo_sdk/api_client.rb +1 -1
- data/lib/klaviyo_sdk/models/campaign.rb +198 -18
- data/lib/klaviyo_sdk/models/campaign_lists.rb +318 -0
- data/lib/klaviyo_sdk/models/campaigns.rb +487 -0
- data/lib/klaviyo_sdk/models/inline_object5.rb +0 -1
- data/lib/klaviyo_sdk/models/inline_response200.rb +218 -0
- data/lib/klaviyo_sdk.rb +3 -0
- metadata +6 -76
- data/docs/Campaign.md +0 -38
- data/docs/CampaignsApi.md +0 -707
- data/docs/CheckMembershipRequest.md +0 -22
- data/docs/DataPrivacyApi.md +0 -81
- data/docs/DeleteEmail.md +0 -18
- data/docs/DeletePerson.md +0 -18
- data/docs/DeletePhone.md +0 -18
- data/docs/DeprecatedGetListResponse.md +0 -30
- data/docs/DeprecatedGetListResponseData.md +0 -28
- data/docs/GlobalExclusionResponseData.md +0 -30
- data/docs/IdentifyPayload.md +0 -20
- data/docs/IdentifyPayloadProperties.md +0 -42
- data/docs/InlineObject.md +0 -18
- data/docs/InlineObject3.md +0 -18
- data/docs/InlineObject4.md +0 -18
- data/docs/InlineObject5.md +0 -22
- data/docs/ListsSegmentsApi.md +0 -1198
- data/docs/Metric.md +0 -28
- data/docs/MetricExport.md +0 -32
- data/docs/MetricTimeline.md +0 -24
- data/docs/MetricTimelineData.md +0 -34
- data/docs/MetricsApi.md +0 -329
- data/docs/Person.md +0 -56
- data/docs/PrivacyEmail.md +0 -18
- data/docs/PrivacyId.md +0 -18
- data/docs/PrivacyPhone.md +0 -18
- data/docs/ProfilesApi.md +0 -391
- data/docs/RenderedTemplate.md +0 -24
- data/docs/Template.md +0 -30
- data/docs/TemplatesApi.md +0 -541
- data/docs/TrackIdentifyApi.md +0 -267
- data/docs/TrackPayload.md +0 -24
- data/docs/TrackPayloadCustomerProperties.md +0 -20
- data/docs/TrackPayloadProperties.md +0 -22
- data/git_push.sh +0 -57
- data/klaviyo_sdk-1.0.3.2022.03.29.gem +0 -0
- data/spec/api/campaigns_api_spec.rb +0 -165
- data/spec/api/data_privacy_api_spec.rb +0 -47
- data/spec/api/lists_segments_api_spec.rb +0 -239
- data/spec/api/metrics_api_spec.rb +0 -96
- data/spec/api/profiles_api_spec.rb +0 -103
- data/spec/api/templates_api_spec.rb +0 -130
- data/spec/api/track_identify_api_spec.rb +0 -83
- data/spec/api_client_spec.rb +0 -226
- data/spec/configuration_spec.rb +0 -42
- data/spec/models/campaign_spec.rb +0 -94
- data/spec/models/check_membership_request_spec.rb +0 -46
- data/spec/models/delete_email_spec.rb +0 -34
- data/spec/models/delete_person_spec.rb +0 -34
- data/spec/models/delete_phone_spec.rb +0 -34
- data/spec/models/deprecated_get_list_response_data_spec.rb +0 -64
- data/spec/models/deprecated_get_list_response_spec.rb +0 -70
- data/spec/models/global_exclusion_response_data_spec.rb +0 -70
- data/spec/models/identify_payload_properties_spec.rb +0 -106
- data/spec/models/identify_payload_spec.rb +0 -40
- data/spec/models/inline_object3_spec.rb +0 -34
- data/spec/models/inline_object4_spec.rb +0 -34
- data/spec/models/inline_object5_spec.rb +0 -46
- data/spec/models/inline_object_spec.rb +0 -34
- data/spec/models/metric_export_spec.rb +0 -76
- data/spec/models/metric_spec.rb +0 -64
- data/spec/models/metric_timeline_data_spec.rb +0 -82
- data/spec/models/metric_timeline_spec.rb +0 -52
- data/spec/models/person_spec.rb +0 -148
- data/spec/models/privacy_email_spec.rb +0 -34
- data/spec/models/privacy_id_spec.rb +0 -34
- data/spec/models/privacy_phone_spec.rb +0 -34
- data/spec/models/rendered_template_spec.rb +0 -52
- data/spec/models/template_spec.rb +0 -70
- data/spec/models/track_payload_customer_properties_spec.rb +0 -40
- data/spec/models/track_payload_properties_spec.rb +0 -46
- data/spec/models/track_payload_spec.rb +0 -52
- 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
|
@@ -14,7 +14,6 @@ require 'date'
|
|
14
14
|
require 'time'
|
15
15
|
|
16
16
|
module Klaviyo
|
17
|
-
# The profiles that you would like to remove from the list. Example: { \"emails\":[\"george.washington@klaviyo.com\",\"abraham.lincoln@klaviyo.com\"], \"phone_numbers\":[\"+13239169023\"], \"push_tokens\":[\"03df25c845d460bcdad7802d2vf6fc1dfde97283bf75cc993eb6dca835ea2e2r\"] }
|
18
17
|
class InlineObject5
|
19
18
|
attr_accessor :emails
|
20
19
|
|