algolia 3.38.0 → 3.39.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 +4 -4
- data/CHANGELOG.md +6 -0
- data/Gemfile.lock +1 -1
- data/lib/algolia/api/search_client.rb +4 -4
- data/lib/algolia/models/composition/external_injected_item.rb +1 -0
- data/lib/algolia/models/composition/external_injection.rb +1 -1
- data/lib/algolia/models/composition/params.rb +1 -1
- data/lib/algolia/models/composition/request_body.rb +16 -4
- data/lib/algolia/models/ingestion/source_algolia_index.rb +227 -0
- data/lib/algolia/models/ingestion/source_input.rb +1 -0
- data/lib/algolia/models/ingestion/source_type.rb +13 -1
- data/lib/algolia/models/ingestion/source_update_algolia_index.rb +218 -0
- data/lib/algolia/models/ingestion/source_update_input.rb +1 -0
- data/lib/algolia/version.rb +1 -1
- metadata +3 -1
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 9af30b133648ba77c97995f139a563fd7a49766f0b6b6ccb7950686c2dddf1e9
|
|
4
|
+
data.tar.gz: 8c29863a7d1d74733008fbf3a9fed5ad6f3f69a24e87a5fd7530ccece272cf23
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 9acd1cdfaf66c07771e1e6bde51971db0ef2c0a7b6752d1e28e5b18483c53a8ec98f08bb0b71f7e88ab54daf19fe7d85c2817b937ce3243941001d1a2977c35d
|
|
7
|
+
data.tar.gz: 2f210ee7a66db3afa0a30223847b9515fe9e53717a1a51be6e988bbf39e9f3d1f4153d899bf024621c3c5ca0d0caf70e25edb0049c23e02b6e3a708d352f02b0
|
data/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,9 @@
|
|
|
1
|
+
## [3.39.0](https://github.com/algolia/algoliasearch-client-ruby/compare/3.38.0...3.39.0)
|
|
2
|
+
|
|
3
|
+
- [d275af4e18](https://github.com/algolia/api-clients-automation/commit/d275af4e18) feat(specs): add Algolia Index as a native connector in ingestion client ([#6290](https://github.com/algolia/api-clients-automation/pull/6290)) by [@morganleroi](https://github.com/morganleroi/)
|
|
4
|
+
- [74e91c1cd3](https://github.com/algolia/api-clients-automation/commit/74e91c1cd3) fix(specs): compostion run payload example for external injected items ([#6291](https://github.com/algolia/api-clients-automation/pull/6291)) by [@gavinwade12](https://github.com/gavinwade12/)
|
|
5
|
+
- [a98b7f7cd8](https://github.com/algolia/api-clients-automation/commit/a98b7f7cd8) feat(specs): add feedsOrder to composition run params ([#6314](https://github.com/algolia/api-clients-automation/pull/6314)) by [@gavinwade12](https://github.com/gavinwade12/)
|
|
6
|
+
|
|
1
7
|
## [3.38.0](https://github.com/algolia/algoliasearch-client-ruby/compare/3.37.1...3.38.0)
|
|
2
8
|
|
|
3
9
|
BREAKING CHANGES: this minor version includes breaking changes in the Composition API. See below for more details.
|
data/Gemfile.lock
CHANGED
|
@@ -2618,11 +2618,11 @@ module Algolia
|
|
|
2618
2618
|
@api_client.deserialize(response.body, request_options[:debug_return_type] || "Search::UpdatedAtResponse")
|
|
2619
2619
|
end
|
|
2620
2620
|
|
|
2621
|
-
#
|
|
2621
|
+
# Runs multiple search queries against one or more indices in a single API request. Use cases include: - Searching different indices, such as products and marketing content. - Run multiple queries on the same index with different parameters or filters. If you know the expected result type, use the `searchForHits` or `searchForFacets` helper to simplify the response format.
|
|
2622
2622
|
#
|
|
2623
2623
|
# Required API Key ACLs:
|
|
2624
2624
|
# - search
|
|
2625
|
-
# @param search_method_params [SearchMethodParams]
|
|
2625
|
+
# @param search_method_params [SearchMethodParams] Multi-query search request body. Results are returned in the same order as the requests. (required)
|
|
2626
2626
|
# @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)
|
|
2627
2627
|
# @return [Http::Response] the response
|
|
2628
2628
|
def search_with_http_info(search_method_params, request_options = {})
|
|
@@ -2650,11 +2650,11 @@ module Algolia
|
|
|
2650
2650
|
@api_client.call_api(:POST, path, new_options)
|
|
2651
2651
|
end
|
|
2652
2652
|
|
|
2653
|
-
#
|
|
2653
|
+
# Runs multiple search queries against one or more indices in a single API request. Use cases include: - Searching different indices, such as products and marketing content. - Run multiple queries on the same index with different parameters or filters. If you know the expected result type, use the `searchForHits` or `searchForFacets` helper to simplify the response format.
|
|
2654
2654
|
#
|
|
2655
2655
|
# Required API Key ACLs:
|
|
2656
2656
|
# - search
|
|
2657
|
-
# @param search_method_params [SearchMethodParams]
|
|
2657
|
+
# @param search_method_params [SearchMethodParams] Multi-query search request body. Results are returned in the same order as the requests. (required)
|
|
2658
2658
|
# @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)
|
|
2659
2659
|
# @return [SearchResponses]
|
|
2660
2660
|
def search(search_method_params, request_options = {})
|
|
@@ -8,7 +8,7 @@ require "time"
|
|
|
8
8
|
module Algolia
|
|
9
9
|
module Composition
|
|
10
10
|
class ExternalInjection
|
|
11
|
-
# An objectID injected
|
|
11
|
+
# An objectID injected from an external source and also present in the targeted index.
|
|
12
12
|
attr_accessor :algolia_object_id
|
|
13
13
|
|
|
14
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.
|
|
@@ -53,7 +53,7 @@ module Algolia
|
|
|
53
53
|
# Number of hits per page.
|
|
54
54
|
attr_accessor :hits_per_page
|
|
55
55
|
|
|
56
|
-
#
|
|
56
|
+
# An object containing keys corresponding to the `key`s from an injection's `injectedItems` and values containing a list of hits to inject.
|
|
57
57
|
attr_accessor :injected_items
|
|
58
58
|
|
|
59
59
|
attr_accessor :inside_bounding_box
|
|
@@ -10,17 +10,22 @@ module Algolia
|
|
|
10
10
|
class RequestBody
|
|
11
11
|
attr_accessor :params
|
|
12
12
|
|
|
13
|
+
# A list of Feed IDs that specifies the order in which to order the results in the response. The IDs should be a subset of those in the `feeds` object of the targeted `multifeed` Composition / Composition Rule, and only those specified will be processed. The value overrides the value in the defined behavior, and when unspecified, the value defined in the behavior is used. When neither value is present, all feeds are processed.
|
|
14
|
+
attr_accessor :feeds_order
|
|
15
|
+
|
|
13
16
|
# Attribute mapping from ruby-style variable name to JSON key.
|
|
14
17
|
def self.attribute_map
|
|
15
18
|
{
|
|
16
|
-
:params => :params
|
|
19
|
+
:params => :params,
|
|
20
|
+
:feeds_order => :feedsOrder
|
|
17
21
|
}
|
|
18
22
|
end
|
|
19
23
|
|
|
20
24
|
# Attribute type mapping.
|
|
21
25
|
def self.types_mapping
|
|
22
26
|
{
|
|
23
|
-
:params => :"Params"
|
|
27
|
+
:params => :"Params",
|
|
28
|
+
:feeds_order => :"Array<String>"
|
|
24
29
|
}
|
|
25
30
|
end
|
|
26
31
|
|
|
@@ -57,6 +62,12 @@ module Algolia
|
|
|
57
62
|
if attributes.key?(:params)
|
|
58
63
|
self.params = attributes[:params]
|
|
59
64
|
end
|
|
65
|
+
|
|
66
|
+
if attributes.key?(:feeds_order)
|
|
67
|
+
if (value = attributes[:feeds_order]).is_a?(Array)
|
|
68
|
+
self.feeds_order = value
|
|
69
|
+
end
|
|
70
|
+
end
|
|
60
71
|
end
|
|
61
72
|
|
|
62
73
|
# Checks equality by comparing each attribute.
|
|
@@ -64,7 +75,8 @@ module Algolia
|
|
|
64
75
|
def ==(other)
|
|
65
76
|
return true if self.equal?(other)
|
|
66
77
|
self.class == other.class &&
|
|
67
|
-
params == other.params
|
|
78
|
+
params == other.params &&
|
|
79
|
+
feeds_order == other.feeds_order
|
|
68
80
|
end
|
|
69
81
|
|
|
70
82
|
# @see the `==` method
|
|
@@ -76,7 +88,7 @@ module Algolia
|
|
|
76
88
|
# Calculates hash code according to all attributes.
|
|
77
89
|
# @return [Integer] Hash code
|
|
78
90
|
def hash
|
|
79
|
-
[params].hash
|
|
91
|
+
[params, feeds_order].hash
|
|
80
92
|
end
|
|
81
93
|
|
|
82
94
|
# Builds the object from hash
|
|
@@ -0,0 +1,227 @@
|
|
|
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
|
+
# Specific configuration attributes of an `algoliaIndex` source.
|
|
11
|
+
class SourceAlgoliaIndex
|
|
12
|
+
# Name of the Algolia index to read records from.
|
|
13
|
+
attr_accessor :index_name
|
|
14
|
+
|
|
15
|
+
# SQL-like filter expression applied while browsing the source index. See [filters](https://www.algolia.com/doc/api-reference/api-parameters/filters/).
|
|
16
|
+
attr_accessor :filters
|
|
17
|
+
|
|
18
|
+
# Attribute mapping from ruby-style variable name to JSON key.
|
|
19
|
+
def self.attribute_map
|
|
20
|
+
{
|
|
21
|
+
:index_name => :indexName,
|
|
22
|
+
:filters => :filters
|
|
23
|
+
}
|
|
24
|
+
end
|
|
25
|
+
|
|
26
|
+
# Returns the keys that uniquely identify this oneOf variant when present
|
|
27
|
+
def self.discriminator_attributes
|
|
28
|
+
[
|
|
29
|
+
:indexName
|
|
30
|
+
]
|
|
31
|
+
end
|
|
32
|
+
|
|
33
|
+
# Attribute type mapping.
|
|
34
|
+
def self.types_mapping
|
|
35
|
+
{
|
|
36
|
+
:index_name => :"String",
|
|
37
|
+
:filters => :"String"
|
|
38
|
+
}
|
|
39
|
+
end
|
|
40
|
+
|
|
41
|
+
# List of attributes with nullable: true
|
|
42
|
+
def self.openapi_nullable
|
|
43
|
+
Set.new(
|
|
44
|
+
[]
|
|
45
|
+
)
|
|
46
|
+
end
|
|
47
|
+
|
|
48
|
+
# Initializes the object
|
|
49
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
|
50
|
+
def initialize(attributes = {})
|
|
51
|
+
if (!attributes.is_a?(Hash))
|
|
52
|
+
raise(
|
|
53
|
+
ArgumentError,
|
|
54
|
+
"The input argument (attributes) must be a hash in `Algolia::SourceAlgoliaIndex` initialize method"
|
|
55
|
+
)
|
|
56
|
+
end
|
|
57
|
+
|
|
58
|
+
# check to see if the attribute exists and convert string to symbol for hash key
|
|
59
|
+
attributes = attributes.each_with_object({}) { |(k, v), h|
|
|
60
|
+
if (!self.class.attribute_map.key?(k.to_sym))
|
|
61
|
+
raise(
|
|
62
|
+
ArgumentError,
|
|
63
|
+
"`#{k}` is not a valid attribute in `Algolia::SourceAlgoliaIndex`. Please check the name to make sure it's valid. List of attributes: " +
|
|
64
|
+
self.class.attribute_map.keys.inspect
|
|
65
|
+
)
|
|
66
|
+
end
|
|
67
|
+
|
|
68
|
+
h[k.to_sym] = v
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
if attributes.key?(:index_name)
|
|
72
|
+
self.index_name = attributes[:index_name]
|
|
73
|
+
else
|
|
74
|
+
self.index_name = nil
|
|
75
|
+
end
|
|
76
|
+
|
|
77
|
+
if attributes.key?(:filters)
|
|
78
|
+
self.filters = attributes[:filters]
|
|
79
|
+
end
|
|
80
|
+
end
|
|
81
|
+
|
|
82
|
+
# Checks equality by comparing each attribute.
|
|
83
|
+
# @param [Object] Object to be compared
|
|
84
|
+
def ==(other)
|
|
85
|
+
return true if self.equal?(other)
|
|
86
|
+
self.class == other.class &&
|
|
87
|
+
index_name == other.index_name &&
|
|
88
|
+
filters == other.filters
|
|
89
|
+
end
|
|
90
|
+
|
|
91
|
+
# @see the `==` method
|
|
92
|
+
# @param [Object] Object to be compared
|
|
93
|
+
def eql?(other)
|
|
94
|
+
self == other
|
|
95
|
+
end
|
|
96
|
+
|
|
97
|
+
# Calculates hash code according to all attributes.
|
|
98
|
+
# @return [Integer] Hash code
|
|
99
|
+
def hash
|
|
100
|
+
[index_name, filters].hash
|
|
101
|
+
end
|
|
102
|
+
|
|
103
|
+
# Builds the object from hash
|
|
104
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
|
105
|
+
# @return [Object] Returns the model itself
|
|
106
|
+
def self.build_from_hash(attributes)
|
|
107
|
+
return nil unless attributes.is_a?(Hash)
|
|
108
|
+
attributes = attributes.transform_keys(&:to_sym)
|
|
109
|
+
transformed_hash = {}
|
|
110
|
+
types_mapping.each_pair do |key, type|
|
|
111
|
+
if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil?
|
|
112
|
+
transformed_hash[key.to_sym] = nil
|
|
113
|
+
elsif type =~ /\AArray<(.*)>/i
|
|
114
|
+
# check to ensure the input is an array given that the attribute
|
|
115
|
+
# is documented as an array but the input is not
|
|
116
|
+
if attributes[attribute_map[key]].is_a?(Array)
|
|
117
|
+
transformed_hash[key.to_sym] = attributes[attribute_map[key]].map { |v|
|
|
118
|
+
_deserialize(::Regexp.last_match(1), v)
|
|
119
|
+
}
|
|
120
|
+
end
|
|
121
|
+
elsif !attributes[attribute_map[key]].nil?
|
|
122
|
+
transformed_hash[key.to_sym] = _deserialize(type, attributes[attribute_map[key]])
|
|
123
|
+
end
|
|
124
|
+
end
|
|
125
|
+
|
|
126
|
+
new(transformed_hash)
|
|
127
|
+
end
|
|
128
|
+
|
|
129
|
+
# Deserializes the data based on type
|
|
130
|
+
# @param string type Data type
|
|
131
|
+
# @param string value Value to be deserialized
|
|
132
|
+
# @return [Object] Deserialized data
|
|
133
|
+
def self._deserialize(type, value)
|
|
134
|
+
case type.to_sym
|
|
135
|
+
when :Time
|
|
136
|
+
Time.parse(value)
|
|
137
|
+
when :Date
|
|
138
|
+
Date.parse(value)
|
|
139
|
+
when :String
|
|
140
|
+
value.to_s
|
|
141
|
+
when :Integer
|
|
142
|
+
value.to_i
|
|
143
|
+
when :Float
|
|
144
|
+
value.to_f
|
|
145
|
+
when :Boolean
|
|
146
|
+
if value.to_s =~ /\A(true|t|yes|y|1)\z/i
|
|
147
|
+
true
|
|
148
|
+
else
|
|
149
|
+
false
|
|
150
|
+
end
|
|
151
|
+
|
|
152
|
+
when :Object
|
|
153
|
+
# generic object (usually a Hash), return directly
|
|
154
|
+
value
|
|
155
|
+
when /\AArray<(?<inner_type>.+)>\z/
|
|
156
|
+
inner_type = Regexp.last_match[:inner_type]
|
|
157
|
+
value.map { |v| _deserialize(inner_type, v) }
|
|
158
|
+
when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
|
|
159
|
+
k_type = Regexp.last_match[:k_type]
|
|
160
|
+
v_type = Regexp.last_match[:v_type]
|
|
161
|
+
{}.tap do |hash|
|
|
162
|
+
value.each do |k, v|
|
|
163
|
+
hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
|
|
164
|
+
end
|
|
165
|
+
end
|
|
166
|
+
# model
|
|
167
|
+
else
|
|
168
|
+
# models (e.g. Pet) or oneOf
|
|
169
|
+
klass = Algolia::Ingestion.const_get(type)
|
|
170
|
+
klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass
|
|
171
|
+
.build_from_hash(value)
|
|
172
|
+
end
|
|
173
|
+
end
|
|
174
|
+
|
|
175
|
+
# Returns the string representation of the object
|
|
176
|
+
# @return [String] String presentation of the object
|
|
177
|
+
def to_s
|
|
178
|
+
to_hash.to_s
|
|
179
|
+
end
|
|
180
|
+
|
|
181
|
+
# to_body is an alias to to_hash (backward compatibility)
|
|
182
|
+
# @return [Hash] Returns the object in the form of hash
|
|
183
|
+
def to_body
|
|
184
|
+
to_hash
|
|
185
|
+
end
|
|
186
|
+
|
|
187
|
+
def to_json(*_args)
|
|
188
|
+
to_hash.to_json
|
|
189
|
+
end
|
|
190
|
+
|
|
191
|
+
# Returns the object in the form of hash
|
|
192
|
+
# @return [Hash] Returns the object in the form of hash
|
|
193
|
+
def to_hash
|
|
194
|
+
hash = {}
|
|
195
|
+
self.class.attribute_map.each_pair do |attr, param|
|
|
196
|
+
value = send(attr)
|
|
197
|
+
if value.nil?
|
|
198
|
+
is_nullable = self.class.openapi_nullable.include?(attr)
|
|
199
|
+
next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
|
|
200
|
+
end
|
|
201
|
+
|
|
202
|
+
hash[param] = _to_hash(value)
|
|
203
|
+
end
|
|
204
|
+
|
|
205
|
+
hash
|
|
206
|
+
end
|
|
207
|
+
|
|
208
|
+
# Outputs non-array value in the form of hash
|
|
209
|
+
# For object, use to_hash. Otherwise, just return the value
|
|
210
|
+
# @param [Object] value Any valid value
|
|
211
|
+
# @return [Hash] Returns the value in the form of hash
|
|
212
|
+
def _to_hash(value)
|
|
213
|
+
if value.is_a?(Array)
|
|
214
|
+
value.compact.map { |v| _to_hash(v) }
|
|
215
|
+
elsif value.is_a?(Hash)
|
|
216
|
+
{}.tap do |hash|
|
|
217
|
+
value.each { |k, v| hash[k] = _to_hash(v) }
|
|
218
|
+
end
|
|
219
|
+
elsif value.respond_to?(:to_hash)
|
|
220
|
+
value.to_hash
|
|
221
|
+
else
|
|
222
|
+
value
|
|
223
|
+
end
|
|
224
|
+
end
|
|
225
|
+
end
|
|
226
|
+
end
|
|
227
|
+
end
|
|
@@ -8,6 +8,7 @@ require "time"
|
|
|
8
8
|
module Algolia
|
|
9
9
|
module Ingestion
|
|
10
10
|
class SourceType
|
|
11
|
+
ALGOLIA_INDEX = "algoliaIndex".freeze
|
|
11
12
|
BIGCOMMERCE = "bigcommerce".freeze
|
|
12
13
|
BIGQUERY = "bigquery".freeze
|
|
13
14
|
COMMERCETOOLS = "commercetools".freeze
|
|
@@ -19,7 +20,18 @@ module Algolia
|
|
|
19
20
|
PUSH = "push".freeze
|
|
20
21
|
|
|
21
22
|
def self.all_vars
|
|
22
|
-
@all_vars ||= [
|
|
23
|
+
@all_vars ||= [
|
|
24
|
+
ALGOLIA_INDEX,
|
|
25
|
+
BIGCOMMERCE,
|
|
26
|
+
BIGQUERY,
|
|
27
|
+
COMMERCETOOLS,
|
|
28
|
+
CSV,
|
|
29
|
+
DOCKER,
|
|
30
|
+
GA4_BIGQUERY_EXPORT,
|
|
31
|
+
JSON,
|
|
32
|
+
SHOPIFY,
|
|
33
|
+
PUSH
|
|
34
|
+
].freeze
|
|
23
35
|
end
|
|
24
36
|
|
|
25
37
|
# Builds the enum from string
|
|
@@ -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 Ingestion
|
|
10
|
+
# Specific configuration attributes of an `algoliaIndex` source.
|
|
11
|
+
class SourceUpdateAlgoliaIndex
|
|
12
|
+
# Name of the Algolia index to read records from.
|
|
13
|
+
attr_accessor :index_name
|
|
14
|
+
|
|
15
|
+
# SQL-like filter expression applied while browsing the source index. See [filters](https://www.algolia.com/doc/api-reference/api-parameters/filters/).
|
|
16
|
+
attr_accessor :filters
|
|
17
|
+
|
|
18
|
+
# Attribute mapping from ruby-style variable name to JSON key.
|
|
19
|
+
def self.attribute_map
|
|
20
|
+
{
|
|
21
|
+
:index_name => :indexName,
|
|
22
|
+
:filters => :filters
|
|
23
|
+
}
|
|
24
|
+
end
|
|
25
|
+
|
|
26
|
+
# Attribute type mapping.
|
|
27
|
+
def self.types_mapping
|
|
28
|
+
{
|
|
29
|
+
:index_name => :"String",
|
|
30
|
+
:filters => :"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::SourceUpdateAlgoliaIndex` 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::SourceUpdateAlgoliaIndex`. 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?(:index_name)
|
|
65
|
+
self.index_name = attributes[:index_name]
|
|
66
|
+
end
|
|
67
|
+
|
|
68
|
+
if attributes.key?(:filters)
|
|
69
|
+
self.filters = attributes[:filters]
|
|
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
|
+
index_name == other.index_name &&
|
|
79
|
+
filters == other.filters
|
|
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
|
+
[index_name, filters].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::Ingestion.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.compact.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
|
data/lib/algolia/version.rb
CHANGED
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.
|
|
4
|
+
version: 3.39.0
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- https://alg.li/support
|
|
@@ -465,6 +465,7 @@ files:
|
|
|
465
465
|
- lib/algolia/models/ingestion/shopify_market.rb
|
|
466
466
|
- lib/algolia/models/ingestion/shopify_metafield.rb
|
|
467
467
|
- lib/algolia/models/ingestion/source.rb
|
|
468
|
+
- lib/algolia/models/ingestion/source_algolia_index.rb
|
|
468
469
|
- lib/algolia/models/ingestion/source_big_commerce.rb
|
|
469
470
|
- lib/algolia/models/ingestion/source_big_query.rb
|
|
470
471
|
- lib/algolia/models/ingestion/source_commercetools.rb
|
|
@@ -480,6 +481,7 @@ files:
|
|
|
480
481
|
- lib/algolia/models/ingestion/source_sort_keys.rb
|
|
481
482
|
- lib/algolia/models/ingestion/source_type.rb
|
|
482
483
|
- lib/algolia/models/ingestion/source_update.rb
|
|
484
|
+
- lib/algolia/models/ingestion/source_update_algolia_index.rb
|
|
483
485
|
- lib/algolia/models/ingestion/source_update_commercetools.rb
|
|
484
486
|
- lib/algolia/models/ingestion/source_update_docker.rb
|
|
485
487
|
- lib/algolia/models/ingestion/source_update_input.rb
|