algolia 3.42.2 → 3.43.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 (41) hide show
  1. checksums.yaml +4 -4
  2. data/.github/workflows/do-not-edit-this-repository.yml +1 -1
  3. data/.github/workflows/issue.yml +1 -1
  4. data/.github/workflows/release.yml +4 -4
  5. data/CHANGELOG.md +14 -0
  6. data/Gemfile.lock +2 -2
  7. data/lib/algolia/api/analytics_client.rb +221 -0
  8. data/lib/algolia/api/search_client.rb +16 -0
  9. data/lib/algolia/api_client.rb +4 -0
  10. data/lib/algolia/models/abtesting-v3/ab_test.rb +14 -4
  11. data/lib/algolia/models/abtesting-v3/decision.rb +219 -0
  12. data/lib/algolia/models/analytics/bin_edge.rb +109 -0
  13. data/lib/algolia/models/analytics/catalog.rb +208 -0
  14. data/lib/algolia/models/analytics/catalog_entry.rb +249 -0
  15. data/lib/algolia/models/analytics/distribution_definition.rb +243 -0
  16. data/lib/algolia/models/analytics/distribution_payload.rb +247 -0
  17. data/lib/algolia/models/analytics/domain_catalog.rb +253 -0
  18. data/lib/algolia/models/analytics/field_reference.rb +219 -0
  19. data/lib/algolia/models/analytics/filter_definition.rb +238 -0
  20. data/lib/algolia/models/analytics/order_definition.rb +230 -0
  21. data/lib/algolia/models/analytics/order_direction.rb +34 -0
  22. data/lib/algolia/models/analytics/parameter_definition.rb +230 -0
  23. data/lib/algolia/models/analytics/parameter_reference.rb +219 -0
  24. data/lib/algolia/models/analytics/parameter_value.rb +111 -0
  25. data/lib/algolia/models/analytics/scalar_payload.rb +247 -0
  26. data/lib/algolia/models/analytics/series.rb +234 -0
  27. data/lib/algolia/models/analytics/series_date.rb +223 -0
  28. data/lib/algolia/models/analytics/table_payload.rb +292 -0
  29. data/lib/algolia/models/analytics/table_response.rb +211 -0
  30. data/lib/algolia/models/analytics/timeseries_payload.rb +279 -0
  31. data/lib/algolia/models/analytics/timeseries_response.rb +213 -0
  32. data/lib/algolia/models/insights/added_to_cart_object_ids_after_search.rb +1 -1
  33. data/lib/algolia/models/insights/clicked_object_ids_after_search.rb +1 -1
  34. data/lib/algolia/models/insights/converted_object_ids_after_search.rb +1 -1
  35. data/lib/algolia/models/insights/events_items.rb +1 -0
  36. data/lib/algolia/models/insights/instantsearch.rb +269 -0
  37. data/lib/algolia/models/insights/instantsearch_event.rb +33 -0
  38. data/lib/algolia/models/recommend/facet_filters.rb +109 -0
  39. data/lib/algolia/models/recommend/fallback_params.rb +14 -4
  40. data/lib/algolia/version.rb +1 -1
  41. metadata +26 -2
@@ -0,0 +1,243 @@
1
+ # frozen_string_literal: true
2
+
3
+ # Code generated by OpenAPI Generator (https://openapi-generator.tech), manual changes will be lost - read more on https://github.com/algolia/api-clients-automation. DO NOT EDIT.
4
+
5
+ require "date"
6
+ require "time"
7
+
8
+ module Algolia
9
+ module Analytics
10
+ class DistributionDefinition
11
+ # Domain the field belongs to.
12
+ attr_accessor :domain
13
+
14
+ # Numeric field to bucket into a histogram.
15
+ attr_accessor :kind
16
+
17
+ # Set to true for continuous kinds; use float bins.
18
+ attr_accessor :continuous
19
+
20
+ # Bin edges.
21
+ attr_accessor :bins
22
+
23
+ # Attribute mapping from ruby-style variable name to JSON key.
24
+ def self.attribute_map
25
+ {
26
+ :domain => :domain,
27
+ :kind => :kind,
28
+ :continuous => :continuous,
29
+ :bins => :bins
30
+ }
31
+ end
32
+
33
+ # Attribute type mapping.
34
+ def self.types_mapping
35
+ {
36
+ :domain => :"String",
37
+ :kind => :"String",
38
+ :continuous => :"Boolean",
39
+ :bins => :"Array<BinEdge>"
40
+ }
41
+ end
42
+
43
+ # List of attributes with nullable: true
44
+ def self.openapi_nullable
45
+ Set.new(
46
+ []
47
+ )
48
+ end
49
+
50
+ # Initializes the object
51
+ # @param [Hash] attributes Model attributes in the form of hash
52
+ def initialize(attributes = {})
53
+ if (!attributes.is_a?(Hash))
54
+ raise(
55
+ ArgumentError,
56
+ "The input argument (attributes) must be a hash in `Algolia::DistributionDefinition` initialize method"
57
+ )
58
+ end
59
+
60
+ # check to see if the attribute exists and convert string to symbol for hash key
61
+ attributes = attributes.each_with_object({}) { |(k, v), h|
62
+ if (!self.class.attribute_map.key?(k.to_sym))
63
+ raise(
64
+ ArgumentError,
65
+ "`#{k}` is not a valid attribute in `Algolia::DistributionDefinition`. Please check the name to make sure it's valid. List of attributes: " +
66
+ self.class.attribute_map.keys.inspect
67
+ )
68
+ end
69
+
70
+ h[k.to_sym] = v
71
+ }
72
+
73
+ if attributes.key?(:domain)
74
+ self.domain = attributes[:domain]
75
+ end
76
+
77
+ if attributes.key?(:kind)
78
+ self.kind = attributes[:kind]
79
+ else
80
+ self.kind = nil
81
+ end
82
+
83
+ if attributes.key?(:continuous)
84
+ self.continuous = attributes[:continuous]
85
+ end
86
+
87
+ if attributes.key?(:bins)
88
+ if (value = attributes[:bins]).is_a?(Array)
89
+ self.bins = value
90
+ end
91
+ else
92
+ self.bins = nil
93
+ end
94
+ end
95
+
96
+ # Checks equality by comparing each attribute.
97
+ # @param [Object] Object to be compared
98
+ def ==(other)
99
+ return true if self.equal?(other)
100
+ self.class == other.class &&
101
+ domain == other.domain &&
102
+ kind == other.kind &&
103
+ continuous == other.continuous &&
104
+ bins == other.bins
105
+ end
106
+
107
+ # @see the `==` method
108
+ # @param [Object] Object to be compared
109
+ def eql?(other)
110
+ self == other
111
+ end
112
+
113
+ # Calculates hash code according to all attributes.
114
+ # @return [Integer] Hash code
115
+ def hash
116
+ [domain, kind, continuous, bins].hash
117
+ end
118
+
119
+ # Builds the object from hash
120
+ # @param [Hash] attributes Model attributes in the form of hash
121
+ # @return [Object] Returns the model itself
122
+ def self.build_from_hash(attributes)
123
+ return nil unless attributes.is_a?(Hash)
124
+ attributes = attributes.transform_keys(&:to_sym)
125
+ transformed_hash = {}
126
+ types_mapping.each_pair do |key, type|
127
+ if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil?
128
+ transformed_hash[key.to_sym] = nil
129
+ elsif type =~ /\AArray<(.*)>/i
130
+ # check to ensure the input is an array given that the attribute
131
+ # is documented as an array but the input is not
132
+ if attributes[attribute_map[key]].is_a?(Array)
133
+ transformed_hash[key.to_sym] = attributes[attribute_map[key]].map { |v|
134
+ _deserialize(::Regexp.last_match(1), v)
135
+ }
136
+ end
137
+ elsif !attributes[attribute_map[key]].nil?
138
+ transformed_hash[key.to_sym] = _deserialize(type, attributes[attribute_map[key]])
139
+ end
140
+ end
141
+
142
+ new(transformed_hash)
143
+ end
144
+
145
+ # Deserializes the data based on type
146
+ # @param string type Data type
147
+ # @param string value Value to be deserialized
148
+ # @return [Object] Deserialized data
149
+ def self._deserialize(type, value)
150
+ case type.to_sym
151
+ when :Time
152
+ Time.parse(value)
153
+ when :Date
154
+ Date.parse(value)
155
+ when :String
156
+ value.to_s
157
+ when :Integer
158
+ value.to_i
159
+ when :Float
160
+ value.to_f
161
+ when :Boolean
162
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
163
+ true
164
+ else
165
+ false
166
+ end
167
+
168
+ when :Object
169
+ # generic object (usually a Hash), return directly
170
+ value
171
+ when /\AArray<(?<inner_type>.+)>\z/
172
+ inner_type = Regexp.last_match[:inner_type]
173
+ value.map { |v| _deserialize(inner_type, v) }
174
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
175
+ k_type = Regexp.last_match[:k_type]
176
+ v_type = Regexp.last_match[:v_type]
177
+ {}.tap do |hash|
178
+ value.each do |k, v|
179
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
180
+ end
181
+ end
182
+ # model
183
+ else
184
+ # models (e.g. Pet) or oneOf
185
+ klass = Algolia::Analytics.const_get(type)
186
+ klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass
187
+ .build_from_hash(value)
188
+ end
189
+ end
190
+
191
+ # Returns the string representation of the object
192
+ # @return [String] String presentation of the object
193
+ def to_s
194
+ to_hash.to_s
195
+ end
196
+
197
+ # to_body is an alias to to_hash (backward compatibility)
198
+ # @return [Hash] Returns the object in the form of hash
199
+ def to_body
200
+ to_hash
201
+ end
202
+
203
+ def to_json(*_args)
204
+ to_hash.to_json
205
+ end
206
+
207
+ # Returns the object in the form of hash
208
+ # @return [Hash] Returns the object in the form of hash
209
+ def to_hash
210
+ hash = {}
211
+ self.class.attribute_map.each_pair do |attr, param|
212
+ value = send(attr)
213
+ if value.nil?
214
+ is_nullable = self.class.openapi_nullable.include?(attr)
215
+ next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
216
+ end
217
+
218
+ hash[param] = _to_hash(value)
219
+ end
220
+
221
+ hash
222
+ end
223
+
224
+ # Outputs non-array value in the form of hash
225
+ # For object, use to_hash. Otherwise, just return the value
226
+ # @param [Object] value Any valid value
227
+ # @return [Hash] Returns the value in the form of hash
228
+ def _to_hash(value)
229
+ if value.is_a?(Array)
230
+ value.map { |v| _to_hash(v) }
231
+ elsif value.is_a?(Hash)
232
+ {}.tap do |hash|
233
+ value.each { |k, v| hash[k] = _to_hash(v) }
234
+ end
235
+ elsif value.respond_to?(:to_hash)
236
+ value.to_hash
237
+ else
238
+ value
239
+ end
240
+ end
241
+ end
242
+ end
243
+ end
@@ -0,0 +1,247 @@
1
+ # frozen_string_literal: true
2
+
3
+ # Code generated by OpenAPI Generator (https://openapi-generator.tech), manual changes will be lost - read more on https://github.com/algolia/api-clients-automation. DO NOT EDIT.
4
+
5
+ require "date"
6
+ require "time"
7
+
8
+ module Algolia
9
+ module Analytics
10
+ class DistributionPayload
11
+ # Default domain propagated to entries that omit their own.
12
+ attr_accessor :domain
13
+
14
+ # Histogram specifications.
15
+ attr_accessor :distributions
16
+
17
+ # Filter conditions.
18
+ attr_accessor :filters
19
+
20
+ # Literal values referenced by the query.
21
+ attr_accessor :parameters
22
+
23
+ # Attribute mapping from ruby-style variable name to JSON key.
24
+ def self.attribute_map
25
+ {
26
+ :domain => :domain,
27
+ :distributions => :distributions,
28
+ :filters => :filters,
29
+ :parameters => :parameters
30
+ }
31
+ end
32
+
33
+ # Attribute type mapping.
34
+ def self.types_mapping
35
+ {
36
+ :domain => :"String",
37
+ :distributions => :"Array<DistributionDefinition>",
38
+ :filters => :"Array<FilterDefinition>",
39
+ :parameters => :"Array<ParameterDefinition>"
40
+ }
41
+ end
42
+
43
+ # List of attributes with nullable: true
44
+ def self.openapi_nullable
45
+ Set.new(
46
+ []
47
+ )
48
+ end
49
+
50
+ # Initializes the object
51
+ # @param [Hash] attributes Model attributes in the form of hash
52
+ def initialize(attributes = {})
53
+ if (!attributes.is_a?(Hash))
54
+ raise(
55
+ ArgumentError,
56
+ "The input argument (attributes) must be a hash in `Algolia::DistributionPayload` initialize method"
57
+ )
58
+ end
59
+
60
+ # check to see if the attribute exists and convert string to symbol for hash key
61
+ attributes = attributes.each_with_object({}) { |(k, v), h|
62
+ if (!self.class.attribute_map.key?(k.to_sym))
63
+ raise(
64
+ ArgumentError,
65
+ "`#{k}` is not a valid attribute in `Algolia::DistributionPayload`. Please check the name to make sure it's valid. List of attributes: " +
66
+ self.class.attribute_map.keys.inspect
67
+ )
68
+ end
69
+
70
+ h[k.to_sym] = v
71
+ }
72
+
73
+ if attributes.key?(:domain)
74
+ self.domain = attributes[:domain]
75
+ end
76
+
77
+ if attributes.key?(:distributions)
78
+ if (value = attributes[:distributions]).is_a?(Array)
79
+ self.distributions = value
80
+ end
81
+ else
82
+ self.distributions = nil
83
+ end
84
+
85
+ if attributes.key?(:filters)
86
+ if (value = attributes[:filters]).is_a?(Array)
87
+ self.filters = value
88
+ end
89
+ end
90
+
91
+ if attributes.key?(:parameters)
92
+ if (value = attributes[:parameters]).is_a?(Array)
93
+ self.parameters = value
94
+ end
95
+ else
96
+ self.parameters = nil
97
+ end
98
+ end
99
+
100
+ # Checks equality by comparing each attribute.
101
+ # @param [Object] Object to be compared
102
+ def ==(other)
103
+ return true if self.equal?(other)
104
+ self.class == other.class &&
105
+ domain == other.domain &&
106
+ distributions == other.distributions &&
107
+ filters == other.filters &&
108
+ parameters == other.parameters
109
+ end
110
+
111
+ # @see the `==` method
112
+ # @param [Object] Object to be compared
113
+ def eql?(other)
114
+ self == other
115
+ end
116
+
117
+ # Calculates hash code according to all attributes.
118
+ # @return [Integer] Hash code
119
+ def hash
120
+ [domain, distributions, filters, parameters].hash
121
+ end
122
+
123
+ # Builds the object from hash
124
+ # @param [Hash] attributes Model attributes in the form of hash
125
+ # @return [Object] Returns the model itself
126
+ def self.build_from_hash(attributes)
127
+ return nil unless attributes.is_a?(Hash)
128
+ attributes = attributes.transform_keys(&:to_sym)
129
+ transformed_hash = {}
130
+ types_mapping.each_pair do |key, type|
131
+ if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil?
132
+ transformed_hash[key.to_sym] = nil
133
+ elsif type =~ /\AArray<(.*)>/i
134
+ # check to ensure the input is an array given that the attribute
135
+ # is documented as an array but the input is not
136
+ if attributes[attribute_map[key]].is_a?(Array)
137
+ transformed_hash[key.to_sym] = attributes[attribute_map[key]].map { |v|
138
+ _deserialize(::Regexp.last_match(1), v)
139
+ }
140
+ end
141
+ elsif !attributes[attribute_map[key]].nil?
142
+ transformed_hash[key.to_sym] = _deserialize(type, attributes[attribute_map[key]])
143
+ end
144
+ end
145
+
146
+ new(transformed_hash)
147
+ end
148
+
149
+ # Deserializes the data based on type
150
+ # @param string type Data type
151
+ # @param string value Value to be deserialized
152
+ # @return [Object] Deserialized data
153
+ def self._deserialize(type, value)
154
+ case type.to_sym
155
+ when :Time
156
+ Time.parse(value)
157
+ when :Date
158
+ Date.parse(value)
159
+ when :String
160
+ value.to_s
161
+ when :Integer
162
+ value.to_i
163
+ when :Float
164
+ value.to_f
165
+ when :Boolean
166
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
167
+ true
168
+ else
169
+ false
170
+ end
171
+
172
+ when :Object
173
+ # generic object (usually a Hash), return directly
174
+ value
175
+ when /\AArray<(?<inner_type>.+)>\z/
176
+ inner_type = Regexp.last_match[:inner_type]
177
+ value.map { |v| _deserialize(inner_type, v) }
178
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
179
+ k_type = Regexp.last_match[:k_type]
180
+ v_type = Regexp.last_match[:v_type]
181
+ {}.tap do |hash|
182
+ value.each do |k, v|
183
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
184
+ end
185
+ end
186
+ # model
187
+ else
188
+ # models (e.g. Pet) or oneOf
189
+ klass = Algolia::Analytics.const_get(type)
190
+ klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass
191
+ .build_from_hash(value)
192
+ end
193
+ end
194
+
195
+ # Returns the string representation of the object
196
+ # @return [String] String presentation of the object
197
+ def to_s
198
+ to_hash.to_s
199
+ end
200
+
201
+ # to_body is an alias to to_hash (backward compatibility)
202
+ # @return [Hash] Returns the object in the form of hash
203
+ def to_body
204
+ to_hash
205
+ end
206
+
207
+ def to_json(*_args)
208
+ to_hash.to_json
209
+ end
210
+
211
+ # Returns the object in the form of hash
212
+ # @return [Hash] Returns the object in the form of hash
213
+ def to_hash
214
+ hash = {}
215
+ self.class.attribute_map.each_pair do |attr, param|
216
+ value = send(attr)
217
+ if value.nil?
218
+ is_nullable = self.class.openapi_nullable.include?(attr)
219
+ next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
220
+ end
221
+
222
+ hash[param] = _to_hash(value)
223
+ end
224
+
225
+ hash
226
+ end
227
+
228
+ # Outputs non-array value in the form of hash
229
+ # For object, use to_hash. Otherwise, just return the value
230
+ # @param [Object] value Any valid value
231
+ # @return [Hash] Returns the value in the form of hash
232
+ def _to_hash(value)
233
+ if value.is_a?(Array)
234
+ value.map { |v| _to_hash(v) }
235
+ elsif value.is_a?(Hash)
236
+ {}.tap do |hash|
237
+ value.each { |k, v| hash[k] = _to_hash(v) }
238
+ end
239
+ elsif value.respond_to?(:to_hash)
240
+ value.to_hash
241
+ else
242
+ value
243
+ end
244
+ end
245
+ end
246
+ end
247
+ end