algolia 3.49.0 → 3.51.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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 8d89992331694b650c757bd4300a1c50a90456fc1c18a0a55ca9825673ceff8b
4
- data.tar.gz: 417b1fa6e11081c252b36df230b726c6a54a8265c74e93e346d72fcdd91626d8
3
+ metadata.gz: affe1ca7f89a5b6f946ea36732b966a6931e5662e5c1ddcc9ec8b655aff989d9
4
+ data.tar.gz: 84d8afefde05c765fc37a8f06d860068d8744c0d3e2e1e7b106fc2b694ed7571
5
5
  SHA512:
6
- metadata.gz: 64c7feb78aa763216cbe7ba3a7fbc69a6bafb69cbf43605ab5cc1a20df73c3323399e0785088e28019328e2ac05ff15117ba6134e1960c97972b00105eec45f5
7
- data.tar.gz: ab26fc8819a6a604bd830175411b6df40dc82ef3c331c85e42a0ad669236890b333bbe0d85dc013d1664f29012c916550c83834d3250262b8f813cddb5250b56
6
+ metadata.gz: 7b794cd4fb9a801d17bf5c28a7a66f01537922fef33a43481e2667f771e2890ea6b2b0b22e09bb44aa603624b6436fc8e7b2893c1df5852d3e208bee29f7eec0
7
+ data.tar.gz: 96ed1e0ad6a39393a8a628dcd9782d218ef4f302914a0b286a746c4b911fb72db25b1304c74b7f209acabbf0be39fadb81ea5d05dd1caaee45e446bddfbf4a51
data/CHANGELOG.md CHANGED
@@ -1,3 +1,13 @@
1
+ ## [3.51.0](https://github.com/algolia/algoliasearch-client-ruby/compare/3.50.0...3.51.0)
2
+
3
+ - [27351e7432](https://github.com/algolia/api-clients-automation/commit/27351e7432) chore(specs): add description for Composition run response ([#7315](https://github.com/algolia/api-clients-automation/pull/7315)) by [@ClaraMuller](https://github.com/ClaraMuller/)
4
+ - [ebfd070ba0](https://github.com/algolia/api-clients-automation/commit/ebfd070ba0) feat(specs): update Recommend rules to support trending-items [PRED-5025] ([#7188](https://github.com/algolia/api-clients-automation/pull/7188)) by [@raed667](https://github.com/raed667/)
5
+ - [83825b5a8f](https://github.com/algolia/api-clients-automation/commit/83825b5a8f) feat(specs): add category scope parameters to abtesting-v3 metrics filters ([#7148](https://github.com/algolia/api-clients-automation/pull/7148)) by [@cdhawke](https://github.com/cdhawke/)
6
+
7
+ ## [3.50.0](https://github.com/algolia/algoliasearch-client-ruby/compare/3.49.0...3.50.0)
8
+
9
+ - [2d8e1605b3](https://github.com/algolia/api-clients-automation/commit/2d8e1605b3) feat(specs): expose abtesting-v3 user populations and no-results rate ([#7305](https://github.com/algolia/api-clients-automation/pull/7305)) by [@stevenMevans](https://github.com/stevenMevans/)
10
+
1
11
  ## [3.49.0](https://github.com/algolia/algoliasearch-client-ruby/compare/3.48.0...3.49.0)
2
12
 
3
13
  - [e6933da012](https://github.com/algolia/api-clients-automation/commit/e6933da012) fix(specs): clarify maxHitsPerQuery is a per-page limit ([#7210](https://github.com/algolia/api-clients-automation/pull/7210)) by [@kai687](https://github.com/kai687/)
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- algolia (3.49.0)
4
+ algolia (3.51.0)
5
5
  base64 (>= 0.2.0, < 1)
6
6
  faraday (>= 1.0.1, < 3.0)
7
7
  faraday-net_http_persistent (>= 0.15, < 3)
@@ -63,7 +63,7 @@ module Algolia
63
63
  self
64
64
  end
65
65
 
66
- # Create or update a batch of Recommend Rules. Each Recommend Rule is created or updated, depending on whether a Recommend Rule with the same `objectID` already exists. You may also specify `true` for `clearExistingRules`, in which case the batch will atomically replace all the existing Recommend Rules. Recommend Rules are similar to Search Rules, except that the conditions and consequences apply to a [source item](/doc/guides/algolia-recommend/overview/#recommend-models) instead of a query. The main differences are the following: - Conditions `pattern` and `anchoring` are unavailable. - Condition `filters` triggers if the source item matches the specified filters. - Condition `filters` accepts numeric filters. - Consequence `params` only covers filtering parameters. - Consequence `automaticFacetFilters` doesn't require a facet value placeholder (it tries to match the data source item's attributes instead).
66
+ # Create or update a batch of Recommend Rules. Each Recommend Rule is created or updated, depending on whether a Recommend Rule with the same `objectID` already exists. You may also specify `true` for `clearExistingRules`, in which case the batch will atomically replace all the existing Recommend Rules. Recommend Rules are similar to Search Rules, except that the conditions and consequences apply to a [source item](/doc/guides/algolia-recommend/overview/#recommend-models) instead of a query. The main differences are the following: - Conditions `pattern` and `anchoring` are unavailable. - Condition `filters` triggers if the source item matches the specified filters. - Condition `filters` accepts numeric filters. - Consequence `params` only covers filtering parameters. - Consequence `automaticFacetFilters` doesn't require a facet value placeholder (it tries to match the data source item's attributes instead). Trending Items requests have no source item, so rules for the `trending-items` model differ: - Condition `filters` and consequence `automaticFacetFilters` are unavailable. - Condition `requestScope` applies the rule to requests without a facet, or to requests for a specific facet.
67
67
  #
68
68
  # Required API Key ACLs:
69
69
  # - editSettings
@@ -107,7 +107,7 @@ module Algolia
107
107
  @api_client.call_api(:POST, path, new_options)
108
108
  end
109
109
 
110
- # Create or update a batch of Recommend Rules. Each Recommend Rule is created or updated, depending on whether a Recommend Rule with the same `objectID` already exists. You may also specify `true` for `clearExistingRules`, in which case the batch will atomically replace all the existing Recommend Rules. Recommend Rules are similar to Search Rules, except that the conditions and consequences apply to a [source item](/doc/guides/algolia-recommend/overview/#recommend-models) instead of a query. The main differences are the following: - Conditions `pattern` and `anchoring` are unavailable. - Condition `filters` triggers if the source item matches the specified filters. - Condition `filters` accepts numeric filters. - Consequence `params` only covers filtering parameters. - Consequence `automaticFacetFilters` doesn't require a facet value placeholder (it tries to match the data source item's attributes instead).
110
+ # Create or update a batch of Recommend Rules. Each Recommend Rule is created or updated, depending on whether a Recommend Rule with the same `objectID` already exists. You may also specify `true` for `clearExistingRules`, in which case the batch will atomically replace all the existing Recommend Rules. Recommend Rules are similar to Search Rules, except that the conditions and consequences apply to a [source item](/doc/guides/algolia-recommend/overview/#recommend-models) instead of a query. The main differences are the following: - Conditions `pattern` and `anchoring` are unavailable. - Condition `filters` triggers if the source item matches the specified filters. - Condition `filters` accepts numeric filters. - Consequence `params` only covers filtering parameters. - Consequence `automaticFacetFilters` doesn't require a facet value placeholder (it tries to match the data source item's attributes instead). Trending Items requests have no source item, so rules for the `trending-items` model differ: - Condition `filters` and consequence `automaticFacetFilters` are unavailable. - Condition `requestScope` applies the rule to requests without a facet, or to requests for a specific facet.
111
111
  #
112
112
  # Required API Key ACLs:
113
113
  # - editSettings
@@ -15,11 +15,15 @@ module Algolia
15
15
  # Mean value for this metric.
16
16
  attr_accessor :mean
17
17
 
18
+ # Only present for `winsorized_revenue_per_user`. Number of tracked users in this variant with a tracked purchase in the metric's currency (`dimension`), plus tracked users with no tracked purchase in any currency. Users who purchased only in other currencies are excluded. It's the sample size behind the mean, p-value, and intervals, and differs from the overall `user_count` metric. Omitted when the variant has no record for that currency.
19
+ attr_accessor :user_count
20
+
18
21
  # Attribute mapping from ruby-style variable name to JSON key.
19
22
  def self.attribute_map
20
23
  {
21
24
  :winsorized_value => :winsorizedValue,
22
- :mean => :mean
25
+ :mean => :mean,
26
+ :user_count => :userCount
23
27
  }
24
28
  end
25
29
 
@@ -27,7 +31,8 @@ module Algolia
27
31
  def self.types_mapping
28
32
  {
29
33
  :winsorized_value => :"Float",
30
- :mean => :"Float"
34
+ :mean => :"Float",
35
+ :user_count => :"Integer"
31
36
  }
32
37
  end
33
38
 
@@ -68,6 +73,10 @@ module Algolia
68
73
  if attributes.key?(:mean)
69
74
  self.mean = attributes[:mean]
70
75
  end
76
+
77
+ if attributes.key?(:user_count)
78
+ self.user_count = attributes[:user_count]
79
+ end
71
80
  end
72
81
 
73
82
  # Checks equality by comparing each attribute.
@@ -76,7 +85,8 @@ module Algolia
76
85
  return true if self.equal?(other)
77
86
  self.class == other.class &&
78
87
  winsorized_value == other.winsorized_value &&
79
- mean == other.mean
88
+ mean == other.mean &&
89
+ user_count == other.user_count
80
90
  end
81
91
 
82
92
  # @see the `==` method
@@ -88,7 +98,7 @@ module Algolia
88
98
  # Calculates hash code according to all attributes.
89
99
  # @return [Integer] Hash code
90
100
  def hash
91
- [winsorized_value, mean].hash
101
+ [winsorized_value, mean, user_count].hash
92
102
  end
93
103
 
94
104
  # Builds the object from hash
@@ -35,6 +35,7 @@ module Algolia
35
35
  CONVERTED_USERS_RATE = "converted_users_rate".freeze
36
36
  ADD_TO_CART_USERS_RATE = "add_to_cart_users_rate".freeze
37
37
  PURCHASE_USERS_RATE = "purchase_users_rate".freeze
38
+ USERS_WITH_NO_RESULTS_RATE = "users_with_no_results_rate".freeze
38
39
  AVG_CLICK_THROUGH_RATE_PER_USER = "avg_click_through_rate_per_user".freeze
39
40
  AVG_CONVERSION_RATE_PER_USER = "avg_conversion_rate_per_user".freeze
40
41
  AVG_PURCHASE_RATE_PER_USER = "avg_purchase_rate_per_user".freeze
@@ -72,6 +73,7 @@ module Algolia
72
73
  CONVERTED_USERS_RATE,
73
74
  ADD_TO_CART_USERS_RATE,
74
75
  PURCHASE_USERS_RATE,
76
+ USERS_WITH_NO_RESULTS_RATE,
75
77
  AVG_CLICK_THROUGH_RATE_PER_USER,
76
78
  AVG_CONVERSION_RATE_PER_USER,
77
79
  AVG_PURCHASE_RATE_PER_USER,
@@ -26,7 +26,7 @@ module Algolia
26
26
  # P-value for this variant compared to the control. Omitted when no p-value is available for this metric.
27
27
  attr_accessor :p_value
28
28
 
29
- # Dimension defined during test creation. For revenue metrics, including `revenue_per_search`, this is the currency.
29
+ # Dimension defined during test creation. For revenue metrics, including `revenue_per_search` and `winsorized_revenue_per_user`, this is the currency.
30
30
  attr_accessor :dimension
31
31
 
32
32
  attr_accessor :metadata
@@ -9,25 +9,28 @@ module Algolia
9
9
  module AbtestingV3
10
10
  # Boolean filter applied to the A/B test population. Each filter targets a boolean metric and decides whether to include (true) or exclude (false) matching records.
11
11
  class MetricsFilter
12
- # Metric domain (for example `abtesting`, `personalization`).
12
+ # Metric domain (for example `abtesting`, `core`, `personalization`).
13
13
  attr_accessor :domain
14
14
 
15
15
  # Public metric name.
16
16
  attr_accessor :name
17
17
 
18
- # Whether the experiment should record the effects of this filter.
18
+ # Whether the experiment should record the effects of this filter. Not supported by `core.hasExactCategoryFilter`.
19
19
  attr_accessor :track_effects
20
20
 
21
- # If true, keep items that match the filter; if false, exclude them.
21
+ # If true, keep items that match the filter; if false, exclude them. Defaults to false.
22
22
  attr_accessor :includes
23
23
 
24
+ attr_accessor :parameters
25
+
24
26
  # Attribute mapping from ruby-style variable name to JSON key.
25
27
  def self.attribute_map
26
28
  {
27
29
  :domain => :domain,
28
30
  :name => :name,
29
31
  :track_effects => :trackEffects,
30
- :includes => :includes
32
+ :includes => :includes,
33
+ :parameters => :parameters
31
34
  }
32
35
  end
33
36
 
@@ -37,7 +40,8 @@ module Algolia
37
40
  :domain => :"String",
38
41
  :name => :"String",
39
42
  :track_effects => :"Boolean",
40
- :includes => :"Boolean"
43
+ :includes => :"Boolean",
44
+ :parameters => :"MetricsFilterParameters"
41
45
  }
42
46
  end
43
47
 
@@ -90,6 +94,10 @@ module Algolia
90
94
  if attributes.key?(:includes)
91
95
  self.includes = attributes[:includes]
92
96
  end
97
+
98
+ if attributes.key?(:parameters)
99
+ self.parameters = attributes[:parameters]
100
+ end
93
101
  end
94
102
 
95
103
  # Checks equality by comparing each attribute.
@@ -100,7 +108,8 @@ module Algolia
100
108
  domain == other.domain &&
101
109
  name == other.name &&
102
110
  track_effects == other.track_effects &&
103
- includes == other.includes
111
+ includes == other.includes &&
112
+ parameters == other.parameters
104
113
  end
105
114
 
106
115
  # @see the `==` method
@@ -112,7 +121,7 @@ module Algolia
112
121
  # Calculates hash code according to all attributes.
113
122
  # @return [Integer] Hash code
114
123
  def hash
115
- [domain, name, track_effects, includes].hash
124
+ [domain, name, track_effects, includes, parameters].hash
116
125
  end
117
126
 
118
127
  # Builds the object from hash
@@ -0,0 +1,218 @@
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 AbtestingV3
10
+ # Values for a filter that needs them. The `core.hasExactCategoryFilter` filter requires both properties and matches the searches that had the exact filter `<filterAttribute>:<filterValue>`. Optional filters and filters in an OR group don't match. With `includes` false or omitted, the test counts every search except those searches. A test can have at most one `core.hasExactCategoryFilter` filter. Other filters don't accept parameters.
11
+ class MetricsFilterParameters
12
+ # Facet attribute of the category, for example `categories.lvl0`. Hierarchical facets have one attribute for each level.
13
+ attr_accessor :filter_attribute
14
+
15
+ # Facet value of the category, exactly as the search sends it.
16
+ attr_accessor :filter_value
17
+
18
+ # Attribute mapping from ruby-style variable name to JSON key.
19
+ def self.attribute_map
20
+ {
21
+ :filter_attribute => :filterAttribute,
22
+ :filter_value => :filterValue
23
+ }
24
+ end
25
+
26
+ # Attribute type mapping.
27
+ def self.types_mapping
28
+ {
29
+ :filter_attribute => :"String",
30
+ :filter_value => :"String"
31
+ }
32
+ end
33
+
34
+ # List of attributes with nullable: true
35
+ def self.openapi_nullable
36
+ Set.new(
37
+ []
38
+ )
39
+ end
40
+
41
+ # Initializes the object
42
+ # @param [Hash] attributes Model attributes in the form of hash
43
+ def initialize(attributes = {})
44
+ if (!attributes.is_a?(Hash))
45
+ raise(
46
+ ArgumentError,
47
+ "The input argument (attributes) must be a hash in `Algolia::MetricsFilterParameters` initialize method"
48
+ )
49
+ end
50
+
51
+ # check to see if the attribute exists and convert string to symbol for hash key
52
+ attributes = attributes.each_with_object({}) { |(k, v), h|
53
+ if (!self.class.attribute_map.key?(k.to_sym))
54
+ raise(
55
+ ArgumentError,
56
+ "`#{k}` is not a valid attribute in `Algolia::MetricsFilterParameters`. Please check the name to make sure it's valid. List of attributes: " +
57
+ self.class.attribute_map.keys.inspect
58
+ )
59
+ end
60
+
61
+ h[k.to_sym] = v
62
+ }
63
+
64
+ if attributes.key?(:filter_attribute)
65
+ self.filter_attribute = attributes[:filter_attribute]
66
+ end
67
+
68
+ if attributes.key?(:filter_value)
69
+ self.filter_value = attributes[:filter_value]
70
+ end
71
+ end
72
+
73
+ # Checks equality by comparing each attribute.
74
+ # @param [Object] Object to be compared
75
+ def ==(other)
76
+ return true if self.equal?(other)
77
+ self.class == other.class &&
78
+ filter_attribute == other.filter_attribute &&
79
+ filter_value == other.filter_value
80
+ end
81
+
82
+ # @see the `==` method
83
+ # @param [Object] Object to be compared
84
+ def eql?(other)
85
+ self == other
86
+ end
87
+
88
+ # Calculates hash code according to all attributes.
89
+ # @return [Integer] Hash code
90
+ def hash
91
+ [filter_attribute, filter_value].hash
92
+ end
93
+
94
+ # Builds the object from hash
95
+ # @param [Hash] attributes Model attributes in the form of hash
96
+ # @return [Object] Returns the model itself
97
+ def self.build_from_hash(attributes)
98
+ return nil unless attributes.is_a?(Hash)
99
+ attributes = attributes.transform_keys(&:to_sym)
100
+ transformed_hash = {}
101
+ types_mapping.each_pair do |key, type|
102
+ if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil?
103
+ transformed_hash[key.to_sym] = nil
104
+ elsif type =~ /\AArray<(.*)>/i
105
+ # check to ensure the input is an array given that the attribute
106
+ # is documented as an array but the input is not
107
+ if attributes[attribute_map[key]].is_a?(Array)
108
+ transformed_hash[key.to_sym] = attributes[attribute_map[key]].map { |v|
109
+ _deserialize(::Regexp.last_match(1), v)
110
+ }
111
+ end
112
+ elsif !attributes[attribute_map[key]].nil?
113
+ transformed_hash[key.to_sym] = _deserialize(type, attributes[attribute_map[key]])
114
+ end
115
+ end
116
+
117
+ new(transformed_hash)
118
+ end
119
+
120
+ # Deserializes the data based on type
121
+ # @param string type Data type
122
+ # @param string value Value to be deserialized
123
+ # @return [Object] Deserialized data
124
+ def self._deserialize(type, value)
125
+ case type.to_sym
126
+ when :Time
127
+ Time.parse(value)
128
+ when :Date
129
+ Date.parse(value)
130
+ when :String
131
+ value.to_s
132
+ when :Integer
133
+ value.to_i
134
+ when :Float
135
+ value.to_f
136
+ when :Boolean
137
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
138
+ true
139
+ else
140
+ false
141
+ end
142
+
143
+ when :Object
144
+ # generic object (usually a Hash), return directly
145
+ value
146
+ when /\AArray<(?<inner_type>.+)>\z/
147
+ inner_type = Regexp.last_match[:inner_type]
148
+ value.map { |v| _deserialize(inner_type, v) }
149
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
150
+ k_type = Regexp.last_match[:k_type]
151
+ v_type = Regexp.last_match[:v_type]
152
+ {}.tap do |hash|
153
+ value.each do |k, v|
154
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
155
+ end
156
+ end
157
+ # model
158
+ else
159
+ # models (e.g. Pet) or oneOf
160
+ klass = Algolia::AbtestingV3.const_get(type)
161
+ klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass
162
+ .build_from_hash(value)
163
+ end
164
+ end
165
+
166
+ # Returns the string representation of the object
167
+ # @return [String] String presentation of the object
168
+ def to_s
169
+ to_hash.to_s
170
+ end
171
+
172
+ # to_body is an alias to to_hash (backward compatibility)
173
+ # @return [Hash] Returns the object in the form of hash
174
+ def to_body
175
+ to_hash
176
+ end
177
+
178
+ def to_json(*_args)
179
+ to_hash.to_json
180
+ end
181
+
182
+ # Returns the object in the form of hash
183
+ # @return [Hash] Returns the object in the form of hash
184
+ def to_hash
185
+ hash = {}
186
+ self.class.attribute_map.each_pair do |attr, param|
187
+ value = send(attr)
188
+ if value.nil?
189
+ is_nullable = self.class.openapi_nullable.include?(attr)
190
+ next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
191
+ end
192
+
193
+ hash[param] = _to_hash(value)
194
+ end
195
+
196
+ hash
197
+ end
198
+
199
+ # Outputs non-array value in the form of hash
200
+ # For object, use to_hash. Otherwise, just return the value
201
+ # @param [Object] value Any valid value
202
+ # @return [Hash] Returns the value in the form of hash
203
+ def _to_hash(value)
204
+ if value.is_a?(Array)
205
+ value.map { |v| _to_hash(v) }
206
+ elsif value.is_a?(Hash)
207
+ {}.tap do |hash|
208
+ value.each { |k, v| hash[k] = _to_hash(v) }
209
+ end
210
+ elsif value.respond_to?(:to_hash)
211
+ value.to_hash
212
+ else
213
+ value
214
+ end
215
+ end
216
+ end
217
+ end
218
+ end
@@ -17,6 +17,7 @@ module Algolia
17
17
  CLICKED_USERS_RATE = "clicked_users_rate".freeze
18
18
  CONVERTED_USERS_RATE = "converted_users_rate".freeze
19
19
  PURCHASE_USERS_RATE = "purchase_users_rate".freeze
20
+ USERS_WITH_NO_RESULTS_RATE = "users_with_no_results_rate".freeze
20
21
 
21
22
  def self.all_vars
22
23
  @all_vars ||= [
@@ -28,7 +29,8 @@ module Algolia
28
29
  ADD_TO_CART_USERS_RATE,
29
30
  CLICKED_USERS_RATE,
30
31
  CONVERTED_USERS_RATE,
31
- PURCHASE_USERS_RATE
32
+ PURCHASE_USERS_RATE,
33
+ USERS_WITH_NO_RESULTS_RATE
32
34
  ].freeze
33
35
  end
34
36
 
@@ -7,6 +7,7 @@ require "time"
7
7
 
8
8
  module Algolia
9
9
  module Composition
10
+ # Information about the compositions processed by the run request. Only present when `getRankingInfo` is `true`.
10
11
  class CompositionsSearchResponse
11
12
  attr_accessor :run
12
13
 
@@ -15,11 +15,14 @@ module Algolia
15
15
  # An additional restriction that only triggers the rule, when the search has the same value as `ruleContexts` parameter. For example, if `context: mobile`, the rule is only triggered when the search request has a matching `ruleContexts: mobile`. A rule context must only contain alphanumeric characters.
16
16
  attr_accessor :context
17
17
 
18
+ attr_accessor :request_scope
19
+
18
20
  # Attribute mapping from ruby-style variable name to JSON key.
19
21
  def self.attribute_map
20
22
  {
21
23
  :filters => :filters,
22
- :context => :context
24
+ :context => :context,
25
+ :request_scope => :requestScope
23
26
  }
24
27
  end
25
28
 
@@ -27,7 +30,8 @@ module Algolia
27
30
  def self.types_mapping
28
31
  {
29
32
  :filters => :"String",
30
- :context => :"String"
33
+ :context => :"String",
34
+ :request_scope => :"RequestScope"
31
35
  }
32
36
  end
33
37
 
@@ -68,6 +72,10 @@ module Algolia
68
72
  if attributes.key?(:context)
69
73
  self.context = attributes[:context]
70
74
  end
75
+
76
+ if attributes.key?(:request_scope)
77
+ self.request_scope = attributes[:request_scope]
78
+ end
71
79
  end
72
80
 
73
81
  # Checks equality by comparing each attribute.
@@ -76,7 +84,8 @@ module Algolia
76
84
  return true if self.equal?(other)
77
85
  self.class == other.class &&
78
86
  filters == other.filters &&
79
- context == other.context
87
+ context == other.context &&
88
+ request_scope == other.request_scope
80
89
  end
81
90
 
82
91
  # @see the `==` method
@@ -88,7 +97,7 @@ module Algolia
88
97
  # Calculates hash code according to all attributes.
89
98
  # @return [Integer] Hash code
90
99
  def hash
91
- [filters, context].hash
100
+ [filters, context, request_scope].hash
92
101
  end
93
102
 
94
103
  # Builds the object from hash
@@ -0,0 +1,230 @@
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 Recommend
10
+ # Apply the rule only to Trending Items requests with the same `facetName` and `facetValue`.
11
+ class FacetRequestScope
12
+ # Facet attribute of the Trending Items request.
13
+ attr_accessor :facet_name
14
+
15
+ # Facet value of the Trending Items request.
16
+ attr_accessor :facet_value
17
+
18
+ # Attribute mapping from ruby-style variable name to JSON key.
19
+ def self.attribute_map
20
+ {
21
+ :facet_name => :facetName,
22
+ :facet_value => :facetValue
23
+ }
24
+ end
25
+
26
+ # Returns the keys that uniquely identify this oneOf variant when present
27
+ def self.discriminator_attributes
28
+ [
29
+ :facetName,
30
+ :facetValue
31
+ ]
32
+ end
33
+
34
+ # Attribute type mapping.
35
+ def self.types_mapping
36
+ {
37
+ :facet_name => :"String",
38
+ :facet_value => :"String"
39
+ }
40
+ end
41
+
42
+ # List of attributes with nullable: true
43
+ def self.openapi_nullable
44
+ Set.new(
45
+ []
46
+ )
47
+ end
48
+
49
+ # Initializes the object
50
+ # @param [Hash] attributes Model attributes in the form of hash
51
+ def initialize(attributes = {})
52
+ if (!attributes.is_a?(Hash))
53
+ raise(
54
+ ArgumentError,
55
+ "The input argument (attributes) must be a hash in `Algolia::FacetRequestScope` initialize method"
56
+ )
57
+ end
58
+
59
+ # check to see if the attribute exists and convert string to symbol for hash key
60
+ attributes = attributes.each_with_object({}) { |(k, v), h|
61
+ if (!self.class.attribute_map.key?(k.to_sym))
62
+ raise(
63
+ ArgumentError,
64
+ "`#{k}` is not a valid attribute in `Algolia::FacetRequestScope`. Please check the name to make sure it's valid. List of attributes: " +
65
+ self.class.attribute_map.keys.inspect
66
+ )
67
+ end
68
+
69
+ h[k.to_sym] = v
70
+ }
71
+
72
+ if attributes.key?(:facet_name)
73
+ self.facet_name = attributes[:facet_name]
74
+ else
75
+ self.facet_name = nil
76
+ end
77
+
78
+ if attributes.key?(:facet_value)
79
+ self.facet_value = attributes[:facet_value]
80
+ else
81
+ self.facet_value = nil
82
+ end
83
+ end
84
+
85
+ # Checks equality by comparing each attribute.
86
+ # @param [Object] Object to be compared
87
+ def ==(other)
88
+ return true if self.equal?(other)
89
+ self.class == other.class &&
90
+ facet_name == other.facet_name &&
91
+ facet_value == other.facet_value
92
+ end
93
+
94
+ # @see the `==` method
95
+ # @param [Object] Object to be compared
96
+ def eql?(other)
97
+ self == other
98
+ end
99
+
100
+ # Calculates hash code according to all attributes.
101
+ # @return [Integer] Hash code
102
+ def hash
103
+ [facet_name, facet_value].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
+ return nil unless attributes.is_a?(Hash)
111
+ attributes = attributes.transform_keys(&:to_sym)
112
+ transformed_hash = {}
113
+ types_mapping.each_pair do |key, type|
114
+ if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil?
115
+ transformed_hash[key.to_sym] = nil
116
+ elsif type =~ /\AArray<(.*)>/i
117
+ # check to ensure the input is an array given that the attribute
118
+ # is documented as an array but the input is not
119
+ if attributes[attribute_map[key]].is_a?(Array)
120
+ transformed_hash[key.to_sym] = attributes[attribute_map[key]].map { |v|
121
+ _deserialize(::Regexp.last_match(1), v)
122
+ }
123
+ end
124
+ elsif !attributes[attribute_map[key]].nil?
125
+ transformed_hash[key.to_sym] = _deserialize(type, attributes[attribute_map[key]])
126
+ end
127
+ end
128
+
129
+ new(transformed_hash)
130
+ end
131
+
132
+ # Deserializes the data based on type
133
+ # @param string type Data type
134
+ # @param string value Value to be deserialized
135
+ # @return [Object] Deserialized data
136
+ def self._deserialize(type, value)
137
+ case type.to_sym
138
+ when :Time
139
+ Time.parse(value)
140
+ when :Date
141
+ Date.parse(value)
142
+ when :String
143
+ value.to_s
144
+ when :Integer
145
+ value.to_i
146
+ when :Float
147
+ value.to_f
148
+ when :Boolean
149
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
150
+ true
151
+ else
152
+ false
153
+ end
154
+
155
+ when :Object
156
+ # generic object (usually a Hash), return directly
157
+ value
158
+ when /\AArray<(?<inner_type>.+)>\z/
159
+ inner_type = Regexp.last_match[:inner_type]
160
+ value.map { |v| _deserialize(inner_type, v) }
161
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
162
+ k_type = Regexp.last_match[:k_type]
163
+ v_type = Regexp.last_match[:v_type]
164
+ {}.tap do |hash|
165
+ value.each do |k, v|
166
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
167
+ end
168
+ end
169
+ # model
170
+ else
171
+ # models (e.g. Pet) or oneOf
172
+ klass = Algolia::Recommend.const_get(type)
173
+ klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass
174
+ .build_from_hash(value)
175
+ end
176
+ end
177
+
178
+ # Returns the string representation of the object
179
+ # @return [String] String presentation of the object
180
+ def to_s
181
+ to_hash.to_s
182
+ end
183
+
184
+ # to_body is an alias to to_hash (backward compatibility)
185
+ # @return [Hash] Returns the object in the form of hash
186
+ def to_body
187
+ to_hash
188
+ end
189
+
190
+ def to_json(*_args)
191
+ to_hash.to_json
192
+ end
193
+
194
+ # Returns the object in the form of hash
195
+ # @return [Hash] Returns the object in the form of hash
196
+ def to_hash
197
+ hash = {}
198
+ self.class.attribute_map.each_pair do |attr, param|
199
+ value = send(attr)
200
+ if value.nil?
201
+ is_nullable = self.class.openapi_nullable.include?(attr)
202
+ next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
203
+ end
204
+
205
+ hash[param] = _to_hash(value)
206
+ end
207
+
208
+ hash
209
+ end
210
+
211
+ # Outputs non-array value in the form of hash
212
+ # For object, use to_hash. Otherwise, just return the value
213
+ # @param [Object] value Any valid value
214
+ # @return [Hash] Returns the value in the form of hash
215
+ def _to_hash(value)
216
+ if value.is_a?(Array)
217
+ value.map { |v| _to_hash(v) }
218
+ elsif value.is_a?(Hash)
219
+ {}.tap do |hash|
220
+ value.each { |k, v| hash[k] = _to_hash(v) }
221
+ end
222
+ elsif value.respond_to?(:to_hash)
223
+ value.to_hash
224
+ else
225
+ value
226
+ end
227
+ end
228
+ end
229
+ end
230
+ end
@@ -0,0 +1,217 @@
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 Recommend
10
+ # Apply the rule only to Trending Items requests without `facetName` and `facetValue`.
11
+ class GlobalRequestScope
12
+ # Whether the rule applies to requests without a facet. Must be `true`.
13
+ attr_accessor :global
14
+
15
+ # Attribute mapping from ruby-style variable name to JSON key.
16
+ def self.attribute_map
17
+ {
18
+ :global => :global
19
+ }
20
+ end
21
+
22
+ # Returns the keys that uniquely identify this oneOf variant when present
23
+ def self.discriminator_attributes
24
+ [
25
+ :global
26
+ ]
27
+ end
28
+
29
+ # Attribute type mapping.
30
+ def self.types_mapping
31
+ {
32
+ :global => :"Boolean"
33
+ }
34
+ end
35
+
36
+ # List of attributes with nullable: true
37
+ def self.openapi_nullable
38
+ Set.new(
39
+ []
40
+ )
41
+ end
42
+
43
+ # Initializes the object
44
+ # @param [Hash] attributes Model attributes in the form of hash
45
+ def initialize(attributes = {})
46
+ if (!attributes.is_a?(Hash))
47
+ raise(
48
+ ArgumentError,
49
+ "The input argument (attributes) must be a hash in `Algolia::GlobalRequestScope` initialize method"
50
+ )
51
+ end
52
+
53
+ # check to see if the attribute exists and convert string to symbol for hash key
54
+ attributes = attributes.each_with_object({}) { |(k, v), h|
55
+ if (!self.class.attribute_map.key?(k.to_sym))
56
+ raise(
57
+ ArgumentError,
58
+ "`#{k}` is not a valid attribute in `Algolia::GlobalRequestScope`. Please check the name to make sure it's valid. List of attributes: " +
59
+ self.class.attribute_map.keys.inspect
60
+ )
61
+ end
62
+
63
+ h[k.to_sym] = v
64
+ }
65
+
66
+ if attributes.key?(:global)
67
+ self.global = attributes[:global]
68
+ else
69
+ self.global = nil
70
+ end
71
+ end
72
+
73
+ # Checks equality by comparing each attribute.
74
+ # @param [Object] Object to be compared
75
+ def ==(other)
76
+ return true if self.equal?(other)
77
+ self.class == other.class &&
78
+ global == other.global
79
+ end
80
+
81
+ # @see the `==` method
82
+ # @param [Object] Object to be compared
83
+ def eql?(other)
84
+ self == other
85
+ end
86
+
87
+ # Calculates hash code according to all attributes.
88
+ # @return [Integer] Hash code
89
+ def hash
90
+ [global].hash
91
+ end
92
+
93
+ # Builds the object from hash
94
+ # @param [Hash] attributes Model attributes in the form of hash
95
+ # @return [Object] Returns the model itself
96
+ def self.build_from_hash(attributes)
97
+ return nil unless attributes.is_a?(Hash)
98
+ attributes = attributes.transform_keys(&:to_sym)
99
+ transformed_hash = {}
100
+ types_mapping.each_pair do |key, type|
101
+ if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil?
102
+ transformed_hash[key.to_sym] = nil
103
+ elsif type =~ /\AArray<(.*)>/i
104
+ # check to ensure the input is an array given that the attribute
105
+ # is documented as an array but the input is not
106
+ if attributes[attribute_map[key]].is_a?(Array)
107
+ transformed_hash[key.to_sym] = attributes[attribute_map[key]].map { |v|
108
+ _deserialize(::Regexp.last_match(1), v)
109
+ }
110
+ end
111
+ elsif !attributes[attribute_map[key]].nil?
112
+ transformed_hash[key.to_sym] = _deserialize(type, attributes[attribute_map[key]])
113
+ end
114
+ end
115
+
116
+ new(transformed_hash)
117
+ end
118
+
119
+ # Deserializes the data based on type
120
+ # @param string type Data type
121
+ # @param string value Value to be deserialized
122
+ # @return [Object] Deserialized data
123
+ def self._deserialize(type, value)
124
+ case type.to_sym
125
+ when :Time
126
+ Time.parse(value)
127
+ when :Date
128
+ Date.parse(value)
129
+ when :String
130
+ value.to_s
131
+ when :Integer
132
+ value.to_i
133
+ when :Float
134
+ value.to_f
135
+ when :Boolean
136
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
137
+ true
138
+ else
139
+ false
140
+ end
141
+
142
+ when :Object
143
+ # generic object (usually a Hash), return directly
144
+ value
145
+ when /\AArray<(?<inner_type>.+)>\z/
146
+ inner_type = Regexp.last_match[:inner_type]
147
+ value.map { |v| _deserialize(inner_type, v) }
148
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
149
+ k_type = Regexp.last_match[:k_type]
150
+ v_type = Regexp.last_match[:v_type]
151
+ {}.tap do |hash|
152
+ value.each do |k, v|
153
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
154
+ end
155
+ end
156
+ # model
157
+ else
158
+ # models (e.g. Pet) or oneOf
159
+ klass = Algolia::Recommend.const_get(type)
160
+ klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass
161
+ .build_from_hash(value)
162
+ end
163
+ end
164
+
165
+ # Returns the string representation of the object
166
+ # @return [String] String presentation of the object
167
+ def to_s
168
+ to_hash.to_s
169
+ end
170
+
171
+ # to_body is an alias to to_hash (backward compatibility)
172
+ # @return [Hash] Returns the object in the form of hash
173
+ def to_body
174
+ to_hash
175
+ end
176
+
177
+ def to_json(*_args)
178
+ to_hash.to_json
179
+ end
180
+
181
+ # Returns the object in the form of hash
182
+ # @return [Hash] Returns the object in the form of hash
183
+ def to_hash
184
+ hash = {}
185
+ self.class.attribute_map.each_pair do |attr, param|
186
+ value = send(attr)
187
+ if value.nil?
188
+ is_nullable = self.class.openapi_nullable.include?(attr)
189
+ next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
190
+ end
191
+
192
+ hash[param] = _to_hash(value)
193
+ end
194
+
195
+ hash
196
+ end
197
+
198
+ # Outputs non-array value in the form of hash
199
+ # For object, use to_hash. Otherwise, just return the value
200
+ # @param [Object] value Any valid value
201
+ # @return [Hash] Returns the value in the form of hash
202
+ def _to_hash(value)
203
+ if value.is_a?(Array)
204
+ value.map { |v| _to_hash(v) }
205
+ elsif value.is_a?(Hash)
206
+ {}.tap do |hash|
207
+ value.each { |k, v| hash[k] = _to_hash(v) }
208
+ end
209
+ elsif value.respond_to?(:to_hash)
210
+ value.to_hash
211
+ else
212
+ value
213
+ end
214
+ end
215
+ end
216
+ end
217
+ end
@@ -10,11 +10,11 @@ module Algolia
10
10
  class RecommendModels
11
11
  RELATED_PRODUCTS = "related-products".freeze
12
12
  BOUGHT_TOGETHER = "bought-together".freeze
13
- TRENDING_FACETS = "trending-facets".freeze
14
13
  TRENDING_ITEMS = "trending-items".freeze
14
+ LOOKING_SIMILAR = "looking-similar".freeze
15
15
 
16
16
  def self.all_vars
17
- @all_vars ||= [RELATED_PRODUCTS, BOUGHT_TOGETHER, TRENDING_FACETS, TRENDING_ITEMS].freeze
17
+ @all_vars ||= [RELATED_PRODUCTS, BOUGHT_TOGETHER, TRENDING_ITEMS, LOOKING_SIMILAR].freeze
18
18
  end
19
19
 
20
20
  # Builds the enum from string
@@ -0,0 +1,109 @@
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 Recommend
10
+ # Facet that a Trending Items request must target for the rule to apply. Only available for the `trending-items` model. Rules without `requestScope` apply to all Trending Items requests.
11
+ module RequestScope
12
+ class << self
13
+ # List of class defined in oneOf (OpenAPI v3)
14
+ def openapi_one_of
15
+ [
16
+ :"FacetRequestScope",
17
+ :"GlobalRequestScope"
18
+ ]
19
+ end
20
+
21
+ # Builds the object
22
+ # @param [Mixed] Data to be matched against the list of oneOf items
23
+ # @return [Object] Returns the model or the data itself
24
+ def build(data)
25
+ # Go through the list of oneOf items and attempt to identify the appropriate one.
26
+ # Note:
27
+ # - We do not attempt to check whether exactly one item matches.
28
+ # - No advanced validation of types in some cases (e.g. "x: { type: string }" will happily match { x: 123 })
29
+ # due to the way the deserialization is made in the base_object template (it just casts without verifying).
30
+ # - TODO: scalar values are de facto behaving as if they were nullable.
31
+ # - TODO: logging when debugging is set.
32
+ openapi_one_of.each do |klass|
33
+ begin
34
+ # "nullable: true"
35
+ next if klass == :AnyType
36
+ typed_data = find_and_cast_into_type(klass, data)
37
+ return typed_data if typed_data
38
+ # rescue all errors so we keep iterating even if the current item lookup raises
39
+ rescue
40
+ end
41
+ end
42
+
43
+ openapi_one_of.include?(:AnyType) ? data : nil
44
+ end
45
+
46
+ private
47
+
48
+ SchemaMismatchError = Class.new(StandardError)
49
+
50
+ def find_and_cast_into_type(klass, data)
51
+ return if data.nil?
52
+
53
+ case klass.to_s
54
+ when "Boolean"
55
+ return data if data.instance_of?(TrueClass) || data.instance_of?(FalseClass)
56
+ when "Float"
57
+ return data if data.instance_of?(Float)
58
+ when "Integer"
59
+ return data if data.instance_of?(Integer)
60
+ when "Time"
61
+ return Time.parse(data)
62
+ when "Date"
63
+ return Date.parse(data)
64
+ when "String"
65
+ return data if data.instance_of?(String)
66
+ # "type: object"
67
+ when "Object"
68
+ return data if data.instance_of?(Hash)
69
+ # "type: array"
70
+ when /\AArray<(?<sub_type>.+)>\z/
71
+ if data.instance_of?(Array)
72
+ sub_type = Regexp.last_match[:sub_type]
73
+ return data.map { |item| find_and_cast_into_type(sub_type, item) }
74
+ end
75
+ # "type: object" with "additionalProperties: { ... }"
76
+ when /\AHash<String, (?<sub_type>.+)>\z/
77
+ if data.instance_of?(Hash) && data.keys.all? { |k| k.instance_of?(Symbol) || k.instance_of?(String) }
78
+ sub_type = Regexp.last_match[:sub_type]
79
+ return data.each_with_object({}) { |(k, v), hsh| hsh[k] = find_and_cast_into_type(sub_type, v) }
80
+ end
81
+ # model
82
+ else
83
+ const = Algolia::Recommend.const_get(klass)
84
+ if const
85
+ if const.respond_to?(:openapi_one_of)
86
+ # nested oneOf model
87
+ model = const.build(data)
88
+ elsif const.respond_to?(:discriminator_attributes)
89
+ if const.discriminator_attributes.all? { |attr| data.key?(attr) }
90
+ model = const.build_from_hash(data)
91
+ end
92
+ else
93
+ # maybe it's an enum, or doens't have discriminators
94
+ model = const.build_from_hash(data)
95
+ end
96
+
97
+ return model if model
98
+ end
99
+ end
100
+
101
+ # if no match by now, raise
102
+ raise
103
+ rescue
104
+ raise SchemaMismatchError, "#{data} doesn't match the #{klass} type"
105
+ end
106
+ end
107
+ end
108
+ end
109
+ end
@@ -3,5 +3,5 @@
3
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
4
 
5
5
  module Algolia
6
- VERSION = "3.49.0"
6
+ VERSION = "3.51.0"
7
7
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: algolia
3
3
  version: !ruby/object:Gem::Version
4
- version: 3.49.0
4
+ version: 3.51.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - https://alg.li/support
@@ -179,6 +179,7 @@ files:
179
179
  - lib/algolia/models/abtesting-v3/metric_name.rb
180
180
  - lib/algolia/models/abtesting-v3/metric_result.rb
181
181
  - lib/algolia/models/abtesting-v3/metrics_filter.rb
182
+ - lib/algolia/models/abtesting-v3/metrics_filter_parameters.rb
182
183
  - lib/algolia/models/abtesting-v3/minimum_detectable_effect.rb
183
184
  - lib/algolia/models/abtesting-v3/outliers_filter.rb
184
185
  - lib/algolia/models/abtesting-v3/primary_metric.rb
@@ -822,12 +823,14 @@ files:
822
823
  - lib/algolia/models/recommend/exhaustive.rb
823
824
  - lib/algolia/models/recommend/facet_filters.rb
824
825
  - lib/algolia/models/recommend/facet_ordering.rb
826
+ - lib/algolia/models/recommend/facet_request_scope.rb
825
827
  - lib/algolia/models/recommend/facet_stats.rb
826
828
  - lib/algolia/models/recommend/fallback_params.rb
827
829
  - lib/algolia/models/recommend/fbt_model.rb
828
830
  - lib/algolia/models/recommend/get_recommend_task_response.rb
829
831
  - lib/algolia/models/recommend/get_recommendations_params.rb
830
832
  - lib/algolia/models/recommend/get_recommendations_response.rb
833
+ - lib/algolia/models/recommend/global_request_scope.rb
831
834
  - lib/algolia/models/recommend/hide_consequence_object.rb
832
835
  - lib/algolia/models/recommend/highlight_result.rb
833
836
  - lib/algolia/models/recommend/highlight_result_option.rb
@@ -865,6 +868,7 @@ files:
865
868
  - lib/algolia/models/recommend/remove_stop_words.rb
866
869
  - lib/algolia/models/recommend/remove_words_if_no_results.rb
867
870
  - lib/algolia/models/recommend/rendering_content.rb
871
+ - lib/algolia/models/recommend/request_scope.rb
868
872
  - lib/algolia/models/recommend/result_card.rb
869
873
  - lib/algolia/models/recommend/rule_metadata.rb
870
874
  - lib/algolia/models/recommend/search_recommend_rules_params.rb