algolia 3.24.0 → 3.25.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: 98922e2955f34bbd0985980254a793abbf9d850500ca599bb873cc8527ace278
4
- data.tar.gz: ffc863df89f0187c6d44fe1528e5d5bed7d1c1aa5b8249b9820a8849eab79579
3
+ metadata.gz: 1404975c1e5ba8114c39898c74721f95f8e5c20f9eb9d823c12257dff41808cc
4
+ data.tar.gz: 49e83567a7b8792318599f9615a3332aaa390a3a8796f2b8500d0c613df5338f
5
5
  SHA512:
6
- metadata.gz: f68ad7647ec8f2b8b07322bf3cd93e561c8f320d22f710885720a5b7d3af911316a37ffbe939632794a7c48a200d5e1a64a3b355be732394a98873424e04f8f5
7
- data.tar.gz: d520b06148c6b2229d38f1c4c9e2d94e6f5138e19b776e47b55b7eceaf43325262c815ffc54ce15efb44fae83adbdddcf70e169ecc7f917a63422590a9ba6dd6
6
+ metadata.gz: fd8fd30e11c95742f37123615223560666119959ad070b024a9aee73f9fca725fe0745d239900a7a4c85a37d5ab4050c16ffafe33eb16f23e4b6a15b4aaeaaa0
7
+ data.tar.gz: b2471b57a54330686b9fdf52e40f7999015d81e23befd8d712ec0f21f91c98e64f644ed22c3eb97e56f6cd6260002d484fadcafb7a5085273209f617976c12a1
data/CHANGELOG.md CHANGED
@@ -1,3 +1,11 @@
1
+ ## [3.25.0](https://github.com/algolia/algoliasearch-client-ruby/compare/3.24.0...3.25.0)
2
+
3
+ - [8f4abf3a1](https://github.com/algolia/api-clients-automation/commit/8f4abf3a1) fix(specs): Cross-reference filerPromotes to relevant guide ([#5279](https://github.com/algolia/api-clients-automation/pull/5279)) by [@gazconroy](https://github.com/gazconroy/)
4
+ - [1f4a3a9f7](https://github.com/algolia/api-clients-automation/commit/1f4a3a9f7) feat(specs): add put task endpoint to ingestion api ([#5281](https://github.com/algolia/api-clients-automation/pull/5281)) by [@shortcuts](https://github.com/shortcuts/)
5
+ - [08e9d1888](https://github.com/algolia/api-clients-automation/commit/08e9d1888) fix(specs): add getVersion parameter to getSettings ([#5254](https://github.com/algolia/api-clients-automation/pull/5254)) by [@millotp](https://github.com/millotp/)
6
+ - [f4eee1c4a](https://github.com/algolia/api-clients-automation/commit/f4eee1c4a) chore(website): exclude schema from generated variables file ([#5306](https://github.com/algolia/api-clients-automation/pull/5306)) by [@Fluf22](https://github.com/Fluf22/)
7
+ - [2fa0389f8](https://github.com/algolia/api-clients-automation/commit/2fa0389f8) fix(clients): link to support/help center on unreachable hosts ([#5305](https://github.com/algolia/api-clients-automation/pull/5305)) by [@shortcuts](https://github.com/shortcuts/)
8
+
1
9
  ## [3.24.0](https://github.com/algolia/algoliasearch-client-ruby/compare/3.23.0...3.24.0)
2
10
 
3
11
  - [48672036c1](https://github.com/algolia/api-clients-automation/commit/48672036c1) refactor(specs): mutualise code between Search API & Comp API for search query parameters ([#5125](https://github.com/algolia/api-clients-automation/pull/5125)) by [@ClaraMuller](https://github.com/ClaraMuller/)
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- algolia (3.24.0)
4
+ algolia (3.25.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)
@@ -2265,6 +2265,52 @@ module Algolia
2265
2265
  @api_client.deserialize(response.body, request_options[:debug_return_type] || "Ingestion::WatchResponse")
2266
2266
  end
2267
2267
 
2268
+ # Fully updates a task by its ID, use partialUpdateTask if you only want to update a subset of fields.
2269
+
2270
+ # @param task_id [String] Unique identifier of a task. (required)
2271
+ # @param task_replace [TaskReplace] (required)
2272
+ # @param request_options: The request options to send along with the query, they will be merged with the transporter base parameters (headers, query params, timeouts, etc.). (optional)
2273
+ # @return [Http::Response] the response
2274
+ def replace_task_with_http_info(task_id, task_replace, request_options = {})
2275
+ # verify the required parameter 'task_id' is set
2276
+ if @api_client.config.client_side_validation && task_id.nil?
2277
+ raise ArgumentError, "Parameter `task_id` is required when calling `replace_task`."
2278
+ end
2279
+ # verify the required parameter 'task_replace' is set
2280
+ if @api_client.config.client_side_validation && task_replace.nil?
2281
+ raise ArgumentError, "Parameter `task_replace` is required when calling `replace_task`."
2282
+ end
2283
+
2284
+ path = "/2/tasks/{taskID}".sub("{" + "taskID" + "}", Transport.encode_uri(task_id.to_s))
2285
+ query_params = {}
2286
+ query_params = query_params.merge(request_options[:query_params]) unless request_options[:query_params].nil?
2287
+ header_params = {}
2288
+ header_params = header_params.merge(request_options[:header_params]) unless request_options[:header_params].nil?
2289
+
2290
+ post_body = request_options[:debug_body] || @api_client.object_to_http_body(task_replace)
2291
+
2292
+ new_options = request_options.merge(
2293
+ :operation => :"IngestionClient.replace_task",
2294
+ :header_params => header_params,
2295
+ :query_params => query_params,
2296
+ :body => post_body,
2297
+ :use_read_transporter => false
2298
+ )
2299
+
2300
+ @api_client.call_api(:PUT, path, new_options)
2301
+ end
2302
+
2303
+ # Fully updates a task by its ID, use partialUpdateTask if you only want to update a subset of fields.
2304
+
2305
+ # @param task_id [String] Unique identifier of a task. (required)
2306
+ # @param task_replace [TaskReplace] (required)
2307
+ # @param request_options: The request options to send along with the query, they will be merged with the transporter base parameters (headers, query params, timeouts, etc.). (optional)
2308
+ # @return [TaskUpdateResponse]
2309
+ def replace_task(task_id, task_replace, request_options = {})
2310
+ response = replace_task_with_http_info(task_id, task_replace, request_options)
2311
+ @api_client.deserialize(response.body, request_options[:debug_return_type] || "Ingestion::TaskUpdateResponse")
2312
+ end
2313
+
2268
2314
  # Runs all tasks linked to a source, only available for Shopify, BigCommerce and commercetools sources. Creates one run per task.
2269
2315
  #
2270
2316
  # Required API Key ACLs:
@@ -3046,7 +3092,7 @@ module Algolia
3046
3092
  @api_client.deserialize(response.body, request_options[:debug_return_type] || "Ingestion::SourceUpdateResponse")
3047
3093
  end
3048
3094
 
3049
- # Updates a task by its ID.
3095
+ # Partially updates a task by its ID.
3050
3096
 
3051
3097
  # @param task_id [String] Unique identifier of a task. (required)
3052
3098
  # @param task_update [TaskUpdate] (required)
@@ -3081,7 +3127,7 @@ module Algolia
3081
3127
  @api_client.call_api(:PATCH, path, new_options)
3082
3128
  end
3083
3129
 
3084
- # Updates a task by its ID.
3130
+ # Partially updates a task by its ID.
3085
3131
 
3086
3132
  # @param task_id [String] Unique identifier of a task. (required)
3087
3133
  # @param task_update [TaskUpdate] (required)
@@ -1503,9 +1503,10 @@ module Algolia
1503
1503
  # Required API Key ACLs:
1504
1504
  # - settings
1505
1505
  # @param index_name [String] Name of the index on which to perform the operation. (required)
1506
+ # @param get_version [Integer] When set to 2, the endpoint will not include `synonyms` in the response. This parameter is here for backward compatibility. (default to 1)
1506
1507
  # @param request_options: The request options to send along with the query, they will be merged with the transporter base parameters (headers, query params, timeouts, etc.). (optional)
1507
1508
  # @return [Http::Response] the response
1508
- def get_settings_with_http_info(index_name, request_options = {})
1509
+ def get_settings_with_http_info(index_name, get_version = nil, request_options = {})
1509
1510
  # verify the required parameter 'index_name' is set
1510
1511
  if @api_client.config.client_side_validation && index_name.nil?
1511
1512
  raise ArgumentError, "Parameter `index_name` is required when calling `get_settings`."
@@ -1513,6 +1514,7 @@ module Algolia
1513
1514
 
1514
1515
  path = "/1/indexes/{indexName}/settings".sub("{" + "indexName" + "}", Transport.encode_uri(index_name.to_s))
1515
1516
  query_params = {}
1517
+ query_params[:getVersion] = get_version unless get_version.nil?
1516
1518
  query_params = query_params.merge(request_options[:query_params]) unless request_options[:query_params].nil?
1517
1519
  header_params = {}
1518
1520
  header_params = header_params.merge(request_options[:header_params]) unless request_options[:header_params].nil?
@@ -1535,10 +1537,11 @@ module Algolia
1535
1537
  # Required API Key ACLs:
1536
1538
  # - settings
1537
1539
  # @param index_name [String] Name of the index on which to perform the operation. (required)
1540
+ # @param get_version [Integer] When set to 2, the endpoint will not include `synonyms` in the response. This parameter is here for backward compatibility. (default to 1)
1538
1541
  # @param request_options: The request options to send along with the query, they will be merged with the transporter base parameters (headers, query params, timeouts, etc.). (optional)
1539
1542
  # @return [SettingsResponse]
1540
- def get_settings(index_name, request_options = {})
1541
- response = get_settings_with_http_info(index_name, request_options)
1543
+ def get_settings(index_name, get_version = nil, request_options = {})
1544
+ response = get_settings_with_http_info(index_name, get_version, request_options)
1542
1545
  @api_client.deserialize(response.body, request_options[:debug_return_type] || "Search::SettingsResponse")
1543
1546
  end
1544
1547
 
@@ -0,0 +1,212 @@
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 Composition
10
+ class ExternalInjectedItem
11
+ attr_accessor :items
12
+
13
+ # Attribute mapping from ruby-style variable name to JSON key.
14
+ def self.attribute_map
15
+ {
16
+ :items => :items
17
+ }
18
+ end
19
+
20
+ # Attribute type mapping.
21
+ def self.types_mapping
22
+ {
23
+ :items => :"Array<ExternalInjection>"
24
+ }
25
+ end
26
+
27
+ # List of attributes with nullable: true
28
+ def self.openapi_nullable
29
+ Set.new(
30
+ []
31
+ )
32
+ end
33
+
34
+ # Initializes the object
35
+ # @param [Hash] attributes Model attributes in the form of hash
36
+ def initialize(attributes = {})
37
+ if (!attributes.is_a?(Hash))
38
+ raise(
39
+ ArgumentError,
40
+ "The input argument (attributes) must be a hash in `Algolia::ExternalInjectedItem` initialize method"
41
+ )
42
+ end
43
+
44
+ # check to see if the attribute exists and convert string to symbol for hash key
45
+ attributes = attributes.each_with_object({}) { |(k, v), h|
46
+ if (!self.class.attribute_map.key?(k.to_sym))
47
+ raise(
48
+ ArgumentError,
49
+ "`#{k}` is not a valid attribute in `Algolia::ExternalInjectedItem`. Please check the name to make sure it's valid. List of attributes: " +
50
+ self.class.attribute_map.keys.inspect
51
+ )
52
+ end
53
+
54
+ h[k.to_sym] = v
55
+ }
56
+
57
+ if attributes.key?(:items)
58
+ if (value = attributes[:items]).is_a?(Array)
59
+ self.items = value
60
+ end
61
+ else
62
+ self.items = nil
63
+ end
64
+ end
65
+
66
+ # Checks equality by comparing each attribute.
67
+ # @param [Object] Object to be compared
68
+ def ==(other)
69
+ return true if self.equal?(other)
70
+ self.class == other.class &&
71
+ items == other.items
72
+ end
73
+
74
+ # @see the `==` method
75
+ # @param [Object] Object to be compared
76
+ def eql?(other)
77
+ self == other
78
+ end
79
+
80
+ # Calculates hash code according to all attributes.
81
+ # @return [Integer] Hash code
82
+ def hash
83
+ [items].hash
84
+ end
85
+
86
+ # Builds the object from hash
87
+ # @param [Hash] attributes Model attributes in the form of hash
88
+ # @return [Object] Returns the model itself
89
+ def self.build_from_hash(attributes)
90
+ return nil unless attributes.is_a?(Hash)
91
+ attributes = attributes.transform_keys(&:to_sym)
92
+ transformed_hash = {}
93
+ types_mapping.each_pair do |key, type|
94
+ if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil?
95
+ transformed_hash[key.to_sym] = nil
96
+ elsif type =~ /\AArray<(.*)>/i
97
+ # check to ensure the input is an array given that the attribute
98
+ # is documented as an array but the input is not
99
+ if attributes[attribute_map[key]].is_a?(Array)
100
+ transformed_hash[key.to_sym] = attributes[attribute_map[key]].map { |v|
101
+ _deserialize(::Regexp.last_match(1), v)
102
+ }
103
+ end
104
+ elsif !attributes[attribute_map[key]].nil?
105
+ transformed_hash[key.to_sym] = _deserialize(type, attributes[attribute_map[key]])
106
+ end
107
+ end
108
+
109
+ new(transformed_hash)
110
+ end
111
+
112
+ # Deserializes the data based on type
113
+ # @param string type Data type
114
+ # @param string value Value to be deserialized
115
+ # @return [Object] Deserialized data
116
+ def self._deserialize(type, value)
117
+ case type.to_sym
118
+ when :Time
119
+ Time.parse(value)
120
+ when :Date
121
+ Date.parse(value)
122
+ when :String
123
+ value.to_s
124
+ when :Integer
125
+ value.to_i
126
+ when :Float
127
+ value.to_f
128
+ when :Boolean
129
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
130
+ true
131
+ else
132
+ false
133
+ end
134
+
135
+ when :Object
136
+ # generic object (usually a Hash), return directly
137
+ value
138
+ when /\AArray<(?<inner_type>.+)>\z/
139
+ inner_type = Regexp.last_match[:inner_type]
140
+ value.map { |v| _deserialize(inner_type, v) }
141
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
142
+ k_type = Regexp.last_match[:k_type]
143
+ v_type = Regexp.last_match[:v_type]
144
+ {}.tap do |hash|
145
+ value.each do |k, v|
146
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
147
+ end
148
+ end
149
+ # model
150
+ else
151
+ # models (e.g. Pet) or oneOf
152
+ klass = Algolia::Composition.const_get(type)
153
+ klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass
154
+ .build_from_hash(value)
155
+ end
156
+ end
157
+
158
+ # Returns the string representation of the object
159
+ # @return [String] String presentation of the object
160
+ def to_s
161
+ to_hash.to_s
162
+ end
163
+
164
+ # to_body is an alias to to_hash (backward compatibility)
165
+ # @return [Hash] Returns the object in the form of hash
166
+ def to_body
167
+ to_hash
168
+ end
169
+
170
+ def to_json(*_args)
171
+ to_hash.to_json
172
+ end
173
+
174
+ # Returns the object in the form of hash
175
+ # @return [Hash] Returns the object in the form of hash
176
+ def to_hash
177
+ hash = {}
178
+ self.class.attribute_map.each_pair do |attr, param|
179
+ value = send(attr)
180
+ if value.nil?
181
+ is_nullable = self.class.openapi_nullable.include?(attr)
182
+ next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
183
+ end
184
+
185
+ hash[param] = _to_hash(value)
186
+ end
187
+
188
+ hash
189
+ end
190
+
191
+ # Outputs non-array value in the form of hash
192
+ # For object, use to_hash. Otherwise, just return the value
193
+ # @param [Object] value Any valid value
194
+ # @return [Hash] Returns the value in the form of hash
195
+ def _to_hash(value)
196
+ if value.is_a?(Array)
197
+ value.compact.map { |v| _to_hash(v) }
198
+ elsif value.is_a?(Hash)
199
+ {}.tap do |hash|
200
+ value.each { |k, v| hash[k] = _to_hash(v) }
201
+ end
202
+ elsif value.respond_to?(:to_hash)
203
+ value.to_hash
204
+ else
205
+ value
206
+ end
207
+ end
208
+
209
+ end
210
+
211
+ end
212
+ end
@@ -0,0 +1,223 @@
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 Composition
10
+ class ExternalInjection
11
+ # An objectID injected into an external source.
12
+ attr_accessor :algolia_object_id
13
+
14
+ # User-defined key-values that will be added to the injected item in the response. This is identical to Hits metadata defined in Composition or Composition Rule, with the benefit of being set at runtime.
15
+ attr_accessor :metadata
16
+
17
+ # Attribute mapping from ruby-style variable name to JSON key.
18
+ def self.attribute_map
19
+ {
20
+ :algolia_object_id => :objectID,
21
+ :metadata => :metadata
22
+ }
23
+ end
24
+
25
+ # Attribute type mapping.
26
+ def self.types_mapping
27
+ {
28
+ :algolia_object_id => :"String",
29
+ :metadata => :"Hash<String, Object>"
30
+ }
31
+ end
32
+
33
+ # List of attributes with nullable: true
34
+ def self.openapi_nullable
35
+ Set.new(
36
+ []
37
+ )
38
+ end
39
+
40
+ # Initializes the object
41
+ # @param [Hash] attributes Model attributes in the form of hash
42
+ def initialize(attributes = {})
43
+ if (!attributes.is_a?(Hash))
44
+ raise(
45
+ ArgumentError,
46
+ "The input argument (attributes) must be a hash in `Algolia::ExternalInjection` initialize method"
47
+ )
48
+ end
49
+
50
+ # check to see if the attribute exists and convert string to symbol for hash key
51
+ attributes = attributes.each_with_object({}) { |(k, v), h|
52
+ if (!self.class.attribute_map.key?(k.to_sym))
53
+ raise(
54
+ ArgumentError,
55
+ "`#{k}` is not a valid attribute in `Algolia::ExternalInjection`. Please check the name to make sure it's valid. List of attributes: " +
56
+ self.class.attribute_map.keys.inspect
57
+ )
58
+ end
59
+
60
+ h[k.to_sym] = v
61
+ }
62
+
63
+ if attributes.key?(:algolia_object_id)
64
+ self.algolia_object_id = attributes[:algolia_object_id]
65
+ else
66
+ self.algolia_object_id = nil
67
+ end
68
+
69
+ if attributes.key?(:metadata)
70
+ if (value = attributes[:metadata]).is_a?(Hash)
71
+ self.metadata = value
72
+ end
73
+ end
74
+ end
75
+
76
+ # Checks equality by comparing each attribute.
77
+ # @param [Object] Object to be compared
78
+ def ==(other)
79
+ return true if self.equal?(other)
80
+ self.class == other.class &&
81
+ algolia_object_id == other.algolia_object_id &&
82
+ metadata == other.metadata
83
+ end
84
+
85
+ # @see the `==` method
86
+ # @param [Object] Object to be compared
87
+ def eql?(other)
88
+ self == other
89
+ end
90
+
91
+ # Calculates hash code according to all attributes.
92
+ # @return [Integer] Hash code
93
+ def hash
94
+ [algolia_object_id, metadata].hash
95
+ end
96
+
97
+ # Builds the object from hash
98
+ # @param [Hash] attributes Model attributes in the form of hash
99
+ # @return [Object] Returns the model itself
100
+ def self.build_from_hash(attributes)
101
+ return nil unless attributes.is_a?(Hash)
102
+ attributes = attributes.transform_keys(&:to_sym)
103
+ transformed_hash = {}
104
+ types_mapping.each_pair do |key, type|
105
+ if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil?
106
+ transformed_hash[key.to_sym] = nil
107
+ elsif type =~ /\AArray<(.*)>/i
108
+ # check to ensure the input is an array given that the attribute
109
+ # is documented as an array but the input is not
110
+ if attributes[attribute_map[key]].is_a?(Array)
111
+ transformed_hash[key.to_sym] = attributes[attribute_map[key]].map { |v|
112
+ _deserialize(::Regexp.last_match(1), v)
113
+ }
114
+ end
115
+ elsif !attributes[attribute_map[key]].nil?
116
+ transformed_hash[key.to_sym] = _deserialize(type, attributes[attribute_map[key]])
117
+ end
118
+ end
119
+
120
+ new(transformed_hash)
121
+ end
122
+
123
+ # Deserializes the data based on type
124
+ # @param string type Data type
125
+ # @param string value Value to be deserialized
126
+ # @return [Object] Deserialized data
127
+ def self._deserialize(type, value)
128
+ case type.to_sym
129
+ when :Time
130
+ Time.parse(value)
131
+ when :Date
132
+ Date.parse(value)
133
+ when :String
134
+ value.to_s
135
+ when :Integer
136
+ value.to_i
137
+ when :Float
138
+ value.to_f
139
+ when :Boolean
140
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
141
+ true
142
+ else
143
+ false
144
+ end
145
+
146
+ when :Object
147
+ # generic object (usually a Hash), return directly
148
+ value
149
+ when /\AArray<(?<inner_type>.+)>\z/
150
+ inner_type = Regexp.last_match[:inner_type]
151
+ value.map { |v| _deserialize(inner_type, v) }
152
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
153
+ k_type = Regexp.last_match[:k_type]
154
+ v_type = Regexp.last_match[:v_type]
155
+ {}.tap do |hash|
156
+ value.each do |k, v|
157
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
158
+ end
159
+ end
160
+ # model
161
+ else
162
+ # models (e.g. Pet) or oneOf
163
+ klass = Algolia::Composition.const_get(type)
164
+ klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass
165
+ .build_from_hash(value)
166
+ end
167
+ end
168
+
169
+ # Returns the string representation of the object
170
+ # @return [String] String presentation of the object
171
+ def to_s
172
+ to_hash.to_s
173
+ end
174
+
175
+ # to_body is an alias to to_hash (backward compatibility)
176
+ # @return [Hash] Returns the object in the form of hash
177
+ def to_body
178
+ to_hash
179
+ end
180
+
181
+ def to_json(*_args)
182
+ to_hash.to_json
183
+ end
184
+
185
+ # Returns the object in the form of hash
186
+ # @return [Hash] Returns the object in the form of hash
187
+ def to_hash
188
+ hash = {}
189
+ self.class.attribute_map.each_pair do |attr, param|
190
+ value = send(attr)
191
+ if value.nil?
192
+ is_nullable = self.class.openapi_nullable.include?(attr)
193
+ next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
194
+ end
195
+
196
+ hash[param] = _to_hash(value)
197
+ end
198
+
199
+ hash
200
+ end
201
+
202
+ # Outputs non-array value in the form of hash
203
+ # For object, use to_hash. Otherwise, just return the value
204
+ # @param [Object] value Any valid value
205
+ # @return [Hash] Returns the value in the form of hash
206
+ def _to_hash(value)
207
+ if value.is_a?(Array)
208
+ value.compact.map { |v| _to_hash(v) }
209
+ elsif value.is_a?(Hash)
210
+ {}.tap do |hash|
211
+ value.each { |k, v| hash[k] = _to_hash(v) }
212
+ end
213
+ elsif value.respond_to?(:to_hash)
214
+ value.to_hash
215
+ else
216
+ value
217
+ end
218
+ end
219
+
220
+ end
221
+
222
+ end
223
+ end
@@ -80,6 +80,9 @@ module Algolia
80
80
  # Whether this search will use [Dynamic Re-Ranking](https://www.algolia.com/doc/guides/algolia-ai/re-ranking/) This setting only has an effect if you activated Dynamic Re-Ranking for this index in the Algolia dashboard.
81
81
  attr_accessor :enable_re_ranking
82
82
 
83
+ # A list of extenrally injected objectID groups into from an external source.
84
+ attr_accessor :injected_items
85
+
83
86
  # Attribute mapping from ruby-style variable name to JSON key.
84
87
  def self.attribute_map
85
88
  {
@@ -108,7 +111,8 @@ module Algolia
108
111
  :analytics => :analytics,
109
112
  :analytics_tags => :analyticsTags,
110
113
  :enable_ab_test => :enableABTest,
111
- :enable_re_ranking => :enableReRanking
114
+ :enable_re_ranking => :enableReRanking,
115
+ :injected_items => :injectedItems
112
116
  }
113
117
  end
114
118
 
@@ -140,7 +144,8 @@ module Algolia
140
144
  :analytics => :"Boolean",
141
145
  :analytics_tags => :"Array<String>",
142
146
  :enable_ab_test => :"Boolean",
143
- :enable_re_ranking => :"Boolean"
147
+ :enable_re_ranking => :"Boolean",
148
+ :injected_items => :"Hash<String, ExternalInjectedItem>"
144
149
  }
145
150
  end
146
151
 
@@ -286,6 +291,12 @@ module Algolia
286
291
  if attributes.key?(:enable_re_ranking)
287
292
  self.enable_re_ranking = attributes[:enable_re_ranking]
288
293
  end
294
+
295
+ if attributes.key?(:injected_items)
296
+ if (value = attributes[:injected_items]).is_a?(Hash)
297
+ self.injected_items = value
298
+ end
299
+ end
289
300
  end
290
301
 
291
302
  # Checks equality by comparing each attribute.
@@ -318,7 +329,8 @@ module Algolia
318
329
  analytics == other.analytics &&
319
330
  analytics_tags == other.analytics_tags &&
320
331
  enable_ab_test == other.enable_ab_test &&
321
- enable_re_ranking == other.enable_re_ranking
332
+ enable_re_ranking == other.enable_re_ranking &&
333
+ injected_items == other.injected_items
322
334
  end
323
335
 
324
336
  # @see the `==` method
@@ -356,7 +368,8 @@ module Algolia
356
368
  analytics,
357
369
  analytics_tags,
358
370
  enable_ab_test,
359
- enable_re_ranking
371
+ enable_re_ranking,
372
+ injected_items
360
373
  ].hash
361
374
  end
362
375
 
@@ -0,0 +1,310 @@
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 Ingestion
10
+ # API request body for updating a task.
11
+ class TaskReplace
12
+ # Universally unique identifier (UUID) of a destination resource.
13
+ attr_accessor :destination_id
14
+
15
+ attr_accessor :action
16
+
17
+ attr_accessor :subscription_action
18
+
19
+ # Cron expression for the task's schedule.
20
+ attr_accessor :cron
21
+
22
+ # Whether the task is enabled.
23
+ attr_accessor :enabled
24
+
25
+ # Maximum accepted percentage of failures for a task run to finish successfully.
26
+ attr_accessor :failure_threshold
27
+
28
+ attr_accessor :input
29
+
30
+ # Date of the last cursor in RFC 3339 format.
31
+ attr_accessor :cursor
32
+
33
+ attr_accessor :notifications
34
+
35
+ attr_accessor :policies
36
+
37
+ # Attribute mapping from ruby-style variable name to JSON key.
38
+ def self.attribute_map
39
+ {
40
+ :destination_id => :destinationID,
41
+ :action => :action,
42
+ :subscription_action => :subscriptionAction,
43
+ :cron => :cron,
44
+ :enabled => :enabled,
45
+ :failure_threshold => :failureThreshold,
46
+ :input => :input,
47
+ :cursor => :cursor,
48
+ :notifications => :notifications,
49
+ :policies => :policies
50
+ }
51
+ end
52
+
53
+ # Attribute type mapping.
54
+ def self.types_mapping
55
+ {
56
+ :destination_id => :"String",
57
+ :action => :"ActionType",
58
+ :subscription_action => :"ActionType",
59
+ :cron => :"String",
60
+ :enabled => :"Boolean",
61
+ :failure_threshold => :"Integer",
62
+ :input => :"TaskInput",
63
+ :cursor => :"String",
64
+ :notifications => :"Notifications",
65
+ :policies => :"Policies"
66
+ }
67
+ end
68
+
69
+ # List of attributes with nullable: true
70
+ def self.openapi_nullable
71
+ Set.new(
72
+ []
73
+ )
74
+ end
75
+
76
+ # Initializes the object
77
+ # @param [Hash] attributes Model attributes in the form of hash
78
+ def initialize(attributes = {})
79
+ if (!attributes.is_a?(Hash))
80
+ raise(
81
+ ArgumentError,
82
+ "The input argument (attributes) must be a hash in `Algolia::TaskReplace` initialize method"
83
+ )
84
+ end
85
+
86
+ # check to see if the attribute exists and convert string to symbol for hash key
87
+ attributes = attributes.each_with_object({}) { |(k, v), h|
88
+ if (!self.class.attribute_map.key?(k.to_sym))
89
+ raise(
90
+ ArgumentError,
91
+ "`#{k}` is not a valid attribute in `Algolia::TaskReplace`. Please check the name to make sure it's valid. List of attributes: " +
92
+ self.class.attribute_map.keys.inspect
93
+ )
94
+ end
95
+
96
+ h[k.to_sym] = v
97
+ }
98
+
99
+ if attributes.key?(:destination_id)
100
+ self.destination_id = attributes[:destination_id]
101
+ else
102
+ self.destination_id = nil
103
+ end
104
+
105
+ if attributes.key?(:action)
106
+ self.action = attributes[:action]
107
+ else
108
+ self.action = nil
109
+ end
110
+
111
+ if attributes.key?(:subscription_action)
112
+ self.subscription_action = attributes[:subscription_action]
113
+ end
114
+
115
+ if attributes.key?(:cron)
116
+ self.cron = attributes[:cron]
117
+ end
118
+
119
+ if attributes.key?(:enabled)
120
+ self.enabled = attributes[:enabled]
121
+ end
122
+
123
+ if attributes.key?(:failure_threshold)
124
+ self.failure_threshold = attributes[:failure_threshold]
125
+ end
126
+
127
+ if attributes.key?(:input)
128
+ self.input = attributes[:input]
129
+ end
130
+
131
+ if attributes.key?(:cursor)
132
+ self.cursor = attributes[:cursor]
133
+ end
134
+
135
+ if attributes.key?(:notifications)
136
+ self.notifications = attributes[:notifications]
137
+ end
138
+
139
+ if attributes.key?(:policies)
140
+ self.policies = attributes[:policies]
141
+ end
142
+ end
143
+
144
+ # Checks equality by comparing each attribute.
145
+ # @param [Object] Object to be compared
146
+ def ==(other)
147
+ return true if self.equal?(other)
148
+ self.class == other.class &&
149
+ destination_id == other.destination_id &&
150
+ action == other.action &&
151
+ subscription_action == other.subscription_action &&
152
+ cron == other.cron &&
153
+ enabled == other.enabled &&
154
+ failure_threshold == other.failure_threshold &&
155
+ input == other.input &&
156
+ cursor == other.cursor &&
157
+ notifications == other.notifications &&
158
+ policies == other.policies
159
+ end
160
+
161
+ # @see the `==` method
162
+ # @param [Object] Object to be compared
163
+ def eql?(other)
164
+ self == other
165
+ end
166
+
167
+ # Calculates hash code according to all attributes.
168
+ # @return [Integer] Hash code
169
+ def hash
170
+ [
171
+ destination_id,
172
+ action,
173
+ subscription_action,
174
+ cron,
175
+ enabled,
176
+ failure_threshold,
177
+ input,
178
+ cursor,
179
+ notifications,
180
+ policies
181
+ ].hash
182
+ end
183
+
184
+ # Builds the object from hash
185
+ # @param [Hash] attributes Model attributes in the form of hash
186
+ # @return [Object] Returns the model itself
187
+ def self.build_from_hash(attributes)
188
+ return nil unless attributes.is_a?(Hash)
189
+ attributes = attributes.transform_keys(&:to_sym)
190
+ transformed_hash = {}
191
+ types_mapping.each_pair do |key, type|
192
+ if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil?
193
+ transformed_hash[key.to_sym] = nil
194
+ elsif type =~ /\AArray<(.*)>/i
195
+ # check to ensure the input is an array given that the attribute
196
+ # is documented as an array but the input is not
197
+ if attributes[attribute_map[key]].is_a?(Array)
198
+ transformed_hash[key.to_sym] = attributes[attribute_map[key]].map { |v|
199
+ _deserialize(::Regexp.last_match(1), v)
200
+ }
201
+ end
202
+ elsif !attributes[attribute_map[key]].nil?
203
+ transformed_hash[key.to_sym] = _deserialize(type, attributes[attribute_map[key]])
204
+ end
205
+ end
206
+
207
+ new(transformed_hash)
208
+ end
209
+
210
+ # Deserializes the data based on type
211
+ # @param string type Data type
212
+ # @param string value Value to be deserialized
213
+ # @return [Object] Deserialized data
214
+ def self._deserialize(type, value)
215
+ case type.to_sym
216
+ when :Time
217
+ Time.parse(value)
218
+ when :Date
219
+ Date.parse(value)
220
+ when :String
221
+ value.to_s
222
+ when :Integer
223
+ value.to_i
224
+ when :Float
225
+ value.to_f
226
+ when :Boolean
227
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
228
+ true
229
+ else
230
+ false
231
+ end
232
+
233
+ when :Object
234
+ # generic object (usually a Hash), return directly
235
+ value
236
+ when /\AArray<(?<inner_type>.+)>\z/
237
+ inner_type = Regexp.last_match[:inner_type]
238
+ value.map { |v| _deserialize(inner_type, v) }
239
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
240
+ k_type = Regexp.last_match[:k_type]
241
+ v_type = Regexp.last_match[:v_type]
242
+ {}.tap do |hash|
243
+ value.each do |k, v|
244
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
245
+ end
246
+ end
247
+ # model
248
+ else
249
+ # models (e.g. Pet) or oneOf
250
+ klass = Algolia::Ingestion.const_get(type)
251
+ klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass
252
+ .build_from_hash(value)
253
+ end
254
+ end
255
+
256
+ # Returns the string representation of the object
257
+ # @return [String] String presentation of the object
258
+ def to_s
259
+ to_hash.to_s
260
+ end
261
+
262
+ # to_body is an alias to to_hash (backward compatibility)
263
+ # @return [Hash] Returns the object in the form of hash
264
+ def to_body
265
+ to_hash
266
+ end
267
+
268
+ def to_json(*_args)
269
+ to_hash.to_json
270
+ end
271
+
272
+ # Returns the object in the form of hash
273
+ # @return [Hash] Returns the object in the form of hash
274
+ def to_hash
275
+ hash = {}
276
+ self.class.attribute_map.each_pair do |attr, param|
277
+ value = send(attr)
278
+ if value.nil?
279
+ is_nullable = self.class.openapi_nullable.include?(attr)
280
+ next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
281
+ end
282
+
283
+ hash[param] = _to_hash(value)
284
+ end
285
+
286
+ hash
287
+ end
288
+
289
+ # Outputs non-array value in the form of hash
290
+ # For object, use to_hash. Otherwise, just return the value
291
+ # @param [Object] value Any valid value
292
+ # @return [Hash] Returns the value in the form of hash
293
+ def _to_hash(value)
294
+ if value.is_a?(Array)
295
+ value.compact.map { |v| _to_hash(v) }
296
+ elsif value.is_a?(Hash)
297
+ {}.tap do |hash|
298
+ value.each { |k, v| hash[k] = _to_hash(v) }
299
+ end
300
+ elsif value.respond_to?(:to_hash)
301
+ value.to_hash
302
+ else
303
+ value
304
+ end
305
+ end
306
+
307
+ end
308
+
309
+ end
310
+ end
@@ -7,7 +7,7 @@ require "time"
7
7
 
8
8
  module Algolia
9
9
  module Ingestion
10
- # API request body for updating a task.
10
+ # API request body for partially updating a task.
11
11
  class TaskUpdate
12
12
  # Universally unique identifier (UUID) of a destination resource.
13
13
  attr_accessor :destination_id
@@ -14,7 +14,7 @@ module Algolia
14
14
  # Records you want to pin to a specific position in the search results. You can promote up to 300 records, either individually, or as groups of up to 100 records each.
15
15
  attr_accessor :promote
16
16
 
17
- # Whether promoted records must match an active filter for the consequence to be applied. This ensures that user actions (filtering the search) are given a higher precendence. For example, if you promote a record with the `color: red` attribute, and the user filters the search for `color: blue`, the \"red\" record won't be shown.
17
+ # Determines whether promoted records must also match active filters for the consequence to apply. This ensures user-applied filters take priority and irrelevant matches aren't shown. For example, if you promote a record with `color: red` but the user filters for `color: blue`, the \"red\" record won't be shown. > In the Algolia dashboard, when you use the **Pin an item** consequence, `filterPromotes` appears as the checkbox: **Pinned items must match active filters to be displayed.** For examples, see [Promote results with rules](https://www.algolia.com/doc/guides/managing-results/rules/merchandising-and-promoting/how-to/promote-hits/#promote-results-matching-active-filters).
18
18
  attr_accessor :filter_promotes
19
19
 
20
20
  # Records you want to hide from the search results.
@@ -85,7 +85,12 @@ module Algolia
85
85
  end
86
86
  end
87
87
 
88
- raise Algolia::AlgoliaUnreachableHostError.new("Unreachable hosts.", retry_errors)
88
+ raise(
89
+ Algolia::AlgoliaUnreachableHostError.new(
90
+ "Unreachable hosts. If the error persists, please visit our help center https://alg.li/support-unreachable-hosts or reach out to the Algolia Support team: https://alg.li/support",
91
+ retry_errors
92
+ )
93
+ )
89
94
  end
90
95
 
91
96
  private
@@ -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.24.0"
6
+ VERSION = "3.25.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.24.0
4
+ version: 3.25.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - https://alg.li/support
@@ -270,6 +270,8 @@ files:
270
270
  - lib/algolia/models/composition/compositions_search_response.rb
271
271
  - lib/algolia/models/composition/error_base.rb
272
272
  - lib/algolia/models/composition/exhaustive.rb
273
+ - lib/algolia/models/composition/external_injected_item.rb
274
+ - lib/algolia/models/composition/external_injection.rb
273
275
  - lib/algolia/models/composition/facet_filters.rb
274
276
  - lib/algolia/models/composition/facet_hits.rb
275
277
  - lib/algolia/models/composition/facet_ordering.rb
@@ -433,6 +435,7 @@ files:
433
435
  - lib/algolia/models/ingestion/task_create_trigger.rb
434
436
  - lib/algolia/models/ingestion/task_create_v1.rb
435
437
  - lib/algolia/models/ingestion/task_input.rb
438
+ - lib/algolia/models/ingestion/task_replace.rb
436
439
  - lib/algolia/models/ingestion/task_search.rb
437
440
  - lib/algolia/models/ingestion/task_sort_keys.rb
438
441
  - lib/algolia/models/ingestion/task_update.rb