klaviyo-api-sdk 13.0.1 → 14.0.0

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 (82) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +12 -0
  3. data/README.md +434 -286
  4. data/klaviyo-api-sdk.gemspec +1 -1
  5. data/lib/klaviyo-api-sdk/api/accounts_api.rb +6 -6
  6. data/lib/klaviyo-api-sdk/api/campaigns_api.rb +82 -82
  7. data/lib/klaviyo-api-sdk/api/catalogs_api.rb +235 -235
  8. data/lib/klaviyo-api-sdk/api/coupons_api.rb +63 -63
  9. data/lib/klaviyo-api-sdk/api/custom_objects_api.rb +384 -0
  10. data/lib/klaviyo-api-sdk/api/data_privacy_api.rb +1 -1
  11. data/lib/klaviyo-api-sdk/api/events_api.rb +34 -34
  12. data/lib/klaviyo-api-sdk/api/flows_api.rb +93 -93
  13. data/lib/klaviyo-api-sdk/api/forms_api.rb +40 -40
  14. data/lib/klaviyo-api-sdk/api/images_api.rb +15 -15
  15. data/lib/klaviyo-api-sdk/api/lists_api.rb +59 -59
  16. data/lib/klaviyo-api-sdk/api/metrics_api.rb +643 -59
  17. data/lib/klaviyo-api-sdk/api/profiles_api.rb +128 -128
  18. data/lib/klaviyo-api-sdk/api/reporting_api.rb +13 -13
  19. data/lib/klaviyo-api-sdk/api/reviews_api.rb +21 -21
  20. data/lib/klaviyo-api-sdk/api/segments_api.rb +53 -53
  21. data/lib/klaviyo-api-sdk/api/tags_api.rb +58 -58
  22. data/lib/klaviyo-api-sdk/api/templates_api.rb +36 -36
  23. data/lib/klaviyo-api-sdk/api/tracking_settings_api.rb +15 -15
  24. data/lib/klaviyo-api-sdk/api/web_feeds_api.rb +15 -15
  25. data/lib/klaviyo-api-sdk/api/webhooks_api.rb +15 -15
  26. data/lib/klaviyo-api-sdk/api_client.rb +1 -1
  27. data/lib/klaviyo-api-sdk/models/base_event_create_query_bulk_entry_resource_object_attributes.rb +1 -1
  28. data/lib/klaviyo-api-sdk/models/button_block.rb +247 -0
  29. data/lib/klaviyo-api-sdk/models/{custom_object_property_enum.rb → button_enum.rb} +4 -4
  30. data/lib/klaviyo-api-sdk/models/campaign_values_request_dto_resource_object_attributes_timeframe.rb +1 -1
  31. data/lib/klaviyo-api-sdk/models/condition_group_conditions_inner.rb +3 -0
  32. data/lib/klaviyo-api-sdk/models/conditional_branch_action_data_profile_filter_condition_groups_inner_conditions_inner.rb +1 -0
  33. data/lib/klaviyo-api-sdk/models/data_source_create_query.rb +223 -0
  34. data/lib/klaviyo-api-sdk/models/data_source_create_query_resource_object.rb +237 -0
  35. data/lib/klaviyo-api-sdk/models/data_source_create_query_resource_object_attributes.rb +284 -0
  36. data/lib/klaviyo-api-sdk/models/data_source_enum.rb +35 -0
  37. data/lib/klaviyo-api-sdk/models/data_source_record_bulk_create_job_create_query.rb +223 -0
  38. data/lib/klaviyo-api-sdk/models/data_source_record_bulk_create_job_create_query_resource_object.rb +246 -0
  39. data/lib/klaviyo-api-sdk/models/data_source_record_bulk_create_job_create_query_resource_object_attributes.rb +219 -0
  40. data/lib/klaviyo-api-sdk/models/data_source_record_bulk_create_job_create_query_resource_object_relationships.rb +218 -0
  41. data/lib/klaviyo-api-sdk/models/data_source_record_bulk_create_job_create_query_resource_object_relationships_data_source.rb +218 -0
  42. data/lib/klaviyo-api-sdk/models/data_source_record_bulk_create_job_enum.rb +35 -0
  43. data/lib/klaviyo-api-sdk/models/data_source_record_enum.rb +35 -0
  44. data/lib/klaviyo-api-sdk/models/data_source_record_resource_object.rb +237 -0
  45. data/lib/klaviyo-api-sdk/models/data_source_record_resource_object_attributes.rb +223 -0
  46. data/lib/klaviyo-api-sdk/models/drop_shadow_block.rb +247 -0
  47. data/lib/klaviyo-api-sdk/models/drop_shadow_enum.rb +35 -0
  48. data/lib/klaviyo-api-sdk/models/{trigger_branch_action_data_trigger_filter.rb → dsr_bulk_create_attrs_data_source_records.rb} +15 -14
  49. data/lib/klaviyo-api-sdk/models/dsr_bulk_create_rels_data_source_data.rb +238 -0
  50. data/lib/klaviyo-api-sdk/models/event_create_query_v2_resource_object_attributes.rb +1 -1
  51. data/lib/klaviyo-api-sdk/models/flow_definition_profile_filter_condition_groups_inner_conditions_inner.rb +1 -0
  52. data/lib/klaviyo-api-sdk/models/flow_email_additional_filters_condition_groups_inner_conditions_inner.rb +1 -0
  53. data/lib/klaviyo-api-sdk/models/flow_push_notification_additional_filters_condition_groups_inner_conditions_inner.rb +1 -0
  54. data/lib/klaviyo-api-sdk/models/flow_sms_additional_filters_condition_groups_inner_conditions_inner.rb +1 -0
  55. data/lib/klaviyo-api-sdk/models/horizontal_rule_block.rb +247 -0
  56. data/lib/klaviyo-api-sdk/models/horizontal_rule_enum.rb +35 -0
  57. data/lib/klaviyo-api-sdk/models/image_block.rb +247 -0
  58. data/lib/klaviyo-api-sdk/models/mapped_metric_enum.rb +35 -0
  59. data/lib/klaviyo-api-sdk/models/mapped_metric_partial_update_query.rb +223 -0
  60. data/lib/klaviyo-api-sdk/models/mapped_metric_partial_update_query_resource_object.rb +281 -0
  61. data/lib/klaviyo-api-sdk/models/mapped_metric_partial_update_query_resource_object_relationships.rb +227 -0
  62. data/lib/klaviyo-api-sdk/models/{trigger_branch_action_data_trigger_filter_condition_groups_inner.rb → mapped_metric_partial_update_query_resource_object_relationships_custom_metric.rb} +10 -17
  63. data/lib/klaviyo-api-sdk/models/mapped_metric_partial_update_query_resource_object_relationships_custom_metric_data.rb +238 -0
  64. data/lib/klaviyo-api-sdk/models/mapped_metric_partial_update_query_resource_object_relationships_metric.rb +218 -0
  65. data/lib/klaviyo-api-sdk/models/mapped_metric_partial_update_query_resource_object_relationships_metric_data.rb +238 -0
  66. data/lib/klaviyo-api-sdk/models/priority_enum.rb +35 -0
  67. data/lib/klaviyo-api-sdk/models/profile_predictive_analytics_channel_affinity_priority_condition.rb +327 -0
  68. data/lib/klaviyo-api-sdk/models/{custom_object_property_condition.rb → profile_predictive_analytics_channel_affinity_priority_filter.rb} +23 -37
  69. data/lib/klaviyo-api-sdk/models/profile_predictive_analytics_channel_affinity_rank_condition.rb +327 -0
  70. data/lib/klaviyo-api-sdk/models/profile_predictive_analytics_channel_affinity_rank_filter.rb +286 -0
  71. data/lib/klaviyo-api-sdk/models/profile_predictive_analytics_date_condition.rb +286 -0
  72. data/lib/klaviyo-api-sdk/models/rank_enum.rb +35 -0
  73. data/lib/klaviyo-api-sdk/models/segment_values_request_dto_resource_object_attributes_timeframe.rb +1 -1
  74. data/lib/klaviyo-api-sdk/models/spacer_block.rb +247 -0
  75. data/lib/klaviyo-api-sdk/models/spacer_enum.rb +35 -0
  76. data/lib/klaviyo-api-sdk/models/trigger_branch_action_data.rb +6 -2
  77. data/lib/klaviyo-api-sdk/models/universal_content_create_query_resource_object_attributes_definition.rb +5 -0
  78. data/lib/klaviyo-api-sdk/models/universal_content_partial_update_query_resource_object_attributes_definition.rb +5 -0
  79. data/lib/klaviyo-api-sdk.rb +40 -5
  80. data/lib/klaviyo-api-sdk.rb.bak +974 -0
  81. metadata +43 -7
  82. data/lib/klaviyo-api-sdk/models/trigger_branch_action_data_trigger_filter_condition_groups_inner_conditions_inner.rb +0 -106
@@ -0,0 +1,281 @@
1
+ =begin
2
+ #Klaviyo API
3
+
4
+ #The Klaviyo REST API. Please visit https://developers.klaviyo.com for more details.
5
+
6
+ Contact: developers@klaviyo.com
7
+ Generated by: https://openapi-generator.tech
8
+ OpenAPI Generator version: 6.2.1
9
+
10
+ =end
11
+
12
+ require 'date'
13
+ require 'time'
14
+
15
+ module KlaviyoAPI
16
+ class MappedMetricPartialUpdateQueryResourceObject
17
+ attr_accessor :type
18
+
19
+ # The type of mapping.
20
+ attr_accessor :id
21
+
22
+ attr_accessor :relationships
23
+
24
+ class EnumAttributeValidator
25
+ attr_reader :datatype
26
+ attr_reader :allowable_values
27
+
28
+ def initialize(datatype, allowable_values)
29
+ @allowable_values = allowable_values.map do |value|
30
+ case datatype.to_s
31
+ when /Integer/i
32
+ value.to_i
33
+ when /Float/i
34
+ value.to_f
35
+ else
36
+ value
37
+ end
38
+ end
39
+ end
40
+
41
+ def valid?(value)
42
+ !value || allowable_values.include?(value)
43
+ end
44
+ end
45
+
46
+ # Attribute mapping from ruby-style variable name to JSON key.
47
+ def self.attribute_map
48
+ {
49
+ :'type' => :'type',
50
+ :'id' => :'id',
51
+ :'relationships' => :'relationships'
52
+ }
53
+ end
54
+
55
+ # Returns all the JSON keys this model knows about
56
+ def self.acceptable_attributes
57
+ attribute_map.values
58
+ end
59
+
60
+ # Attribute type mapping.
61
+ def self.openapi_types
62
+ {
63
+ :'type' => :'MappedMetricEnum',
64
+ :'id' => :'String',
65
+ :'relationships' => :'MappedMetricPartialUpdateQueryResourceObjectRelationships'
66
+ }
67
+ end
68
+
69
+ # List of attributes with nullable: true
70
+ def self.openapi_nullable
71
+ Set.new([
72
+ ])
73
+ end
74
+
75
+ # Initializes the object
76
+ # @param [Hash] attributes Model attributes in the form of hash
77
+ def initialize(attributes = {})
78
+ if (!attributes.is_a?(Hash))
79
+ fail ArgumentError, "The input argument (attributes) must be a hash in `KlaviyoAPI::MappedMetricPartialUpdateQueryResourceObject` initialize method"
80
+ end
81
+
82
+ # check to see if the attribute exists and convert string to symbol for hash key
83
+ attributes = attributes.each_with_object({}) { |(k, v), h|
84
+ if (!self.class.attribute_map.key?(k.to_sym))
85
+ fail ArgumentError, "`#{k}` is not a valid attribute in `KlaviyoAPI::MappedMetricPartialUpdateQueryResourceObject`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
86
+ end
87
+ h[k.to_sym] = v
88
+ }
89
+
90
+ if attributes.key?(:'type')
91
+ self.type = attributes[:'type']
92
+ end
93
+
94
+ if attributes.key?(:'id')
95
+ self.id = attributes[:'id']
96
+ end
97
+
98
+ if attributes.key?(:'relationships')
99
+ self.relationships = attributes[:'relationships']
100
+ end
101
+ end
102
+
103
+ # Show invalid properties with the reasons. Usually used together with valid?
104
+ # @return Array for valid properties with the reasons
105
+ def list_invalid_properties
106
+ invalid_properties = Array.new
107
+ if @type.nil?
108
+ invalid_properties.push('invalid value for "type", type cannot be nil.')
109
+ end
110
+
111
+ if @id.nil?
112
+ invalid_properties.push('invalid value for "id", id cannot be nil.')
113
+ end
114
+
115
+ invalid_properties
116
+ end
117
+
118
+ # Check to see if the all the properties in the model are valid
119
+ # @return true if the model is valid
120
+ def valid?
121
+ return false if @type.nil?
122
+ return false if @id.nil?
123
+ id_validator = EnumAttributeValidator.new('String', ["added_to_cart", "cancelled_sales", "ordered_product", "refunded_sales", "revenue", "started_checkout", "viewed_product"])
124
+ return false unless id_validator.valid?(@id)
125
+ true
126
+ end
127
+
128
+ # Custom attribute writer method checking allowed values (enum).
129
+ # @param [Object] id Object to be assigned
130
+ def id=(id)
131
+ validator = EnumAttributeValidator.new('String', ["added_to_cart", "cancelled_sales", "ordered_product", "refunded_sales", "revenue", "started_checkout", "viewed_product"])
132
+ unless validator.valid?(id)
133
+ fail ArgumentError, "invalid value for \"id\", must be one of #{validator.allowable_values}."
134
+ end
135
+ @id = id
136
+ end
137
+
138
+ # Checks equality by comparing each attribute.
139
+ # @param [Object] Object to be compared
140
+ def ==(o)
141
+ return true if self.equal?(o)
142
+ self.class == o.class &&
143
+ type == o.type &&
144
+ id == o.id &&
145
+ relationships == o.relationships
146
+ end
147
+
148
+ # @see the `==` method
149
+ # @param [Object] Object to be compared
150
+ def eql?(o)
151
+ self == o
152
+ end
153
+
154
+ # Calculates hash code according to all attributes.
155
+ # @return [Integer] Hash code
156
+ def hash
157
+ [type, id, relationships].hash
158
+ end
159
+
160
+ # Builds the object from hash
161
+ # @param [Hash] attributes Model attributes in the form of hash
162
+ # @return [Object] Returns the model itself
163
+ def self.build_from_hash(attributes)
164
+ new.build_from_hash(attributes)
165
+ end
166
+
167
+ # Builds the object from hash
168
+ # @param [Hash] attributes Model attributes in the form of hash
169
+ # @return [Object] Returns the model itself
170
+ def build_from_hash(attributes)
171
+ return nil unless attributes.is_a?(Hash)
172
+ attributes = attributes.transform_keys(&:to_sym)
173
+ self.class.openapi_types.each_pair do |key, type|
174
+ if attributes[self.class.attribute_map[key]].nil? && self.class.openapi_nullable.include?(key)
175
+ self.send("#{key}=", nil)
176
+ elsif type =~ /\AArray<(.*)>/i
177
+ # check to ensure the input is an array given that the attribute
178
+ # is documented as an array but the input is not
179
+ if attributes[self.class.attribute_map[key]].is_a?(Array)
180
+ self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
181
+ end
182
+ elsif !attributes[self.class.attribute_map[key]].nil?
183
+ self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
184
+ end
185
+ end
186
+
187
+ self
188
+ end
189
+
190
+ # Deserializes the data based on type
191
+ # @param string type Data type
192
+ # @param string value Value to be deserialized
193
+ # @return [Object] Deserialized data
194
+ def _deserialize(type, value)
195
+ case type.to_sym
196
+ when :Time
197
+ Time.parse(value)
198
+ when :Date
199
+ Date.parse(value)
200
+ when :String
201
+ value.to_s
202
+ when :Integer
203
+ value.to_i
204
+ when :Float
205
+ value.to_f
206
+ when :Boolean
207
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
208
+ true
209
+ else
210
+ false
211
+ end
212
+ when :Object
213
+ # generic object (usually a Hash), return directly
214
+ value
215
+ when /\AArray<(?<inner_type>.+)>\z/
216
+ inner_type = Regexp.last_match[:inner_type]
217
+ value.map { |v| _deserialize(inner_type, v) }
218
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
219
+ k_type = Regexp.last_match[:k_type]
220
+ v_type = Regexp.last_match[:v_type]
221
+ {}.tap do |hash|
222
+ value.each do |k, v|
223
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
224
+ end
225
+ end
226
+ else # model
227
+ # models (e.g. Pet) or oneOf
228
+ klass = KlaviyoAPI.const_get(type)
229
+ klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
230
+ end
231
+ end
232
+
233
+ # Returns the string representation of the object
234
+ # @return [String] String presentation of the object
235
+ def to_s
236
+ to_hash.to_s
237
+ end
238
+
239
+ # to_body is an alias to to_hash (backward compatibility)
240
+ # @return [Hash] Returns the object in the form of hash
241
+ def to_body
242
+ to_hash
243
+ end
244
+
245
+ # Returns the object in the form of hash
246
+ # @return [Hash] Returns the object in the form of hash
247
+ def to_hash
248
+ hash = {}
249
+ self.class.attribute_map.each_pair do |attr, param|
250
+ value = self.send(attr)
251
+ if value.nil?
252
+ is_nullable = self.class.openapi_nullable.include?(attr)
253
+ next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
254
+ end
255
+
256
+ hash[param] = _to_hash(value)
257
+ end
258
+ hash
259
+ end
260
+
261
+ # Outputs non-array value in the form of hash
262
+ # For object, use to_hash. Otherwise, just return the value
263
+ # @param [Object] value Any valid value
264
+ # @return [Hash] Returns the value in the form of hash
265
+ def _to_hash(value)
266
+ if value.is_a?(Array)
267
+ value.compact.map { |v| _to_hash(v) }
268
+ elsif value.is_a?(Hash)
269
+ {}.tap do |hash|
270
+ value.each { |k, v| hash[k] = _to_hash(v) }
271
+ end
272
+ elsif value.respond_to? :to_hash
273
+ value.to_hash
274
+ else
275
+ value
276
+ end
277
+ end
278
+
279
+ end
280
+
281
+ end
@@ -0,0 +1,227 @@
1
+ =begin
2
+ #Klaviyo API
3
+
4
+ #The Klaviyo REST API. Please visit https://developers.klaviyo.com for more details.
5
+
6
+ Contact: developers@klaviyo.com
7
+ Generated by: https://openapi-generator.tech
8
+ OpenAPI Generator version: 6.2.1
9
+
10
+ =end
11
+
12
+ require 'date'
13
+ require 'time'
14
+
15
+ module KlaviyoAPI
16
+ class MappedMetricPartialUpdateQueryResourceObjectRelationships
17
+ attr_accessor :metric
18
+
19
+ attr_accessor :custom_metric
20
+
21
+ # Attribute mapping from ruby-style variable name to JSON key.
22
+ def self.attribute_map
23
+ {
24
+ :'metric' => :'metric',
25
+ :'custom_metric' => :'custom-metric'
26
+ }
27
+ end
28
+
29
+ # Returns all the JSON keys this model knows about
30
+ def self.acceptable_attributes
31
+ attribute_map.values
32
+ end
33
+
34
+ # Attribute type mapping.
35
+ def self.openapi_types
36
+ {
37
+ :'metric' => :'MappedMetricPartialUpdateQueryResourceObjectRelationshipsMetric',
38
+ :'custom_metric' => :'MappedMetricPartialUpdateQueryResourceObjectRelationshipsCustomMetric'
39
+ }
40
+ end
41
+
42
+ # List of attributes with nullable: true
43
+ def self.openapi_nullable
44
+ Set.new([
45
+ ])
46
+ end
47
+
48
+ # Initializes the object
49
+ # @param [Hash] attributes Model attributes in the form of hash
50
+ def initialize(attributes = {})
51
+ if (!attributes.is_a?(Hash))
52
+ fail ArgumentError, "The input argument (attributes) must be a hash in `KlaviyoAPI::MappedMetricPartialUpdateQueryResourceObjectRelationships` initialize method"
53
+ end
54
+
55
+ # check to see if the attribute exists and convert string to symbol for hash key
56
+ attributes = attributes.each_with_object({}) { |(k, v), h|
57
+ if (!self.class.attribute_map.key?(k.to_sym))
58
+ fail ArgumentError, "`#{k}` is not a valid attribute in `KlaviyoAPI::MappedMetricPartialUpdateQueryResourceObjectRelationships`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
59
+ end
60
+ h[k.to_sym] = v
61
+ }
62
+
63
+ if attributes.key?(:'metric')
64
+ self.metric = attributes[:'metric']
65
+ end
66
+
67
+ if attributes.key?(:'custom_metric')
68
+ self.custom_metric = attributes[:'custom_metric']
69
+ end
70
+ end
71
+
72
+ # Show invalid properties with the reasons. Usually used together with valid?
73
+ # @return Array for valid properties with the reasons
74
+ def list_invalid_properties
75
+ invalid_properties = Array.new
76
+ invalid_properties
77
+ end
78
+
79
+ # Check to see if the all the properties in the model are valid
80
+ # @return true if the model is valid
81
+ def valid?
82
+ true
83
+ end
84
+
85
+ # Checks equality by comparing each attribute.
86
+ # @param [Object] Object to be compared
87
+ def ==(o)
88
+ return true if self.equal?(o)
89
+ self.class == o.class &&
90
+ metric == o.metric &&
91
+ custom_metric == o.custom_metric
92
+ end
93
+
94
+ # @see the `==` method
95
+ # @param [Object] Object to be compared
96
+ def eql?(o)
97
+ self == o
98
+ end
99
+
100
+ # Calculates hash code according to all attributes.
101
+ # @return [Integer] Hash code
102
+ def hash
103
+ [metric, custom_metric].hash
104
+ end
105
+
106
+ # Builds the object from hash
107
+ # @param [Hash] attributes Model attributes in the form of hash
108
+ # @return [Object] Returns the model itself
109
+ def self.build_from_hash(attributes)
110
+ new.build_from_hash(attributes)
111
+ end
112
+
113
+ # Builds the object from hash
114
+ # @param [Hash] attributes Model attributes in the form of hash
115
+ # @return [Object] Returns the model itself
116
+ def build_from_hash(attributes)
117
+ return nil unless attributes.is_a?(Hash)
118
+ attributes = attributes.transform_keys(&:to_sym)
119
+ self.class.openapi_types.each_pair do |key, type|
120
+ if attributes[self.class.attribute_map[key]].nil? && self.class.openapi_nullable.include?(key)
121
+ self.send("#{key}=", nil)
122
+ elsif type =~ /\AArray<(.*)>/i
123
+ # check to ensure the input is an array given that the attribute
124
+ # is documented as an array but the input is not
125
+ if attributes[self.class.attribute_map[key]].is_a?(Array)
126
+ self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
127
+ end
128
+ elsif !attributes[self.class.attribute_map[key]].nil?
129
+ self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
130
+ end
131
+ end
132
+
133
+ self
134
+ end
135
+
136
+ # Deserializes the data based on type
137
+ # @param string type Data type
138
+ # @param string value Value to be deserialized
139
+ # @return [Object] Deserialized data
140
+ def _deserialize(type, value)
141
+ case type.to_sym
142
+ when :Time
143
+ Time.parse(value)
144
+ when :Date
145
+ Date.parse(value)
146
+ when :String
147
+ value.to_s
148
+ when :Integer
149
+ value.to_i
150
+ when :Float
151
+ value.to_f
152
+ when :Boolean
153
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
154
+ true
155
+ else
156
+ false
157
+ end
158
+ when :Object
159
+ # generic object (usually a Hash), return directly
160
+ value
161
+ when /\AArray<(?<inner_type>.+)>\z/
162
+ inner_type = Regexp.last_match[:inner_type]
163
+ value.map { |v| _deserialize(inner_type, v) }
164
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
165
+ k_type = Regexp.last_match[:k_type]
166
+ v_type = Regexp.last_match[:v_type]
167
+ {}.tap do |hash|
168
+ value.each do |k, v|
169
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
170
+ end
171
+ end
172
+ else # model
173
+ # models (e.g. Pet) or oneOf
174
+ klass = KlaviyoAPI.const_get(type)
175
+ klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
176
+ end
177
+ end
178
+
179
+ # Returns the string representation of the object
180
+ # @return [String] String presentation of the object
181
+ def to_s
182
+ to_hash.to_s
183
+ end
184
+
185
+ # to_body is an alias to to_hash (backward compatibility)
186
+ # @return [Hash] Returns the object in the form of hash
187
+ def to_body
188
+ to_hash
189
+ end
190
+
191
+ # Returns the object in the form of hash
192
+ # @return [Hash] Returns the object in the form of hash
193
+ def to_hash
194
+ hash = {}
195
+ self.class.attribute_map.each_pair do |attr, param|
196
+ value = self.send(attr)
197
+ if value.nil?
198
+ is_nullable = self.class.openapi_nullable.include?(attr)
199
+ next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
200
+ end
201
+
202
+ hash[param] = _to_hash(value)
203
+ end
204
+ hash
205
+ end
206
+
207
+ # Outputs non-array value in the form of hash
208
+ # For object, use to_hash. Otherwise, just return the value
209
+ # @param [Object] value Any valid value
210
+ # @return [Hash] Returns the value in the form of hash
211
+ def _to_hash(value)
212
+ if value.is_a?(Array)
213
+ value.compact.map { |v| _to_hash(v) }
214
+ elsif value.is_a?(Hash)
215
+ {}.tap do |hash|
216
+ value.each { |k, v| hash[k] = _to_hash(v) }
217
+ end
218
+ elsif value.respond_to? :to_hash
219
+ value.to_hash
220
+ else
221
+ value
222
+ end
223
+ end
224
+
225
+ end
226
+
227
+ end
@@ -13,13 +13,13 @@ require 'date'
13
13
  require 'time'
14
14
 
15
15
  module KlaviyoAPI
16
- class TriggerBranchActionDataTriggerFilterConditionGroupsInner
17
- attr_accessor :conditions
16
+ class MappedMetricPartialUpdateQueryResourceObjectRelationshipsCustomMetric
17
+ attr_accessor :data
18
18
 
19
19
  # Attribute mapping from ruby-style variable name to JSON key.
20
20
  def self.attribute_map
21
21
  {
22
- :'conditions' => :'conditions'
22
+ :'data' => :'data'
23
23
  }
24
24
  end
25
25
 
@@ -31,7 +31,7 @@ module KlaviyoAPI
31
31
  # Attribute type mapping.
32
32
  def self.openapi_types
33
33
  {
34
- :'conditions' => :'Array<TriggerBranchActionDataTriggerFilterConditionGroupsInnerConditionsInner>'
34
+ :'data' => :'MappedMetricPartialUpdateQueryResourceObjectRelationshipsCustomMetricData'
35
35
  }
36
36
  end
37
37
 
@@ -45,21 +45,19 @@ module KlaviyoAPI
45
45
  # @param [Hash] attributes Model attributes in the form of hash
46
46
  def initialize(attributes = {})
47
47
  if (!attributes.is_a?(Hash))
48
- fail ArgumentError, "The input argument (attributes) must be a hash in `KlaviyoAPI::TriggerBranchActionDataTriggerFilterConditionGroupsInner` initialize method"
48
+ fail ArgumentError, "The input argument (attributes) must be a hash in `KlaviyoAPI::MappedMetricPartialUpdateQueryResourceObjectRelationshipsCustomMetric` initialize method"
49
49
  end
50
50
 
51
51
  # check to see if the attribute exists and convert string to symbol for hash key
52
52
  attributes = attributes.each_with_object({}) { |(k, v), h|
53
53
  if (!self.class.attribute_map.key?(k.to_sym))
54
- fail ArgumentError, "`#{k}` is not a valid attribute in `KlaviyoAPI::TriggerBranchActionDataTriggerFilterConditionGroupsInner`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
54
+ fail ArgumentError, "`#{k}` is not a valid attribute in `KlaviyoAPI::MappedMetricPartialUpdateQueryResourceObjectRelationshipsCustomMetric`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
55
55
  end
56
56
  h[k.to_sym] = v
57
57
  }
58
58
 
59
- if attributes.key?(:'conditions')
60
- if (value = attributes[:'conditions']).is_a?(Array)
61
- self.conditions = value
62
- end
59
+ if attributes.key?(:'data')
60
+ self.data = attributes[:'data']
63
61
  end
64
62
  end
65
63
 
@@ -67,17 +65,12 @@ module KlaviyoAPI
67
65
  # @return Array for valid properties with the reasons
68
66
  def list_invalid_properties
69
67
  invalid_properties = Array.new
70
- if @conditions.nil?
71
- invalid_properties.push('invalid value for "conditions", conditions cannot be nil.')
72
- end
73
-
74
68
  invalid_properties
75
69
  end
76
70
 
77
71
  # Check to see if the all the properties in the model are valid
78
72
  # @return true if the model is valid
79
73
  def valid?
80
- return false if @conditions.nil?
81
74
  true
82
75
  end
83
76
 
@@ -86,7 +79,7 @@ module KlaviyoAPI
86
79
  def ==(o)
87
80
  return true if self.equal?(o)
88
81
  self.class == o.class &&
89
- conditions == o.conditions
82
+ data == o.data
90
83
  end
91
84
 
92
85
  # @see the `==` method
@@ -98,7 +91,7 @@ module KlaviyoAPI
98
91
  # Calculates hash code according to all attributes.
99
92
  # @return [Integer] Hash code
100
93
  def hash
101
- [conditions].hash
94
+ [data].hash
102
95
  end
103
96
 
104
97
  # Builds the object from hash