algolia 3.0.0.beta.7 → 3.0.0.beta.8

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: 7cc326f3f421493311bb0c56147b9de597c87de115eb3923a0cf649aaba02c38
4
- data.tar.gz: a7568b187d6b185503521786b2a8e80591b140e2a6109b0ff2a80f7cdbbf3eaa
3
+ metadata.gz: df1df29d4bb320313ff2e7f0c05a4b76a3d6188b9f08a692af7403dc6d99472b
4
+ data.tar.gz: 9b18848ff6241cde6f18523aa706303a4c74c4ec067631c922eecadc28d4c0be
5
5
  SHA512:
6
- metadata.gz: 2f2d6b16d9862a70444bce125e299eb0569c9d33b4b1734269ac47774f8ac67990d6aba65e1e00a9213253463a2fd28c53b0665d68a862f28fb25ab52176d077
7
- data.tar.gz: 514f78082cd25d98bba2817d30463580f44db2ed616d725fc94c58ed25165b8eb6fd6d811575ec4767668b46fa98975305eddb537c7f814f6a08ffab7275fd43
6
+ metadata.gz: 78c85cc136bdf8d52e43bc14a98c1c7ed54b0c0aa79ebf064610b0a658cb1eca4ec895fc31afbef3f7a8f618303336e339a09b82decc9c2fd2e4d5e91fd1978e
7
+ data.tar.gz: e13c8fcbc458cbaf053f88e3ccf6e87c1744d6dc91947f62a443b3d73aa3c254dc5ccc14adfe8b33c1648a50cd64ecef96f3b6a9975f4d66eb3c0767c5064bbb
data/CHANGELOG.md CHANGED
@@ -1,3 +1,7 @@
1
+ ## [3.0.0.beta.8](https://github.com/algolia/algoliasearch-client-ruby/compare/3.0.0.beta.7...3.0.0.beta.8)
2
+
3
+ - [9776cb3ba](https://github.com/algolia/api-clients-automation/commit/9776cb3ba) feat(specs): add redirect to renderingContent ([#3296](https://github.com/algolia/api-clients-automation/pull/3296)) by [@shortcuts](https://github.com/shortcuts/)
4
+
1
5
  ## [3.0.0.beta.7](https://github.com/algolia/algoliasearch-client-ruby/compare/3.0.0.beta.6...3.0.0.beta.7)
2
6
 
3
7
  - [95e4c1e17](https://github.com/algolia/api-clients-automation/commit/95e4c1e17) chore(ruby): scope to last commit ([#3266](https://github.com/algolia/api-clients-automation/pull/3266)) by [@shortcuts](https://github.com/shortcuts/)
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- algolia (3.0.0.beta.7)
4
+ algolia (3.0.0.beta.8)
5
5
  faraday (>= 1.0.1, < 3.0)
6
6
  faraday-net_http_persistent (>= 0.15, < 3)
7
7
  net-http-persistent
@@ -5,7 +5,7 @@ require 'time'
5
5
 
6
6
  module Algolia
7
7
  module Recommend
8
- # [Redirect results to a URL](https://www.algolia.com/doc/guides/managing-results/rules/merchandising-and-promoting/how-to/redirects/).
8
+ # [Redirect results to a URL](https://www.algolia.com/doc/guides/managing-results/rules/merchandising-and-promoting/how-to/redirects/), this this parameter is for internal use only.
9
9
  class Redirect
10
10
  attr_accessor :index
11
11
 
@@ -0,0 +1,197 @@
1
+ # 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.
2
+
3
+ require 'date'
4
+ require 'time'
5
+
6
+ module Algolia
7
+ module Recommend
8
+ # The redirect rule container.
9
+ class RedirectURL
10
+ attr_accessor :url
11
+
12
+ # Attribute mapping from ruby-style variable name to JSON key.
13
+ def self.attribute_map
14
+ {
15
+ :url => :url
16
+ }
17
+ end
18
+
19
+ # Returns all the JSON keys this model knows about
20
+ def self.acceptable_attributes
21
+ attribute_map.values
22
+ end
23
+
24
+ # Attribute type mapping.
25
+ def self.types_mapping
26
+ {
27
+ :url => :String
28
+ }
29
+ end
30
+
31
+ # List of attributes with nullable: true
32
+ def self.openapi_nullable
33
+ Set.new([])
34
+ end
35
+
36
+ # Initializes the object
37
+ # @param [Hash] attributes Model attributes in the form of hash
38
+ def initialize(attributes = {})
39
+ unless attributes.is_a?(Hash)
40
+ raise ArgumentError, "The input argument (attributes) must be a hash in `Algolia::RedirectURL` initialize method"
41
+ end
42
+
43
+ # check to see if the attribute exists and convert string to symbol for hash key
44
+ attributes = attributes.each_with_object({}) do |(k, v), h|
45
+ unless self.class.attribute_map.key?(k.to_sym)
46
+ raise ArgumentError,
47
+ "`#{k}` is not a valid attribute in `Algolia::RedirectURL`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
48
+ end
49
+
50
+ h[k.to_sym] = v
51
+ end
52
+
53
+ if attributes.key?(:url)
54
+ self.url = attributes[:url]
55
+ end
56
+ end
57
+
58
+ # Checks equality by comparing each attribute.
59
+ # @param [Object] Object to be compared
60
+ def ==(other)
61
+ return true if equal?(other)
62
+
63
+ self.class == other.class &&
64
+ url == other.url
65
+ end
66
+
67
+ # @see the `==` method
68
+ # @param [Object] Object to be compared
69
+ def eql?(other)
70
+ self == other
71
+ end
72
+
73
+ # Calculates hash code according to all attributes.
74
+ # @return [Integer] Hash code
75
+ def hash
76
+ [url].hash
77
+ end
78
+
79
+ # Builds the object from hash
80
+ # @param [Hash] attributes Model attributes in the form of hash
81
+ # @return [Object] Returns the model itself
82
+ def self.build_from_hash(attributes)
83
+ return nil unless attributes.is_a?(Hash)
84
+
85
+ attributes = attributes.transform_keys(&:to_sym)
86
+ transformed_hash = {}
87
+ types_mapping.each_pair do |key, type|
88
+ if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil?
89
+ transformed_hash[key.to_sym] = nil
90
+ elsif type =~ /\AArray<(.*)>/i
91
+ # check to ensure the input is an array given that the attribute
92
+ # is documented as an array but the input is not
93
+ if attributes[attribute_map[key]].is_a?(Array)
94
+ transformed_hash[key.to_sym] = attributes[attribute_map[key]].map { |v| _deserialize(::Regexp.last_match(1), v) }
95
+ end
96
+ elsif !attributes[attribute_map[key]].nil?
97
+ transformed_hash[key.to_sym] = _deserialize(type, attributes[attribute_map[key]])
98
+ end
99
+ end
100
+ new(transformed_hash)
101
+ end
102
+
103
+ # Deserializes the data based on type
104
+ # @param string type Data type
105
+ # @param string value Value to be deserialized
106
+ # @return [Object] Deserialized data
107
+ def self._deserialize(type, value)
108
+ case type.to_sym
109
+ when :Time
110
+ Time.parse(value)
111
+ when :Date
112
+ Date.parse(value)
113
+ when :String
114
+ value.to_s
115
+ when :Integer
116
+ value.to_i
117
+ when :Float
118
+ value.to_f
119
+ when :Boolean
120
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
121
+ true
122
+ else
123
+ false
124
+ end
125
+ when :Object
126
+ # generic object (usually a Hash), return directly
127
+ value
128
+ when /\AArray<(?<inner_type>.+)>\z/
129
+ inner_type = Regexp.last_match[:inner_type]
130
+ value.map { |v| _deserialize(inner_type, v) }
131
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
132
+ k_type = Regexp.last_match[:k_type]
133
+ v_type = Regexp.last_match[:v_type]
134
+ {}.tap do |hash|
135
+ value.each do |k, v|
136
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
137
+ end
138
+ end
139
+ else # model
140
+ # models (e.g. Pet) or oneOf
141
+ klass = Algolia::Recommend.const_get(type)
142
+ klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
143
+ end
144
+ end
145
+
146
+ # Returns the string representation of the object
147
+ # @return [String] String presentation of the object
148
+ def to_s
149
+ to_hash.to_s
150
+ end
151
+
152
+ # to_body is an alias to to_hash (backward compatibility)
153
+ # @return [Hash] Returns the object in the form of hash
154
+ def to_body
155
+ to_hash
156
+ end
157
+
158
+ def to_json(*_args)
159
+ to_hash.to_json
160
+ end
161
+
162
+ # Returns the object in the form of hash
163
+ # @return [Hash] Returns the object in the form of hash
164
+ def to_hash
165
+ hash = {}
166
+ self.class.attribute_map.each_pair do |attr, param|
167
+ value = send(attr)
168
+ if value.nil?
169
+ is_nullable = self.class.openapi_nullable.include?(attr)
170
+ next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
171
+ end
172
+
173
+ hash[param] = _to_hash(value)
174
+ end
175
+ hash
176
+ end
177
+
178
+ # Outputs non-array value in the form of hash
179
+ # For object, use to_hash. Otherwise, just return the value
180
+ # @param [Object] value Any valid value
181
+ # @return [Hash] Returns the value in the form of hash
182
+ def _to_hash(value)
183
+ if value.is_a?(Array)
184
+ value.compact.map { |v| _to_hash(v) }
185
+ elsif value.is_a?(Hash)
186
+ {}.tap do |hash|
187
+ value.each { |k, v| hash[k] = _to_hash(v) }
188
+ end
189
+ elsif value.respond_to? :to_hash
190
+ value.to_hash
191
+ else
192
+ value
193
+ end
194
+ end
195
+ end
196
+ end
197
+ end
@@ -9,10 +9,13 @@ module Algolia
9
9
  class RenderingContent
10
10
  attr_accessor :facet_ordering
11
11
 
12
+ attr_accessor :redirect
13
+
12
14
  # Attribute mapping from ruby-style variable name to JSON key.
13
15
  def self.attribute_map
14
16
  {
15
- :facet_ordering => :facetOrdering
17
+ :facet_ordering => :facetOrdering,
18
+ :redirect => :redirect
16
19
  }
17
20
  end
18
21
 
@@ -24,7 +27,8 @@ module Algolia
24
27
  # Attribute type mapping.
25
28
  def self.types_mapping
26
29
  {
27
- :facet_ordering => :FacetOrdering
30
+ :facet_ordering => :FacetOrdering,
31
+ :redirect => :RedirectURL
28
32
  }
29
33
  end
30
34
 
@@ -53,6 +57,10 @@ module Algolia
53
57
  if attributes.key?(:facet_ordering)
54
58
  self.facet_ordering = attributes[:facet_ordering]
55
59
  end
60
+
61
+ if attributes.key?(:redirect)
62
+ self.redirect = attributes[:redirect]
63
+ end
56
64
  end
57
65
 
58
66
  # Checks equality by comparing each attribute.
@@ -61,7 +69,8 @@ module Algolia
61
69
  return true if equal?(other)
62
70
 
63
71
  self.class == other.class &&
64
- facet_ordering == other.facet_ordering
72
+ facet_ordering == other.facet_ordering &&
73
+ redirect == other.redirect
65
74
  end
66
75
 
67
76
  # @see the `==` method
@@ -73,7 +82,7 @@ module Algolia
73
82
  # Calculates hash code according to all attributes.
74
83
  # @return [Integer] Hash code
75
84
  def hash
76
- [facet_ordering].hash
85
+ [facet_ordering, redirect].hash
77
86
  end
78
87
 
79
88
  # Builds the object from hash
@@ -5,7 +5,7 @@ require 'time'
5
5
 
6
6
  module Algolia
7
7
  module Search
8
- # [Redirect results to a URL](https://www.algolia.com/doc/guides/managing-results/rules/merchandising-and-promoting/how-to/redirects/).
8
+ # [Redirect results to a URL](https://www.algolia.com/doc/guides/managing-results/rules/merchandising-and-promoting/how-to/redirects/), this this parameter is for internal use only.
9
9
  class Redirect
10
10
  attr_accessor :index
11
11
 
@@ -0,0 +1,197 @@
1
+ # 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.
2
+
3
+ require 'date'
4
+ require 'time'
5
+
6
+ module Algolia
7
+ module Search
8
+ # The redirect rule container.
9
+ class RedirectURL
10
+ attr_accessor :url
11
+
12
+ # Attribute mapping from ruby-style variable name to JSON key.
13
+ def self.attribute_map
14
+ {
15
+ :url => :url
16
+ }
17
+ end
18
+
19
+ # Returns all the JSON keys this model knows about
20
+ def self.acceptable_attributes
21
+ attribute_map.values
22
+ end
23
+
24
+ # Attribute type mapping.
25
+ def self.types_mapping
26
+ {
27
+ :url => :String
28
+ }
29
+ end
30
+
31
+ # List of attributes with nullable: true
32
+ def self.openapi_nullable
33
+ Set.new([])
34
+ end
35
+
36
+ # Initializes the object
37
+ # @param [Hash] attributes Model attributes in the form of hash
38
+ def initialize(attributes = {})
39
+ unless attributes.is_a?(Hash)
40
+ raise ArgumentError, "The input argument (attributes) must be a hash in `Algolia::RedirectURL` initialize method"
41
+ end
42
+
43
+ # check to see if the attribute exists and convert string to symbol for hash key
44
+ attributes = attributes.each_with_object({}) do |(k, v), h|
45
+ unless self.class.attribute_map.key?(k.to_sym)
46
+ raise ArgumentError,
47
+ "`#{k}` is not a valid attribute in `Algolia::RedirectURL`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
48
+ end
49
+
50
+ h[k.to_sym] = v
51
+ end
52
+
53
+ if attributes.key?(:url)
54
+ self.url = attributes[:url]
55
+ end
56
+ end
57
+
58
+ # Checks equality by comparing each attribute.
59
+ # @param [Object] Object to be compared
60
+ def ==(other)
61
+ return true if equal?(other)
62
+
63
+ self.class == other.class &&
64
+ url == other.url
65
+ end
66
+
67
+ # @see the `==` method
68
+ # @param [Object] Object to be compared
69
+ def eql?(other)
70
+ self == other
71
+ end
72
+
73
+ # Calculates hash code according to all attributes.
74
+ # @return [Integer] Hash code
75
+ def hash
76
+ [url].hash
77
+ end
78
+
79
+ # Builds the object from hash
80
+ # @param [Hash] attributes Model attributes in the form of hash
81
+ # @return [Object] Returns the model itself
82
+ def self.build_from_hash(attributes)
83
+ return nil unless attributes.is_a?(Hash)
84
+
85
+ attributes = attributes.transform_keys(&:to_sym)
86
+ transformed_hash = {}
87
+ types_mapping.each_pair do |key, type|
88
+ if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil?
89
+ transformed_hash[key.to_sym] = nil
90
+ elsif type =~ /\AArray<(.*)>/i
91
+ # check to ensure the input is an array given that the attribute
92
+ # is documented as an array but the input is not
93
+ if attributes[attribute_map[key]].is_a?(Array)
94
+ transformed_hash[key.to_sym] = attributes[attribute_map[key]].map { |v| _deserialize(::Regexp.last_match(1), v) }
95
+ end
96
+ elsif !attributes[attribute_map[key]].nil?
97
+ transformed_hash[key.to_sym] = _deserialize(type, attributes[attribute_map[key]])
98
+ end
99
+ end
100
+ new(transformed_hash)
101
+ end
102
+
103
+ # Deserializes the data based on type
104
+ # @param string type Data type
105
+ # @param string value Value to be deserialized
106
+ # @return [Object] Deserialized data
107
+ def self._deserialize(type, value)
108
+ case type.to_sym
109
+ when :Time
110
+ Time.parse(value)
111
+ when :Date
112
+ Date.parse(value)
113
+ when :String
114
+ value.to_s
115
+ when :Integer
116
+ value.to_i
117
+ when :Float
118
+ value.to_f
119
+ when :Boolean
120
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
121
+ true
122
+ else
123
+ false
124
+ end
125
+ when :Object
126
+ # generic object (usually a Hash), return directly
127
+ value
128
+ when /\AArray<(?<inner_type>.+)>\z/
129
+ inner_type = Regexp.last_match[:inner_type]
130
+ value.map { |v| _deserialize(inner_type, v) }
131
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
132
+ k_type = Regexp.last_match[:k_type]
133
+ v_type = Regexp.last_match[:v_type]
134
+ {}.tap do |hash|
135
+ value.each do |k, v|
136
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
137
+ end
138
+ end
139
+ else # model
140
+ # models (e.g. Pet) or oneOf
141
+ klass = Algolia::Search.const_get(type)
142
+ klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
143
+ end
144
+ end
145
+
146
+ # Returns the string representation of the object
147
+ # @return [String] String presentation of the object
148
+ def to_s
149
+ to_hash.to_s
150
+ end
151
+
152
+ # to_body is an alias to to_hash (backward compatibility)
153
+ # @return [Hash] Returns the object in the form of hash
154
+ def to_body
155
+ to_hash
156
+ end
157
+
158
+ def to_json(*_args)
159
+ to_hash.to_json
160
+ end
161
+
162
+ # Returns the object in the form of hash
163
+ # @return [Hash] Returns the object in the form of hash
164
+ def to_hash
165
+ hash = {}
166
+ self.class.attribute_map.each_pair do |attr, param|
167
+ value = send(attr)
168
+ if value.nil?
169
+ is_nullable = self.class.openapi_nullable.include?(attr)
170
+ next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
171
+ end
172
+
173
+ hash[param] = _to_hash(value)
174
+ end
175
+ hash
176
+ end
177
+
178
+ # Outputs non-array value in the form of hash
179
+ # For object, use to_hash. Otherwise, just return the value
180
+ # @param [Object] value Any valid value
181
+ # @return [Hash] Returns the value in the form of hash
182
+ def _to_hash(value)
183
+ if value.is_a?(Array)
184
+ value.compact.map { |v| _to_hash(v) }
185
+ elsif value.is_a?(Hash)
186
+ {}.tap do |hash|
187
+ value.each { |k, v| hash[k] = _to_hash(v) }
188
+ end
189
+ elsif value.respond_to? :to_hash
190
+ value.to_hash
191
+ else
192
+ value
193
+ end
194
+ end
195
+ end
196
+ end
197
+ end
@@ -9,10 +9,13 @@ module Algolia
9
9
  class RenderingContent
10
10
  attr_accessor :facet_ordering
11
11
 
12
+ attr_accessor :redirect
13
+
12
14
  # Attribute mapping from ruby-style variable name to JSON key.
13
15
  def self.attribute_map
14
16
  {
15
- :facet_ordering => :facetOrdering
17
+ :facet_ordering => :facetOrdering,
18
+ :redirect => :redirect
16
19
  }
17
20
  end
18
21
 
@@ -24,7 +27,8 @@ module Algolia
24
27
  # Attribute type mapping.
25
28
  def self.types_mapping
26
29
  {
27
- :facet_ordering => :FacetOrdering
30
+ :facet_ordering => :FacetOrdering,
31
+ :redirect => :RedirectURL
28
32
  }
29
33
  end
30
34
 
@@ -53,6 +57,10 @@ module Algolia
53
57
  if attributes.key?(:facet_ordering)
54
58
  self.facet_ordering = attributes[:facet_ordering]
55
59
  end
60
+
61
+ if attributes.key?(:redirect)
62
+ self.redirect = attributes[:redirect]
63
+ end
56
64
  end
57
65
 
58
66
  # Checks equality by comparing each attribute.
@@ -61,7 +69,8 @@ module Algolia
61
69
  return true if equal?(other)
62
70
 
63
71
  self.class == other.class &&
64
- facet_ordering == other.facet_ordering
72
+ facet_ordering == other.facet_ordering &&
73
+ redirect == other.redirect
65
74
  end
66
75
 
67
76
  # @see the `==` method
@@ -73,7 +82,7 @@ module Algolia
73
82
  # Calculates hash code according to all attributes.
74
83
  # @return [Integer] Hash code
75
84
  def hash
76
- [facet_ordering].hash
85
+ [facet_ordering, redirect].hash
77
86
  end
78
87
 
79
88
  # Builds the object from hash
@@ -1,5 +1,5 @@
1
1
  # 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.
2
2
 
3
3
  module Algolia
4
- VERSION = '3.0.0.beta.7'.freeze
4
+ VERSION = '3.0.0.beta.8'.freeze
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: algolia
3
3
  version: !ruby/object:Gem::Version
4
- version: 3.0.0.beta.7
4
+ version: 3.0.0.beta.8
5
5
  platform: ruby
6
6
  authors:
7
7
  - https://alg.li/support
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2024-06-27 00:00:00.000000000 Z
11
+ date: 2024-07-01 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: faraday
@@ -482,6 +482,7 @@ files:
482
482
  - lib/algolia/models/recommend/redirect.rb
483
483
  - lib/algolia/models/recommend/redirect_rule_index_metadata.rb
484
484
  - lib/algolia/models/recommend/redirect_rule_index_metadata_data.rb
485
+ - lib/algolia/models/recommend/redirect_url.rb
485
486
  - lib/algolia/models/recommend/related_model.rb
486
487
  - lib/algolia/models/recommend/related_products.rb
487
488
  - lib/algolia/models/recommend/related_query.rb
@@ -616,6 +617,7 @@ files:
616
617
  - lib/algolia/models/search/redirect.rb
617
618
  - lib/algolia/models/search/redirect_rule_index_metadata.rb
618
619
  - lib/algolia/models/search/redirect_rule_index_metadata_data.rb
620
+ - lib/algolia/models/search/redirect_url.rb
619
621
  - lib/algolia/models/search/remove_stop_words.rb
620
622
  - lib/algolia/models/search/remove_user_id_response.rb
621
623
  - lib/algolia/models/search/remove_words_if_no_results.rb