algolia 3.0.0.alpha.7 → 3.0.0.alpha.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: f178243d901a09bdc7e4c0e3b47e2c2c7f0ca3d20db76e7b310f16f6e1b9f3d0
4
- data.tar.gz: c1d301f0c071472df043614b2d7cce87aa809694c0fba5c790abec1e17483fa1
3
+ metadata.gz: 3d10bc5a4416ac58ae021790e9690899657e2bb99bdb2db0545d0e66071768e7
4
+ data.tar.gz: 8ba97103d301846b9dac5a00b6e3438865b6f7754e2f105142557ada23a21ba1
5
5
  SHA512:
6
- metadata.gz: 51da927c52fb523660c1b45718517cfc805d235fec4f4da35294f93d5cb93dc9a56ec9750bd9086fa23d4a54c9bcd7c6ad0afa672634577b4edca45784220e75
7
- data.tar.gz: 8cd4e5732f6721eadfeb595b7928b21f152734fa8cfcdedc0a53bfb938f887bd7b99173759c72c1c95e08215e6218ff618fd6fe32d402af41ab6338de3d33e92
6
+ metadata.gz: 97eee1cc7661f4c159b9254f1c1355a37b3394bb306ba68f26165f027ae8f49fb5b6f6c287d1d62a3e9c50d63e160a63564f11b00f9ecaf4247d2efeceed907e
7
+ data.tar.gz: 65a63a9ba144c499d608e86efb1e92715433a80a68620079c8c66be96fafc238fd75ffed2bf7ffa4614a5f34727acbe534933fff5870d809e37ac748ede06b5a
data/CHANGELOG.md CHANGED
@@ -1,3 +1,8 @@
1
+ ## [3.0.0.alpha.8](https://github.com/algolia/algoliasearch-client-ruby/compare/3.0.0.alpha.7...3.0.0.alpha.8)
2
+
3
+ - [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/)
4
+ - [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/)
5
+
1
6
  ## [3.0.0.alpha.7](https://github.com/algolia/algoliasearch-client-ruby/compare/3.0.0.alpha.6...3.0.0.alpha.7)
2
7
 
3
8
  - [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.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 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,224 @@
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
+ end
46
+
47
+ # Initializes the object
48
+ # @param [Hash] attributes Model attributes in the form of hash
49
+ def initialize(attributes = {})
50
+ unless attributes.is_a?(Hash)
51
+ raise ArgumentError, "The input argument (attributes) must be a hash in `Algolia::CommercetoolsCustomFields` initialize method"
52
+ end
53
+
54
+ # check to see if the attribute exists and convert string to symbol for hash key
55
+ attributes = attributes.each_with_object({}) do |(k, v), h|
56
+ unless self.class.attribute_map.key?(k.to_sym)
57
+ raise ArgumentError,
58
+ "`#{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
59
+ end
60
+
61
+ h[k.to_sym] = v
62
+ end
63
+
64
+ if attributes.key?(:inventory)
65
+ if (value = attributes[:inventory]).is_a?(Array)
66
+ self.inventory = value
67
+ end
68
+ end
69
+
70
+ if attributes.key?(:price)
71
+ if (value = attributes[:price]).is_a?(Array)
72
+ self.price = value
73
+ end
74
+ end
75
+
76
+ if attributes.key?(:category)
77
+ if (value = attributes[:category]).is_a?(Array)
78
+ self.category = value
79
+ end
80
+ end
81
+ end
82
+
83
+ # Checks equality by comparing each attribute.
84
+ # @param [Object] Object to be compared
85
+ def ==(other)
86
+ return true if equal?(other)
87
+
88
+ self.class == other.class &&
89
+ inventory == other.inventory &&
90
+ price == other.price &&
91
+ category == other.category
92
+ end
93
+
94
+ # @see the `==` method
95
+ # @param [Object] Object to be compared
96
+ def eql?(other)
97
+ self == other
98
+ end
99
+
100
+ # Calculates hash code according to all attributes.
101
+ # @return [Integer] Hash code
102
+ def hash
103
+ [inventory, price, category].hash
104
+ end
105
+
106
+ # Builds the object from hash
107
+ # @param [Hash] attributes Model attributes in the form of hash
108
+ # @return [Object] Returns the model itself
109
+ def self.build_from_hash(attributes)
110
+ return nil unless attributes.is_a?(Hash)
111
+
112
+ attributes = attributes.transform_keys(&:to_sym)
113
+ transformed_hash = {}
114
+ types_mapping.each_pair do |key, type|
115
+ if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil?
116
+ transformed_hash[key.to_sym] = nil
117
+ elsif type =~ /\AArray<(.*)>/i
118
+ # check to ensure the input is an array given that the attribute
119
+ # is documented as an array but the input is not
120
+ if attributes[attribute_map[key]].is_a?(Array)
121
+ transformed_hash[key.to_sym] = attributes[attribute_map[key]].map { |v| _deserialize(::Regexp.last_match(1), v) }
122
+ end
123
+ elsif !attributes[attribute_map[key]].nil?
124
+ transformed_hash[key.to_sym] = _deserialize(type, attributes[attribute_map[key]])
125
+ end
126
+ end
127
+ new(transformed_hash)
128
+ end
129
+
130
+ # Deserializes the data based on type
131
+ # @param string type Data type
132
+ # @param string value Value to be deserialized
133
+ # @return [Object] Deserialized data
134
+ def self._deserialize(type, value)
135
+ case type.to_sym
136
+ when :Time
137
+ Time.parse(value)
138
+ when :Date
139
+ Date.parse(value)
140
+ when :String
141
+ value.to_s
142
+ when :Integer
143
+ value.to_i
144
+ when :Float
145
+ value.to_f
146
+ when :Boolean
147
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
148
+ true
149
+ else
150
+ false
151
+ end
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
+ else # model
167
+ # models (e.g. Pet) or oneOf
168
+ klass = Algolia::Ingestion.const_get(type)
169
+ klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
170
+ end
171
+ end
172
+
173
+ # Returns the string representation of the object
174
+ # @return [String] String presentation of the object
175
+ def to_s
176
+ to_hash.to_s
177
+ end
178
+
179
+ # to_body is an alias to to_hash (backward compatibility)
180
+ # @return [Hash] Returns the object in the form of hash
181
+ def to_body
182
+ to_hash
183
+ end
184
+
185
+ def to_json(*_args)
186
+ to_hash.to_json
187
+ end
188
+
189
+ # Returns the object in the form of hash
190
+ # @return [Hash] Returns the object in the form of hash
191
+ def to_hash
192
+ hash = {}
193
+ self.class.attribute_map.each_pair do |attr, param|
194
+ value = send(attr)
195
+ if value.nil?
196
+ is_nullable = self.class.openapi_nullable.include?(attr)
197
+ next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
198
+ end
199
+
200
+ hash[param] = _to_hash(value)
201
+ end
202
+ hash
203
+ end
204
+
205
+ # Outputs non-array value in the form of hash
206
+ # For object, use to_hash. Otherwise, just return the value
207
+ # @param [Object] value Any valid value
208
+ # @return [Hash] Returns the value in the form of hash
209
+ def _to_hash(value)
210
+ if value.is_a?(Array)
211
+ value.compact.map { |v| _to_hash(v) }
212
+ elsif value.is_a?(Hash)
213
+ {}.tap do |hash|
214
+ value.each { |k, v| hash[k] = _to_hash(v) }
215
+ end
216
+ elsif value.respond_to? :to_hash
217
+ value.to_hash
218
+ else
219
+ value
220
+ end
221
+ end
222
+ end
223
+ end
224
+ 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.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.alpha.7
4
+ version: 3.0.0.alpha.8
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