algolia 3.0.0.alpha.7 → 3.0.0.alpha.9

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: f178243d901a09bdc7e4c0e3b47e2c2c7f0ca3d20db76e7b310f16f6e1b9f3d0
4
- data.tar.gz: c1d301f0c071472df043614b2d7cce87aa809694c0fba5c790abec1e17483fa1
3
+ metadata.gz: c497a0a403dd15a9c839ff211a09d10e68eef9755d60242c20893879caee6fad
4
+ data.tar.gz: 867cdfa39c35a29b5279f7d9e0dd73ca1992b38d0a84fdf07178190251ecdbc5
5
5
  SHA512:
6
- metadata.gz: 51da927c52fb523660c1b45718517cfc805d235fec4f4da35294f93d5cb93dc9a56ec9750bd9086fa23d4a54c9bcd7c6ad0afa672634577b4edca45784220e75
7
- data.tar.gz: 8cd4e5732f6721eadfeb595b7928b21f152734fa8cfcdedc0a53bfb938f887bd7b99173759c72c1c95e08215e6218ff618fd6fe32d402af41ab6338de3d33e92
6
+ metadata.gz: 2e8b6a9396dc6b1157a010c87533f9e348da333f412abc031bb4b0f065349128974cf086c78890ae5787c9ca767320a434318bdd9ffd2ea37e36405b83edd2fd
7
+ data.tar.gz: 4b7ea4afb7278803bfc556d6fa5dea440de505dcd9fc6d997ccdd59ec84c43199da7e679441d7991ecb319b7b8ffd1a306eaaefb48e4129e4673b1d735680ce0
data/CHANGELOG.md CHANGED
@@ -1,3 +1,12 @@
1
+ ## [3.0.0.alpha.9](https://github.com/algolia/algoliasearch-client-ruby/compare/3.0.0.alpha.8...3.0.0.alpha.9)
2
+
3
+ - [4f6e2d0b3](https://github.com/algolia/api-clients-automation/commit/4f6e2d0b3) fix(specs): allow custom fields to be nullable ([#2746](https://github.com/algolia/api-clients-automation/pull/2746)) by [@shortcuts](https://github.com/shortcuts/)
4
+
5
+ ## [3.0.0.alpha.8](https://github.com/algolia/algoliasearch-client-ruby/compare/3.0.0.alpha.7...3.0.0.alpha.8)
6
+
7
+ - [6624759e1](https://github.com/algolia/api-clients-automation/commit/6624759e1) feat(specs): add CustomFields to CT Source Input ([#2742](https://github.com/algolia/api-clients-automation/pull/2742)) by [@damcou](https://github.com/damcou/)
8
+ - [ef37e65b7](https://github.com/algolia/api-clients-automation/commit/ef37e65b7) fix(clients): add e2e tests for analytics API ([#2737](https://github.com/algolia/api-clients-automation/pull/2737)) by [@millotp](https://github.com/millotp/)
9
+
1
10
  ## [3.0.0.alpha.7](https://github.com/algolia/algoliasearch-client-ruby/compare/3.0.0.alpha.6...3.0.0.alpha.7)
2
11
 
3
12
  - [28b34ffb6](https://github.com/algolia/api-clients-automation/commit/28b34ffb6) feat(ruby): add browse helpers ([#2669](https://github.com/algolia/api-clients-automation/pull/2669)) by [@millotp](https://github.com/millotp/)
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- algolia (3.0.0.alpha.7)
4
+ algolia (3.0.0.alpha.9)
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 Ingestion
8
- # An authentication is used to login into a Source or a Destination.
8
+ # An authentication is used to login into a Source or a Destination, with obfuscated input.
9
9
  class Authentication
10
10
  # The authentication UUID.
11
11
  attr_accessor :authentication_id
@@ -72,7 +72,7 @@ module Algolia
72
72
  :type => :AuthenticationType,
73
73
  :name => :String,
74
74
  :platform => :Platform,
75
- :input => :AuthInput,
75
+ :input => :AuthInputPartial,
76
76
  :created_at => :String,
77
77
  :updated_at => :String
78
78
  }
@@ -80,7 +80,9 @@ module Algolia
80
80
 
81
81
  # List of attributes with nullable: true
82
82
  def self.openapi_nullable
83
- Set.new([])
83
+ Set.new([
84
+ :platform
85
+ ])
84
86
  end
85
87
 
86
88
  # Initializes the object
@@ -65,7 +65,9 @@ module Algolia
65
65
 
66
66
  # List of attributes with nullable: true
67
67
  def self.openapi_nullable
68
- Set.new([])
68
+ Set.new([
69
+ :platform
70
+ ])
69
71
  end
70
72
 
71
73
  # Initializes the object
@@ -65,7 +65,9 @@ module Algolia
65
65
 
66
66
  # List of attributes with nullable: true
67
67
  def self.openapi_nullable
68
- Set.new([])
68
+ Set.new([
69
+ :platform
70
+ ])
69
71
  end
70
72
 
71
73
  # Initializes the object
@@ -0,0 +1,228 @@
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 Ingestion
8
+ # Custom fields from Commercetools to index in the records (see https://docs.commercetools.com/tutorials/custom-types).
9
+ class CommercetoolsCustomFields
10
+ # Inventory custom fields.
11
+ attr_accessor :inventory
12
+
13
+ # Price custom fields.
14
+ attr_accessor :price
15
+
16
+ # Category custom fields.
17
+ attr_accessor :category
18
+
19
+ # Attribute mapping from ruby-style variable name to JSON key.
20
+ def self.attribute_map
21
+ {
22
+ :inventory => :inventory,
23
+ :price => :price,
24
+ :category => :category
25
+ }
26
+ end
27
+
28
+ # Returns all the JSON keys this model knows about
29
+ def self.acceptable_attributes
30
+ attribute_map.values
31
+ end
32
+
33
+ # Attribute type mapping.
34
+ def self.types_mapping
35
+ {
36
+ :inventory => :'Array<String>',
37
+ :price => :'Array<String>',
38
+ :category => :'Array<String>'
39
+ }
40
+ end
41
+
42
+ # List of attributes with nullable: true
43
+ def self.openapi_nullable
44
+ Set.new([
45
+ :inventory,
46
+ :price,
47
+ :category
48
+ ])
49
+ end
50
+
51
+ # Initializes the object
52
+ # @param [Hash] attributes Model attributes in the form of hash
53
+ def initialize(attributes = {})
54
+ unless attributes.is_a?(Hash)
55
+ raise ArgumentError, "The input argument (attributes) must be a hash in `Algolia::CommercetoolsCustomFields` initialize method"
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({}) do |(k, v), h|
60
+ unless self.class.attribute_map.key?(k.to_sym)
61
+ raise ArgumentError,
62
+ "`#{k}` is not a valid attribute in `Algolia::CommercetoolsCustomFields`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
63
+ end
64
+
65
+ h[k.to_sym] = v
66
+ end
67
+
68
+ if attributes.key?(:inventory)
69
+ if (value = attributes[:inventory]).is_a?(Array)
70
+ self.inventory = value
71
+ end
72
+ end
73
+
74
+ if attributes.key?(:price)
75
+ if (value = attributes[:price]).is_a?(Array)
76
+ self.price = value
77
+ end
78
+ end
79
+
80
+ if attributes.key?(:category)
81
+ if (value = attributes[:category]).is_a?(Array)
82
+ self.category = value
83
+ end
84
+ end
85
+ end
86
+
87
+ # Checks equality by comparing each attribute.
88
+ # @param [Object] Object to be compared
89
+ def ==(other)
90
+ return true if equal?(other)
91
+
92
+ self.class == other.class &&
93
+ inventory == other.inventory &&
94
+ price == other.price &&
95
+ category == other.category
96
+ end
97
+
98
+ # @see the `==` method
99
+ # @param [Object] Object to be compared
100
+ def eql?(other)
101
+ self == other
102
+ end
103
+
104
+ # Calculates hash code according to all attributes.
105
+ # @return [Integer] Hash code
106
+ def hash
107
+ [inventory, price, category].hash
108
+ end
109
+
110
+ # Builds the object from hash
111
+ # @param [Hash] attributes Model attributes in the form of hash
112
+ # @return [Object] Returns the model itself
113
+ def self.build_from_hash(attributes)
114
+ return nil unless attributes.is_a?(Hash)
115
+
116
+ attributes = attributes.transform_keys(&:to_sym)
117
+ transformed_hash = {}
118
+ types_mapping.each_pair do |key, type|
119
+ if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil?
120
+ transformed_hash[key.to_sym] = nil
121
+ elsif type =~ /\AArray<(.*)>/i
122
+ # check to ensure the input is an array given that the attribute
123
+ # is documented as an array but the input is not
124
+ if attributes[attribute_map[key]].is_a?(Array)
125
+ transformed_hash[key.to_sym] = attributes[attribute_map[key]].map { |v| _deserialize(::Regexp.last_match(1), v) }
126
+ end
127
+ elsif !attributes[attribute_map[key]].nil?
128
+ transformed_hash[key.to_sym] = _deserialize(type, attributes[attribute_map[key]])
129
+ end
130
+ end
131
+ new(transformed_hash)
132
+ end
133
+
134
+ # Deserializes the data based on type
135
+ # @param string type Data type
136
+ # @param string value Value to be deserialized
137
+ # @return [Object] Deserialized data
138
+ def self._deserialize(type, value)
139
+ case type.to_sym
140
+ when :Time
141
+ Time.parse(value)
142
+ when :Date
143
+ Date.parse(value)
144
+ when :String
145
+ value.to_s
146
+ when :Integer
147
+ value.to_i
148
+ when :Float
149
+ value.to_f
150
+ when :Boolean
151
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
152
+ true
153
+ else
154
+ false
155
+ end
156
+ when :Object
157
+ # generic object (usually a Hash), return directly
158
+ value
159
+ when /\AArray<(?<inner_type>.+)>\z/
160
+ inner_type = Regexp.last_match[:inner_type]
161
+ value.map { |v| _deserialize(inner_type, v) }
162
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
163
+ k_type = Regexp.last_match[:k_type]
164
+ v_type = Regexp.last_match[:v_type]
165
+ {}.tap do |hash|
166
+ value.each do |k, v|
167
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
168
+ end
169
+ end
170
+ else # model
171
+ # models (e.g. Pet) or oneOf
172
+ klass = Algolia::Ingestion.const_get(type)
173
+ klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
174
+ end
175
+ end
176
+
177
+ # Returns the string representation of the object
178
+ # @return [String] String presentation of the object
179
+ def to_s
180
+ to_hash.to_s
181
+ end
182
+
183
+ # to_body is an alias to to_hash (backward compatibility)
184
+ # @return [Hash] Returns the object in the form of hash
185
+ def to_body
186
+ to_hash
187
+ end
188
+
189
+ def to_json(*_args)
190
+ to_hash.to_json
191
+ end
192
+
193
+ # Returns the object in the form of hash
194
+ # @return [Hash] Returns the object in the form of hash
195
+ def to_hash
196
+ hash = {}
197
+ self.class.attribute_map.each_pair do |attr, param|
198
+ value = send(attr)
199
+ if value.nil?
200
+ is_nullable = self.class.openapi_nullable.include?(attr)
201
+ next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
202
+ end
203
+
204
+ hash[param] = _to_hash(value)
205
+ end
206
+ hash
207
+ end
208
+
209
+ # Outputs non-array value in the form of hash
210
+ # For object, use to_hash. Otherwise, just return the value
211
+ # @param [Object] value Any valid value
212
+ # @return [Hash] Returns the value in the form of hash
213
+ def _to_hash(value)
214
+ if value.is_a?(Array)
215
+ value.compact.map { |v| _to_hash(v) }
216
+ elsif value.is_a?(Hash)
217
+ {}.tap do |hash|
218
+ value.each { |k, v| hash[k] = _to_hash(v) }
219
+ end
220
+ elsif value.respond_to? :to_hash
221
+ value.to_hash
222
+ else
223
+ value
224
+ end
225
+ end
226
+ end
227
+ end
228
+ end
@@ -23,6 +23,7 @@ module Algolia
23
23
  # Date of last update (RFC3339 format).
24
24
  attr_accessor :updated_at
25
25
 
26
+ # The authentication UUID.
26
27
  attr_accessor :authentication_id
27
28
 
28
29
  class EnumAttributeValidator
@@ -14,6 +14,7 @@ module Algolia
14
14
 
15
15
  attr_accessor :input
16
16
 
17
+ # The authentication UUID.
17
18
  attr_accessor :authentication_id
18
19
 
19
20
  class EnumAttributeValidator
@@ -68,6 +68,8 @@ module Algolia
68
68
 
69
69
  if attributes.key?(:store_hash)
70
70
  self.store_hash = attributes[:store_hash]
71
+ else
72
+ self.store_hash = nil
71
73
  end
72
74
 
73
75
  if attributes.key?(:channel)
@@ -18,6 +18,8 @@ module Algolia
18
18
  # Determines the value that will be stored in the Algolia record if there's no inventory information on the product.
19
19
  attr_accessor :fallback_is_in_stock_value
20
20
 
21
+ attr_accessor :custom_fields
22
+
21
23
  # Attribute mapping from ruby-style variable name to JSON key.
22
24
  def self.attribute_map
23
25
  {
@@ -25,7 +27,8 @@ module Algolia
25
27
  :locales => :locales,
26
28
  :url => :url,
27
29
  :project_key => :projectKey,
28
- :fallback_is_in_stock_value => :fallbackIsInStockValue
30
+ :fallback_is_in_stock_value => :fallbackIsInStockValue,
31
+ :custom_fields => :customFields
29
32
  }
30
33
  end
31
34
 
@@ -41,7 +44,8 @@ module Algolia
41
44
  :locales => :'Array<String>',
42
45
  :url => :String,
43
46
  :project_key => :String,
44
- :fallback_is_in_stock_value => :Boolean
47
+ :fallback_is_in_stock_value => :Boolean,
48
+ :custom_fields => :CommercetoolsCustomFields
45
49
  }
46
50
  end
47
51
 
@@ -94,6 +98,10 @@ module Algolia
94
98
  if attributes.key?(:fallback_is_in_stock_value)
95
99
  self.fallback_is_in_stock_value = attributes[:fallback_is_in_stock_value]
96
100
  end
101
+
102
+ if attributes.key?(:custom_fields)
103
+ self.custom_fields = attributes[:custom_fields]
104
+ end
97
105
  end
98
106
 
99
107
  # Checks equality by comparing each attribute.
@@ -106,7 +114,8 @@ module Algolia
106
114
  locales == other.locales &&
107
115
  url == other.url &&
108
116
  project_key == other.project_key &&
109
- fallback_is_in_stock_value == other.fallback_is_in_stock_value
117
+ fallback_is_in_stock_value == other.fallback_is_in_stock_value &&
118
+ custom_fields == other.custom_fields
110
119
  end
111
120
 
112
121
  # @see the `==` method
@@ -118,7 +127,7 @@ module Algolia
118
127
  # Calculates hash code according to all attributes.
119
128
  # @return [Integer] Hash code
120
129
  def hash
121
- [store_keys, locales, url, project_key, fallback_is_in_stock_value].hash
130
+ [store_keys, locales, url, project_key, fallback_is_in_stock_value, custom_fields].hash
122
131
  end
123
132
 
124
133
  # Builds the object from hash
@@ -12,11 +12,14 @@ module Algolia
12
12
  # Array of locales that must match the following pattern: ^[a-z]{2}(-[A-Z]{2})?$. For example [\"fr-FR\", \"en\"].
13
13
  attr_accessor :locales
14
14
 
15
+ attr_accessor :custom_fields
16
+
15
17
  # Attribute mapping from ruby-style variable name to JSON key.
16
18
  def self.attribute_map
17
19
  {
18
20
  :store_keys => :storeKeys,
19
- :locales => :locales
21
+ :locales => :locales,
22
+ :custom_fields => :customFields
20
23
  }
21
24
  end
22
25
 
@@ -29,7 +32,8 @@ module Algolia
29
32
  def self.types_mapping
30
33
  {
31
34
  :store_keys => :'Array<String>',
32
- :locales => :'Array<String>'
35
+ :locales => :'Array<String>',
36
+ :custom_fields => :CommercetoolsCustomFields
33
37
  }
34
38
  end
35
39
 
@@ -66,6 +70,10 @@ module Algolia
66
70
  self.locales = value
67
71
  end
68
72
  end
73
+
74
+ if attributes.key?(:custom_fields)
75
+ self.custom_fields = attributes[:custom_fields]
76
+ end
69
77
  end
70
78
 
71
79
  # Checks equality by comparing each attribute.
@@ -75,7 +83,8 @@ module Algolia
75
83
 
76
84
  self.class == other.class &&
77
85
  store_keys == other.store_keys &&
78
- locales == other.locales
86
+ locales == other.locales &&
87
+ custom_fields == other.custom_fields
79
88
  end
80
89
 
81
90
  # @see the `==` method
@@ -87,7 +96,7 @@ module Algolia
87
96
  # Calculates hash code according to all attributes.
88
97
  # @return [Integer] Hash code
89
98
  def hash
90
- [store_keys, locales].hash
99
+ [store_keys, locales, custom_fields].hash
91
100
  end
92
101
 
93
102
  # Builds the object from hash
@@ -56,7 +56,8 @@ module Algolia
56
56
  # @return [Faraday::Connection]
57
57
  #
58
58
  def connection(host)
59
- @connections[build_url(host)] ||= Faraday.new(build_url(host)) do |f|
59
+ url = build_url(host)
60
+ @connections[url] ||= Faraday.new(url) do |f|
60
61
  f.adapter @adapter.to_sym
61
62
  end
62
63
  end
@@ -1,6 +1,7 @@
1
1
  require 'faraday'
2
2
  # this is the default adapter and it needs to be required to be registered.
3
3
  require 'faraday/net_http_persistent' unless Faraday::VERSION < '1'
4
+ require 'zlib'
4
5
 
5
6
  module Algolia
6
7
  module Transport
@@ -77,24 +78,38 @@ module Algolia
77
78
  request = {}
78
79
  request[:method] = method.downcase
79
80
  request[:path] = path
80
- request[:body] = body
81
+ request[:body] = build_body(body, request_options)
81
82
  request[:query_params] = stringify_query_params(request_options.query_params)
82
- request[:header_params] = generate_header_params(request_options)
83
+ request[:header_params] = generate_header_params(body, request_options)
83
84
  request[:timeout] = request_options.timeout
84
85
  request[:connect_timeout] = request_options.connect_timeout
85
86
  request
86
87
  end
87
88
 
89
+ # Builds the body of the request, with gzip compression if needed
90
+ def build_body(body, request_options)
91
+ return nil if body.nil?
92
+
93
+ if request_options.compression_type == 'gzip'
94
+ body = Zlib.gzip(body)
95
+ end
96
+
97
+ body
98
+ end
99
+
88
100
  # Generates headers from config headers and optional parameters
89
101
  #
90
102
  # @param request_options [RequestOptions]
91
103
  #
92
104
  # @return [Hash] merged headers
93
105
  #
94
- def generate_header_params(request_options = {})
106
+ def generate_header_params(body, request_options)
95
107
  header_params = request_options.header_params.transform_keys(&:downcase)
96
108
  header_params = @config.header_params.merge(header_params)
97
109
  header_params['accept-encoding'] = 'gzip' if request_options.compression_type == 'gzip'
110
+ if request_options.compression_type == 'gzip' && body.is_a?(String) && !body.to_s.strip.empty?
111
+ header_params['content-encoding'] = 'gzip'
112
+ end
98
113
 
99
114
  header_params
100
115
  end
@@ -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.alpha.7'.freeze
4
+ VERSION = '3.0.0.alpha.9'.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.alpha.7
4
+ version: 3.0.0.alpha.9
5
5
  platform: ruby
6
6
  authors:
7
7
  - Algolia
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2024-02-16 00:00:00.000000000 Z
11
+ date: 2024-02-20 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: faraday
@@ -221,6 +221,7 @@ files:
221
221
  - lib/algolia/models/ingestion/big_commerce_channel.rb
222
222
  - lib/algolia/models/ingestion/big_commerce_metafield.rb
223
223
  - lib/algolia/models/ingestion/big_query_data_type.rb
224
+ - lib/algolia/models/ingestion/commercetools_custom_fields.rb
224
225
  - lib/algolia/models/ingestion/delete_response.rb
225
226
  - lib/algolia/models/ingestion/destination.rb
226
227
  - lib/algolia/models/ingestion/destination_create.rb