klaviyo_sdk 1.0.0.20220329

Sign up to get free protection for your applications and to get access to all the features.
Files changed (45) hide show
  1. checksums.yaml +7 -0
  2. data/CHANGELOG.md +6 -0
  3. data/README.md +1121 -0
  4. data/klaviyo_sdk.gemspec +35 -0
  5. data/lib/klaviyo_sdk/api/campaigns_api.rb +717 -0
  6. data/lib/klaviyo_sdk/api/data_privacy_api.rb +86 -0
  7. data/lib/klaviyo_sdk/api/lists_segments_api.rb +1101 -0
  8. data/lib/klaviyo_sdk/api/metrics_api.rb +343 -0
  9. data/lib/klaviyo_sdk/api/profiles_api.rb +381 -0
  10. data/lib/klaviyo_sdk/api/templates_api.rb +555 -0
  11. data/lib/klaviyo_sdk/api/track_identify_api.rb +288 -0
  12. data/lib/klaviyo_sdk/api_client.rb +389 -0
  13. data/lib/klaviyo_sdk/api_error.rb +57 -0
  14. data/lib/klaviyo_sdk/configuration.rb +278 -0
  15. data/lib/klaviyo_sdk/models/campaign.rb +310 -0
  16. data/lib/klaviyo_sdk/models/check_membership_request.rb +244 -0
  17. data/lib/klaviyo_sdk/models/delete_email.rb +218 -0
  18. data/lib/klaviyo_sdk/models/delete_person.rb +218 -0
  19. data/lib/klaviyo_sdk/models/delete_phone.rb +219 -0
  20. data/lib/klaviyo_sdk/models/deprecated_get_list_response.rb +298 -0
  21. data/lib/klaviyo_sdk/models/deprecated_get_list_response_data.rb +263 -0
  22. data/lib/klaviyo_sdk/models/global_exclusion_response_data.rb +274 -0
  23. data/lib/klaviyo_sdk/models/identify_payload.rb +237 -0
  24. data/lib/klaviyo_sdk/models/identify_payload_properties.rb +327 -0
  25. data/lib/klaviyo_sdk/models/inline_object.rb +220 -0
  26. data/lib/klaviyo_sdk/models/inline_object3.rb +226 -0
  27. data/lib/klaviyo_sdk/models/inline_object4.rb +254 -0
  28. data/lib/klaviyo_sdk/models/inline_object5.rb +288 -0
  29. data/lib/klaviyo_sdk/models/metric.rb +265 -0
  30. data/lib/klaviyo_sdk/models/metric_export.rb +285 -0
  31. data/lib/klaviyo_sdk/models/metric_timeline.rb +271 -0
  32. data/lib/klaviyo_sdk/models/metric_timeline_data.rb +294 -0
  33. data/lib/klaviyo_sdk/models/person.rb +389 -0
  34. data/lib/klaviyo_sdk/models/person.rb.bak +389 -0
  35. data/lib/klaviyo_sdk/models/privacy_email.rb +218 -0
  36. data/lib/klaviyo_sdk/models/privacy_id.rb +218 -0
  37. data/lib/klaviyo_sdk/models/privacy_phone.rb +218 -0
  38. data/lib/klaviyo_sdk/models/rendered_template.rb +247 -0
  39. data/lib/klaviyo_sdk/models/template.rb +272 -0
  40. data/lib/klaviyo_sdk/models/track_payload.rb +261 -0
  41. data/lib/klaviyo_sdk/models/track_payload_customer_properties.rb +227 -0
  42. data/lib/klaviyo_sdk/models/track_payload_properties.rb +237 -0
  43. data/lib/klaviyo_sdk/version.rb +15 -0
  44. data/lib/klaviyo_sdk.rb +124 -0
  45. metadata +120 -0
@@ -0,0 +1,263 @@
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 Client
17
+ class DeprecatedGetListResponseData
18
+ attr_accessor :object
19
+
20
+ attr_accessor :id
21
+
22
+ attr_accessor :type
23
+
24
+ attr_accessor :created
25
+
26
+ attr_accessor :updated
27
+
28
+ attr_accessor :person_count
29
+
30
+ # Attribute mapping from ruby-style variable name to JSON key.
31
+ def self.attribute_map
32
+ {
33
+ :'object' => :'object',
34
+ :'id' => :'id',
35
+ :'type' => :'type',
36
+ :'created' => :'created',
37
+ :'updated' => :'updated',
38
+ :'person_count' => :'person_count'
39
+ }
40
+ end
41
+
42
+ # Returns all the JSON keys this model knows about
43
+ def self.acceptable_attributes
44
+ attribute_map.values
45
+ end
46
+
47
+ # Attribute type mapping.
48
+ def self.openapi_types
49
+ {
50
+ :'object' => :'String',
51
+ :'id' => :'String',
52
+ :'type' => :'String',
53
+ :'created' => :'String',
54
+ :'updated' => :'String',
55
+ :'person_count' => :'Integer'
56
+ }
57
+ end
58
+
59
+ # List of attributes with nullable: true
60
+ def self.openapi_nullable
61
+ Set.new([
62
+ ])
63
+ end
64
+
65
+ # Initializes the object
66
+ # @param [Hash] attributes Model attributes in the form of hash
67
+ def initialize(attributes = {})
68
+ if (!attributes.is_a?(Hash))
69
+ fail ArgumentError, "The input argument (attributes) must be a hash in `Client::DeprecatedGetListResponseData` initialize method"
70
+ end
71
+
72
+ # check to see if the attribute exists and convert string to symbol for hash key
73
+ attributes = attributes.each_with_object({}) { |(k, v), h|
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
76
+ end
77
+ h[k.to_sym] = v
78
+ }
79
+
80
+ if attributes.key?(:'object')
81
+ self.object = attributes[:'object']
82
+ end
83
+
84
+ if attributes.key?(:'id')
85
+ self.id = attributes[:'id']
86
+ end
87
+
88
+ if attributes.key?(:'type')
89
+ self.type = attributes[:'type']
90
+ end
91
+
92
+ if attributes.key?(:'created')
93
+ self.created = attributes[:'created']
94
+ end
95
+
96
+ if attributes.key?(:'updated')
97
+ self.updated = attributes[:'updated']
98
+ end
99
+
100
+ if attributes.key?(:'person_count')
101
+ self.person_count = attributes[:'person_count']
102
+ end
103
+ end
104
+
105
+ # Show invalid properties with the reasons. Usually used together with valid?
106
+ # @return Array for valid properties with the reasons
107
+ def list_invalid_properties
108
+ invalid_properties = Array.new
109
+ invalid_properties
110
+ end
111
+
112
+ # Check to see if the all the properties in the model are valid
113
+ # @return true if the model is valid
114
+ def valid?
115
+ true
116
+ end
117
+
118
+ # Checks equality by comparing each attribute.
119
+ # @param [Object] Object to be compared
120
+ def ==(o)
121
+ return true if self.equal?(o)
122
+ self.class == o.class &&
123
+ object == o.object &&
124
+ id == o.id &&
125
+ type == o.type &&
126
+ created == o.created &&
127
+ updated == o.updated &&
128
+ person_count == o.person_count
129
+ end
130
+
131
+ # @see the `==` method
132
+ # @param [Object] Object to be compared
133
+ def eql?(o)
134
+ self == o
135
+ end
136
+
137
+ # Calculates hash code according to all attributes.
138
+ # @return [Integer] Hash code
139
+ def hash
140
+ [object, id, type, created, updated, person_count].hash
141
+ end
142
+
143
+ # Builds the object from hash
144
+ # @param [Hash] attributes Model attributes in the form of hash
145
+ # @return [Object] Returns the model itself
146
+ def self.build_from_hash(attributes)
147
+ new.build_from_hash(attributes)
148
+ end
149
+
150
+ # Builds the object from hash
151
+ # @param [Hash] attributes Model attributes in the form of hash
152
+ # @return [Object] Returns the model itself
153
+ def build_from_hash(attributes)
154
+ return nil unless attributes.is_a?(Hash)
155
+ self.class.openapi_types.each_pair do |key, type|
156
+ if attributes[self.class.attribute_map[key]].nil? && self.class.openapi_nullable.include?(key)
157
+ self.send("#{key}=", nil)
158
+ elsif type =~ /\AArray<(.*)>/i
159
+ # check to ensure the input is an array given that the attribute
160
+ # is documented as an array but the input is not
161
+ if attributes[self.class.attribute_map[key]].is_a?(Array)
162
+ self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
163
+ end
164
+ elsif !attributes[self.class.attribute_map[key]].nil?
165
+ self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
166
+ end
167
+ end
168
+
169
+ self
170
+ end
171
+
172
+ # Deserializes the data based on type
173
+ # @param string type Data type
174
+ # @param string value Value to be deserialized
175
+ # @return [Object] Deserialized data
176
+ def _deserialize(type, value)
177
+ case type.to_sym
178
+ when :Time
179
+ Time.parse(value)
180
+ when :Date
181
+ Date.parse(value)
182
+ when :String
183
+ value.to_s
184
+ when :Integer
185
+ value.to_i
186
+ when :Float
187
+ value.to_f
188
+ when :Boolean
189
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
190
+ true
191
+ else
192
+ false
193
+ end
194
+ when :Object
195
+ # generic object (usually a Hash), return directly
196
+ value
197
+ when /\AArray<(?<inner_type>.+)>\z/
198
+ inner_type = Regexp.last_match[:inner_type]
199
+ value.map { |v| _deserialize(inner_type, v) }
200
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
201
+ k_type = Regexp.last_match[:k_type]
202
+ v_type = Regexp.last_match[:v_type]
203
+ {}.tap do |hash|
204
+ value.each do |k, v|
205
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
206
+ end
207
+ end
208
+ else # model
209
+ # models (e.g. Pet) or oneOf
210
+ klass = Client.const_get(type)
211
+ klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
212
+ end
213
+ end
214
+
215
+ # Returns the string representation of the object
216
+ # @return [String] String presentation of the object
217
+ def to_s
218
+ to_hash.to_s
219
+ end
220
+
221
+ # to_body is an alias to to_hash (backward compatibility)
222
+ # @return [Hash] Returns the object in the form of hash
223
+ def to_body
224
+ to_hash
225
+ end
226
+
227
+ # Returns the object in the form of hash
228
+ # @return [Hash] Returns the object in the form of hash
229
+ def to_hash
230
+ hash = {}
231
+ self.class.attribute_map.each_pair do |attr, param|
232
+ value = self.send(attr)
233
+ if value.nil?
234
+ is_nullable = self.class.openapi_nullable.include?(attr)
235
+ next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
236
+ end
237
+
238
+ hash[param] = _to_hash(value)
239
+ end
240
+ hash
241
+ end
242
+
243
+ # Outputs non-array value in the form of hash
244
+ # For object, use to_hash. Otherwise, just return the value
245
+ # @param [Object] value Any valid value
246
+ # @return [Hash] Returns the value in the form of hash
247
+ def _to_hash(value)
248
+ if value.is_a?(Array)
249
+ value.compact.map { |v| _to_hash(v) }
250
+ elsif value.is_a?(Hash)
251
+ {}.tap do |hash|
252
+ value.each { |k, v| hash[k] = _to_hash(v) }
253
+ end
254
+ elsif value.respond_to? :to_hash
255
+ value.to_hash
256
+ else
257
+ value
258
+ end
259
+ end
260
+
261
+ end
262
+
263
+ end
@@ -0,0 +1,274 @@
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 Client
17
+ class GlobalExclusionResponseData
18
+ attr_accessor :object
19
+
20
+ attr_accessor :data
21
+
22
+ attr_accessor :page
23
+
24
+ attr_accessor :start
25
+
26
+ attr_accessor :_end
27
+
28
+ attr_accessor :total
29
+
30
+ attr_accessor :page_size
31
+
32
+ # Attribute mapping from ruby-style variable name to JSON key.
33
+ def self.attribute_map
34
+ {
35
+ :'object' => :'object',
36
+ :'data' => :'data',
37
+ :'page' => :'page',
38
+ :'start' => :'start',
39
+ :'_end' => :'end',
40
+ :'total' => :'total',
41
+ :'page_size' => :'page_size'
42
+ }
43
+ end
44
+
45
+ # Returns all the JSON keys this model knows about
46
+ def self.acceptable_attributes
47
+ attribute_map.values
48
+ end
49
+
50
+ # Attribute type mapping.
51
+ def self.openapi_types
52
+ {
53
+ :'object' => :'String',
54
+ :'data' => :'Array<Hash<String, Object>>',
55
+ :'page' => :'Integer',
56
+ :'start' => :'Integer',
57
+ :'_end' => :'Integer',
58
+ :'total' => :'Integer',
59
+ :'page_size' => :'Integer'
60
+ }
61
+ end
62
+
63
+ # List of attributes with nullable: true
64
+ def self.openapi_nullable
65
+ Set.new([
66
+ ])
67
+ end
68
+
69
+ # Initializes the object
70
+ # @param [Hash] attributes Model attributes in the form of hash
71
+ def initialize(attributes = {})
72
+ if (!attributes.is_a?(Hash))
73
+ fail ArgumentError, "The input argument (attributes) must be a hash in `Client::GlobalExclusionResponseData` initialize method"
74
+ end
75
+
76
+ # check to see if the attribute exists and convert string to symbol for hash key
77
+ attributes = attributes.each_with_object({}) { |(k, v), h|
78
+ if (!self.class.attribute_map.key?(k.to_sym))
79
+ fail ArgumentError, "`#{k}` is not a valid attribute in `Client::GlobalExclusionResponseData`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
80
+ end
81
+ h[k.to_sym] = v
82
+ }
83
+
84
+ if attributes.key?(:'object')
85
+ self.object = attributes[:'object']
86
+ end
87
+
88
+ if attributes.key?(:'data')
89
+ if (value = attributes[:'data']).is_a?(Array)
90
+ self.data = value
91
+ end
92
+ end
93
+
94
+ if attributes.key?(:'page')
95
+ self.page = attributes[:'page']
96
+ end
97
+
98
+ if attributes.key?(:'start')
99
+ self.start = attributes[:'start']
100
+ end
101
+
102
+ if attributes.key?(:'_end')
103
+ self._end = attributes[:'_end']
104
+ end
105
+
106
+ if attributes.key?(:'total')
107
+ self.total = attributes[:'total']
108
+ end
109
+
110
+ if attributes.key?(:'page_size')
111
+ self.page_size = attributes[:'page_size']
112
+ end
113
+ end
114
+
115
+ # Show invalid properties with the reasons. Usually used together with valid?
116
+ # @return Array for valid properties with the reasons
117
+ def list_invalid_properties
118
+ invalid_properties = Array.new
119
+ invalid_properties
120
+ end
121
+
122
+ # Check to see if the all the properties in the model are valid
123
+ # @return true if the model is valid
124
+ def valid?
125
+ true
126
+ end
127
+
128
+ # Checks equality by comparing each attribute.
129
+ # @param [Object] Object to be compared
130
+ def ==(o)
131
+ return true if self.equal?(o)
132
+ self.class == o.class &&
133
+ object == o.object &&
134
+ data == o.data &&
135
+ page == o.page &&
136
+ start == o.start &&
137
+ _end == o._end &&
138
+ total == o.total &&
139
+ page_size == o.page_size
140
+ end
141
+
142
+ # @see the `==` method
143
+ # @param [Object] Object to be compared
144
+ def eql?(o)
145
+ self == o
146
+ end
147
+
148
+ # Calculates hash code according to all attributes.
149
+ # @return [Integer] Hash code
150
+ def hash
151
+ [object, data, page, start, _end, total, page_size].hash
152
+ end
153
+
154
+ # Builds the object from hash
155
+ # @param [Hash] attributes Model attributes in the form of hash
156
+ # @return [Object] Returns the model itself
157
+ def self.build_from_hash(attributes)
158
+ new.build_from_hash(attributes)
159
+ end
160
+
161
+ # Builds the object from hash
162
+ # @param [Hash] attributes Model attributes in the form of hash
163
+ # @return [Object] Returns the model itself
164
+ def build_from_hash(attributes)
165
+ return nil unless attributes.is_a?(Hash)
166
+ self.class.openapi_types.each_pair do |key, type|
167
+ if attributes[self.class.attribute_map[key]].nil? && self.class.openapi_nullable.include?(key)
168
+ self.send("#{key}=", nil)
169
+ elsif type =~ /\AArray<(.*)>/i
170
+ # check to ensure the input is an array given that the attribute
171
+ # is documented as an array but the input is not
172
+ if attributes[self.class.attribute_map[key]].is_a?(Array)
173
+ self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
174
+ end
175
+ elsif !attributes[self.class.attribute_map[key]].nil?
176
+ self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
177
+ end
178
+ end
179
+
180
+ self
181
+ end
182
+
183
+ # Deserializes the data based on type
184
+ # @param string type Data type
185
+ # @param string value Value to be deserialized
186
+ # @return [Object] Deserialized data
187
+ def _deserialize(type, value)
188
+ case type.to_sym
189
+ when :Time
190
+ Time.parse(value)
191
+ when :Date
192
+ Date.parse(value)
193
+ when :String
194
+ value.to_s
195
+ when :Integer
196
+ value.to_i
197
+ when :Float
198
+ value.to_f
199
+ when :Boolean
200
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
201
+ true
202
+ else
203
+ false
204
+ end
205
+ when :Object
206
+ # generic object (usually a Hash), return directly
207
+ value
208
+ when /\AArray<(?<inner_type>.+)>\z/
209
+ inner_type = Regexp.last_match[:inner_type]
210
+ value.map { |v| _deserialize(inner_type, v) }
211
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
212
+ k_type = Regexp.last_match[:k_type]
213
+ v_type = Regexp.last_match[:v_type]
214
+ {}.tap do |hash|
215
+ value.each do |k, v|
216
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
217
+ end
218
+ end
219
+ else # model
220
+ # models (e.g. Pet) or oneOf
221
+ klass = Client.const_get(type)
222
+ klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
223
+ end
224
+ end
225
+
226
+ # Returns the string representation of the object
227
+ # @return [String] String presentation of the object
228
+ def to_s
229
+ to_hash.to_s
230
+ end
231
+
232
+ # to_body is an alias to to_hash (backward compatibility)
233
+ # @return [Hash] Returns the object in the form of hash
234
+ def to_body
235
+ to_hash
236
+ end
237
+
238
+ # Returns the object in the form of hash
239
+ # @return [Hash] Returns the object in the form of hash
240
+ def to_hash
241
+ hash = {}
242
+ self.class.attribute_map.each_pair do |attr, param|
243
+ value = self.send(attr)
244
+ if value.nil?
245
+ is_nullable = self.class.openapi_nullable.include?(attr)
246
+ next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
247
+ end
248
+
249
+ hash[param] = _to_hash(value)
250
+ end
251
+ hash
252
+ end
253
+
254
+ # Outputs non-array value in the form of hash
255
+ # For object, use to_hash. Otherwise, just return the value
256
+ # @param [Object] value Any valid value
257
+ # @return [Hash] Returns the value in the form of hash
258
+ def _to_hash(value)
259
+ if value.is_a?(Array)
260
+ value.compact.map { |v| _to_hash(v) }
261
+ elsif value.is_a?(Hash)
262
+ {}.tap do |hash|
263
+ value.each { |k, v| hash[k] = _to_hash(v) }
264
+ end
265
+ elsif value.respond_to? :to_hash
266
+ value.to_hash
267
+ else
268
+ value
269
+ end
270
+ end
271
+
272
+ end
273
+
274
+ end