algolia 3.0.0.beta.6 → 3.0.0.beta.8

Sign up to get free protection for your applications and to get access to all the features.
@@ -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.6'.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.6
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-26 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
@@ -407,6 +407,9 @@ files:
407
407
  - lib/algolia/models/query-suggestions/base_query_suggestions_configuration_response.rb
408
408
  - lib/algolia/models/query-suggestions/base_query_suggestions_configuration_with_index.rb
409
409
  - lib/algolia/models/query-suggestions/base_response.rb
410
+ - lib/algolia/models/query-suggestions/configuration.rb
411
+ - lib/algolia/models/query-suggestions/configuration_response.rb
412
+ - lib/algolia/models/query-suggestions/configuration_with_index.rb
410
413
  - lib/algolia/models/query-suggestions/error_base.rb
411
414
  - lib/algolia/models/query-suggestions/facet.rb
412
415
  - lib/algolia/models/query-suggestions/get_config_status200_response.rb
@@ -479,6 +482,7 @@ files:
479
482
  - lib/algolia/models/recommend/redirect.rb
480
483
  - lib/algolia/models/recommend/redirect_rule_index_metadata.rb
481
484
  - lib/algolia/models/recommend/redirect_rule_index_metadata_data.rb
485
+ - lib/algolia/models/recommend/redirect_url.rb
482
486
  - lib/algolia/models/recommend/related_model.rb
483
487
  - lib/algolia/models/recommend/related_products.rb
484
488
  - lib/algolia/models/recommend/related_query.rb
@@ -613,6 +617,7 @@ files:
613
617
  - lib/algolia/models/search/redirect.rb
614
618
  - lib/algolia/models/search/redirect_rule_index_metadata.rb
615
619
  - lib/algolia/models/search/redirect_rule_index_metadata_data.rb
620
+ - lib/algolia/models/search/redirect_url.rb
616
621
  - lib/algolia/models/search/remove_stop_words.rb
617
622
  - lib/algolia/models/search/remove_user_id_response.rb
618
623
  - lib/algolia/models/search/remove_words_if_no_results.rb