klaviyo_sdk 1.0.1.20220329 → 1.0.4.20220329

Sign up to get free protection for your applications and to get access to all the features.
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,318 @@
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 CampaignLists
18
+ attr_accessor :object
19
+
20
+ attr_accessor :id
21
+
22
+ attr_accessor :name
23
+
24
+ attr_accessor :list_type
25
+
26
+ attr_accessor :folder
27
+
28
+ attr_accessor :created
29
+
30
+ attr_accessor :updated
31
+
32
+ attr_accessor :person_count
33
+
34
+ class EnumAttributeValidator
35
+ attr_reader :datatype
36
+ attr_reader :allowable_values
37
+
38
+ def initialize(datatype, allowable_values)
39
+ @allowable_values = allowable_values.map do |value|
40
+ case datatype.to_s
41
+ when /Integer/i
42
+ value.to_i
43
+ when /Float/i
44
+ value.to_f
45
+ else
46
+ value
47
+ end
48
+ end
49
+ end
50
+
51
+ def valid?(value)
52
+ !value || allowable_values.include?(value)
53
+ end
54
+ end
55
+
56
+ # Attribute mapping from ruby-style variable name to JSON key.
57
+ def self.attribute_map
58
+ {
59
+ :'object' => :'object',
60
+ :'id' => :'id',
61
+ :'name' => :'name',
62
+ :'list_type' => :'list_type',
63
+ :'folder' => :'folder',
64
+ :'created' => :'created',
65
+ :'updated' => :'updated',
66
+ :'person_count' => :'person_count'
67
+ }
68
+ end
69
+
70
+ # Returns all the JSON keys this model knows about
71
+ def self.acceptable_attributes
72
+ attribute_map.values
73
+ end
74
+
75
+ # Attribute type mapping.
76
+ def self.openapi_types
77
+ {
78
+ :'object' => :'String',
79
+ :'id' => :'String',
80
+ :'name' => :'String',
81
+ :'list_type' => :'String',
82
+ :'folder' => :'String',
83
+ :'created' => :'Time',
84
+ :'updated' => :'Time',
85
+ :'person_count' => :'Integer'
86
+ }
87
+ end
88
+
89
+ # List of attributes with nullable: true
90
+ def self.openapi_nullable
91
+ Set.new([
92
+ :'folder',
93
+ ])
94
+ end
95
+
96
+ # Initializes the object
97
+ # @param [Hash] attributes Model attributes in the form of hash
98
+ def initialize(attributes = {})
99
+ if (!attributes.is_a?(Hash))
100
+ fail ArgumentError, "The input argument (attributes) must be a hash in `Klaviyo::CampaignLists` initialize method"
101
+ end
102
+
103
+ # check to see if the attribute exists and convert string to symbol for hash key
104
+ attributes = attributes.each_with_object({}) { |(k, v), h|
105
+ if (!self.class.attribute_map.key?(k.to_sym))
106
+ fail ArgumentError, "`#{k}` is not a valid attribute in `Klaviyo::CampaignLists`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
107
+ end
108
+ h[k.to_sym] = v
109
+ }
110
+
111
+ if attributes.key?(:'object')
112
+ self.object = attributes[:'object']
113
+ else
114
+ self.object = 'list'
115
+ end
116
+
117
+ if attributes.key?(:'id')
118
+ self.id = attributes[:'id']
119
+ end
120
+
121
+ if attributes.key?(:'name')
122
+ self.name = attributes[:'name']
123
+ end
124
+
125
+ if attributes.key?(:'list_type')
126
+ self.list_type = attributes[:'list_type']
127
+ end
128
+
129
+ if attributes.key?(:'folder')
130
+ self.folder = attributes[:'folder']
131
+ end
132
+
133
+ if attributes.key?(:'created')
134
+ self.created = attributes[:'created']
135
+ end
136
+
137
+ if attributes.key?(:'updated')
138
+ self.updated = attributes[:'updated']
139
+ end
140
+
141
+ if attributes.key?(:'person_count')
142
+ self.person_count = attributes[:'person_count']
143
+ end
144
+ end
145
+
146
+ # Show invalid properties with the reasons. Usually used together with valid?
147
+ # @return Array for valid properties with the reasons
148
+ def list_invalid_properties
149
+ invalid_properties = Array.new
150
+ invalid_properties
151
+ end
152
+
153
+ # Check to see if the all the properties in the model are valid
154
+ # @return true if the model is valid
155
+ def valid?
156
+ list_type_validator = EnumAttributeValidator.new('String', ["list", "segment"])
157
+ return false unless list_type_validator.valid?(@list_type)
158
+ true
159
+ end
160
+
161
+ # Custom attribute writer method checking allowed values (enum).
162
+ # @param [Object] list_type Object to be assigned
163
+ def list_type=(list_type)
164
+ validator = EnumAttributeValidator.new('String', ["list", "segment"])
165
+ unless validator.valid?(list_type)
166
+ fail ArgumentError, "invalid value for \"list_type\", must be one of #{validator.allowable_values}."
167
+ end
168
+ @list_type = list_type
169
+ end
170
+
171
+ # Checks equality by comparing each attribute.
172
+ # @param [Object] Object to be compared
173
+ def ==(o)
174
+ return true if self.equal?(o)
175
+ self.class == o.class &&
176
+ object == o.object &&
177
+ id == o.id &&
178
+ name == o.name &&
179
+ list_type == o.list_type &&
180
+ folder == o.folder &&
181
+ created == o.created &&
182
+ updated == o.updated &&
183
+ person_count == o.person_count
184
+ end
185
+
186
+ # @see the `==` method
187
+ # @param [Object] Object to be compared
188
+ def eql?(o)
189
+ self == o
190
+ end
191
+
192
+ # Calculates hash code according to all attributes.
193
+ # @return [Integer] Hash code
194
+ def hash
195
+ [object, id, name, list_type, folder, created, updated, person_count].hash
196
+ end
197
+
198
+ # Builds the object from hash
199
+ # @param [Hash] attributes Model attributes in the form of hash
200
+ # @return [Object] Returns the model itself
201
+ def self.build_from_hash(attributes)
202
+ new.build_from_hash(attributes)
203
+ end
204
+
205
+ # Builds the object from hash
206
+ # @param [Hash] attributes Model attributes in the form of hash
207
+ # @return [Object] Returns the model itself
208
+ def build_from_hash(attributes)
209
+ return nil unless attributes.is_a?(Hash)
210
+ self.class.openapi_types.each_pair do |key, type|
211
+ if attributes[self.class.attribute_map[key]].nil? && self.class.openapi_nullable.include?(key)
212
+ self.send("#{key}=", nil)
213
+ elsif type =~ /\AArray<(.*)>/i
214
+ # check to ensure the input is an array given that the attribute
215
+ # is documented as an array but the input is not
216
+ if attributes[self.class.attribute_map[key]].is_a?(Array)
217
+ self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
218
+ end
219
+ elsif !attributes[self.class.attribute_map[key]].nil?
220
+ self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
221
+ end
222
+ end
223
+
224
+ self
225
+ end
226
+
227
+ # Deserializes the data based on type
228
+ # @param string type Data type
229
+ # @param string value Value to be deserialized
230
+ # @return [Object] Deserialized data
231
+ def _deserialize(type, value)
232
+ case type.to_sym
233
+ when :Time
234
+ Time.parse(value)
235
+ when :Date
236
+ Date.parse(value)
237
+ when :String
238
+ value.to_s
239
+ when :Integer
240
+ value.to_i
241
+ when :Float
242
+ value.to_f
243
+ when :Boolean
244
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
245
+ true
246
+ else
247
+ false
248
+ end
249
+ when :Object
250
+ # generic object (usually a Hash), return directly
251
+ value
252
+ when /\AArray<(?<inner_type>.+)>\z/
253
+ inner_type = Regexp.last_match[:inner_type]
254
+ value.map { |v| _deserialize(inner_type, v) }
255
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
256
+ k_type = Regexp.last_match[:k_type]
257
+ v_type = Regexp.last_match[:v_type]
258
+ {}.tap do |hash|
259
+ value.each do |k, v|
260
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
261
+ end
262
+ end
263
+ else # model
264
+ # models (e.g. Pet) or oneOf
265
+ klass = Klaviyo.const_get(type)
266
+ klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
267
+ end
268
+ end
269
+
270
+ # Returns the string representation of the object
271
+ # @return [String] String presentation of the object
272
+ def to_s
273
+ to_hash.to_s
274
+ end
275
+
276
+ # to_body is an alias to to_hash (backward compatibility)
277
+ # @return [Hash] Returns the object in the form of hash
278
+ def to_body
279
+ to_hash
280
+ end
281
+
282
+ # Returns the object in the form of hash
283
+ # @return [Hash] Returns the object in the form of hash
284
+ def to_hash
285
+ hash = {}
286
+ self.class.attribute_map.each_pair do |attr, param|
287
+ value = self.send(attr)
288
+ if value.nil?
289
+ is_nullable = self.class.openapi_nullable.include?(attr)
290
+ next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
291
+ end
292
+
293
+ hash[param] = _to_hash(value)
294
+ end
295
+ hash
296
+ end
297
+
298
+ # Outputs non-array value in the form of hash
299
+ # For object, use to_hash. Otherwise, just return the value
300
+ # @param [Object] value Any valid value
301
+ # @return [Hash] Returns the value in the form of hash
302
+ def _to_hash(value)
303
+ if value.is_a?(Array)
304
+ value.compact.map { |v| _to_hash(v) }
305
+ elsif value.is_a?(Hash)
306
+ {}.tap do |hash|
307
+ value.each { |k, v| hash[k] = _to_hash(v) }
308
+ end
309
+ elsif value.respond_to? :to_hash
310
+ value.to_hash
311
+ else
312
+ value
313
+ end
314
+ end
315
+
316
+ end
317
+
318
+ end