algolia 3.0.0.alpha.6 → 3.0.0.alpha.7

Sign up to get free protection for your applications and to get access to all the features.
Files changed (34) hide show
  1. checksums.yaml +4 -4
  2. data/.openapi-generator/VERSION +1 -1
  3. data/CHANGELOG.md +4 -0
  4. data/Gemfile.lock +2 -2
  5. data/lib/algolia/api/abtesting_client.rb +41 -21
  6. data/lib/algolia/api/analytics_client.rb +111 -43
  7. data/lib/algolia/api/ingestion_client.rb +334 -94
  8. data/lib/algolia/api/insights_client.rb +13 -13
  9. data/lib/algolia/api/monitoring_client.rb +32 -33
  10. data/lib/algolia/api/personalization_client.rb +34 -18
  11. data/lib/algolia/api/query_suggestions_client.rb +55 -27
  12. data/lib/algolia/api/recommend_client.rb +46 -26
  13. data/lib/algolia/api/search_client.rb +459 -171
  14. data/lib/algolia/api_client.rb +0 -4
  15. data/lib/algolia/models/abtesting/ab_test.rb +7 -1
  16. data/lib/algolia/models/abtesting/list_ab_tests_response.rb +3 -1
  17. data/lib/algolia/models/abtesting/variant.rb +24 -5
  18. data/lib/algolia/models/analytics/click_through_rate_event.rb +3 -1
  19. data/lib/algolia/models/analytics/conversion_rate_event.rb +3 -1
  20. data/lib/algolia/models/analytics/get_click_through_rate_response.rb +3 -1
  21. data/lib/algolia/models/analytics/get_conversation_rate_response.rb +3 -1
  22. data/lib/algolia/models/analytics/top_hit_with_analytics.rb +3 -1
  23. data/lib/algolia/models/analytics/top_search_with_analytics.rb +3 -1
  24. data/lib/algolia/models/query-suggestions/base_query_suggestions_configuration_response.rb +1 -11
  25. data/lib/algolia/models/query-suggestions/query_suggestions_configuration_response.rb +1 -11
  26. data/lib/algolia/models/recommend/highlight_result.rb +1 -0
  27. data/lib/algolia/models/recommend/snippet_result.rb +1 -0
  28. data/lib/algolia/models/search/highlight_result.rb +1 -0
  29. data/lib/algolia/models/search/snippet_result.rb +1 -0
  30. data/lib/algolia/transport/http/http_requester.rb +2 -2
  31. data/lib/algolia/transport/stateful_host.rb +2 -1
  32. data/lib/algolia/transport/transport.rb +7 -4
  33. data/lib/algolia/version.rb +1 -1
  34. metadata +2 -2
@@ -146,9 +146,5 @@ module Algolia
146
146
  raise "unknown collection format: #{collection_format.inspect}"
147
147
  end
148
148
  end
149
-
150
- def encode_uri(uri)
151
- CGI.escape(uri).gsub('+', '%20')
152
- end
153
149
  end
154
150
  end
@@ -85,7 +85,13 @@ module Algolia
85
85
 
86
86
  # List of attributes with nullable: true
87
87
  def self.openapi_nullable
88
- Set.new([])
88
+ Set.new([
89
+ :click_significance,
90
+ :conversion_significance,
91
+ :add_to_cart_significance,
92
+ :purchase_significance,
93
+ :revenue_significance
94
+ ])
89
95
  end
90
96
 
91
97
  # Initializes the object
@@ -40,7 +40,9 @@ module Algolia
40
40
 
41
41
  # List of attributes with nullable: true
42
42
  def self.openapi_nullable
43
- Set.new([])
43
+ Set.new([
44
+ :abtests
45
+ ])
44
46
  end
45
47
 
46
48
  # Initializes the object
@@ -33,6 +33,9 @@ module Algolia
33
33
  # A/B test description.
34
34
  attr_accessor :description
35
35
 
36
+ # The estimated number of searches that will need to be run to achieve the desired confidence level and statistical power. A `minimumDetectableEffect` must be set in the `configuration` object for this to be used.
37
+ attr_accessor :estimated_sample_size
38
+
36
39
  attr_accessor :filter_effects
37
40
 
38
41
  # A/B test index.
@@ -74,6 +77,7 @@ module Algolia
74
77
  :conversion_rate => :conversionRate,
75
78
  :currencies => :currencies,
76
79
  :description => :description,
80
+ :estimated_sample_size => :estimatedSampleSize,
77
81
  :filter_effects => :filterEffects,
78
82
  :index => :index,
79
83
  :no_result_count => :noResultCount,
@@ -104,6 +108,7 @@ module Algolia
104
108
  :conversion_rate => :Float,
105
109
  :currencies => :'Hash<String, CurrenciesValue>',
106
110
  :description => :String,
111
+ :estimated_sample_size => :Integer,
107
112
  :filter_effects => :FilterEffects,
108
113
  :index => :String,
109
114
  :no_result_count => :Integer,
@@ -119,7 +124,18 @@ module Algolia
119
124
 
120
125
  # List of attributes with nullable: true
121
126
  def self.openapi_nullable
122
- Set.new([])
127
+ Set.new([
128
+ :add_to_cart_rate,
129
+ :average_click_position,
130
+ :click_through_rate,
131
+ :conversion_rate,
132
+ :no_result_count,
133
+ :purchase_rate,
134
+ :search_count,
135
+ :tracked_search_count,
136
+ :user_count,
137
+ :tracked_user_count
138
+ ])
123
139
  end
124
140
 
125
141
  # Initializes the object
@@ -185,8 +201,6 @@ module Algolia
185
201
  if (value = attributes[:currencies]).is_a?(Hash)
186
202
  self.currencies = value
187
203
  end
188
- else
189
- self.currencies = nil
190
204
  end
191
205
 
192
206
  if attributes.key?(:description)
@@ -195,6 +209,10 @@ module Algolia
195
209
  self.description = nil
196
210
  end
197
211
 
212
+ if attributes.key?(:estimated_sample_size)
213
+ self.estimated_sample_size = attributes[:estimated_sample_size]
214
+ end
215
+
198
216
  if attributes.key?(:filter_effects)
199
217
  self.filter_effects = attributes[:filter_effects]
200
218
  end
@@ -269,6 +287,7 @@ module Algolia
269
287
  conversion_rate == other.conversion_rate &&
270
288
  currencies == other.currencies &&
271
289
  description == other.description &&
290
+ estimated_sample_size == other.estimated_sample_size &&
272
291
  filter_effects == other.filter_effects &&
273
292
  index == other.index &&
274
293
  no_result_count == other.no_result_count &&
@@ -290,8 +309,8 @@ module Algolia
290
309
  # Calculates hash code according to all attributes.
291
310
  # @return [Integer] Hash code
292
311
  def hash
293
- [add_to_cart_count, add_to_cart_rate, average_click_position, click_count, click_through_rate, conversion_count, conversion_rate, currencies, description, filter_effects,
294
- index, no_result_count, purchase_count, purchase_rate, search_count, tracked_search_count, traffic_percentage, user_count, tracked_user_count].hash
312
+ [add_to_cart_count, add_to_cart_rate, average_click_position, click_count, click_through_rate, conversion_count, conversion_rate, currencies, description,
313
+ estimated_sample_size, filter_effects, index, no_result_count, purchase_count, purchase_rate, search_count, tracked_search_count, traffic_percentage, user_count, tracked_user_count].hash
295
314
  end
296
315
 
297
316
  # Builds the object from hash
@@ -45,7 +45,9 @@ module Algolia
45
45
 
46
46
  # List of attributes with nullable: true
47
47
  def self.openapi_nullable
48
- Set.new([])
48
+ Set.new([
49
+ :tracked_search_count
50
+ ])
49
51
  end
50
52
 
51
53
  # Initializes the object
@@ -45,7 +45,9 @@ module Algolia
45
45
 
46
46
  # List of attributes with nullable: true
47
47
  def self.openapi_nullable
48
- Set.new([])
48
+ Set.new([
49
+ :tracked_search_count
50
+ ])
49
51
  end
50
52
 
51
53
  # Initializes the object
@@ -45,7 +45,9 @@ module Algolia
45
45
 
46
46
  # List of attributes with nullable: true
47
47
  def self.openapi_nullable
48
- Set.new([])
48
+ Set.new([
49
+ :tracked_search_count
50
+ ])
49
51
  end
50
52
 
51
53
  # Initializes the object
@@ -45,7 +45,9 @@ module Algolia
45
45
 
46
46
  # List of attributes with nullable: true
47
47
  def self.openapi_nullable
48
- Set.new([])
48
+ Set.new([
49
+ :tracked_search_count
50
+ ])
49
51
  end
50
52
 
51
53
  # Initializes the object
@@ -60,7 +60,9 @@ module Algolia
60
60
 
61
61
  # List of attributes with nullable: true
62
62
  def self.openapi_nullable
63
- Set.new([])
63
+ Set.new([
64
+ :tracked_search_count
65
+ ])
64
66
  end
65
67
 
66
68
  # Initializes the object
@@ -70,7 +70,9 @@ module Algolia
70
70
 
71
71
  # List of attributes with nullable: true
72
72
  def self.openapi_nullable
73
- Set.new([])
73
+ Set.new([
74
+ :tracked_search_count
75
+ ])
74
76
  end
75
77
 
76
78
  # Initializes the object
@@ -6,9 +6,6 @@ require 'time'
6
6
  module Algolia
7
7
  module QuerySuggestions
8
8
  class BaseQuerySuggestionsConfigurationResponse
9
- # Your Algolia application ID.
10
- attr_accessor :app_id
11
-
12
9
  # API key used to read from your source index.
13
10
  attr_accessor :source_indices_api_key
14
11
 
@@ -21,7 +18,6 @@ module Algolia
21
18
  # Attribute mapping from ruby-style variable name to JSON key.
22
19
  def self.attribute_map
23
20
  {
24
- :app_id => :appId,
25
21
  :source_indices_api_key => :sourceIndicesAPIKey,
26
22
  :suggestions_indices_api_key => :suggestionsIndicesAPIKey,
27
23
  :external_indices_api_key => :externalIndicesAPIKey
@@ -36,7 +32,6 @@ module Algolia
36
32
  # Attribute type mapping.
37
33
  def self.types_mapping
38
34
  {
39
- :app_id => :String,
40
35
  :source_indices_api_key => :String,
41
36
  :suggestions_indices_api_key => :String,
42
37
  :external_indices_api_key => :String
@@ -65,10 +60,6 @@ module Algolia
65
60
  h[k.to_sym] = v
66
61
  end
67
62
 
68
- if attributes.key?(:app_id)
69
- self.app_id = attributes[:app_id]
70
- end
71
-
72
63
  if attributes.key?(:source_indices_api_key)
73
64
  self.source_indices_api_key = attributes[:source_indices_api_key]
74
65
  end
@@ -88,7 +79,6 @@ module Algolia
88
79
  return true if equal?(other)
89
80
 
90
81
  self.class == other.class &&
91
- app_id == other.app_id &&
92
82
  source_indices_api_key == other.source_indices_api_key &&
93
83
  suggestions_indices_api_key == other.suggestions_indices_api_key &&
94
84
  external_indices_api_key == other.external_indices_api_key
@@ -103,7 +93,7 @@ module Algolia
103
93
  # Calculates hash code according to all attributes.
104
94
  # @return [Integer] Hash code
105
95
  def hash
106
- [app_id, source_indices_api_key, suggestions_indices_api_key, external_indices_api_key].hash
96
+ [source_indices_api_key, suggestions_indices_api_key, external_indices_api_key].hash
107
97
  end
108
98
 
109
99
  # Builds the object from hash
@@ -6,9 +6,6 @@ require 'time'
6
6
  module Algolia
7
7
  module QuerySuggestions
8
8
  class QuerySuggestionsConfigurationResponse
9
- # Your Algolia application ID.
10
- attr_accessor :app_id
11
-
12
9
  # API key used to read from your source index.
13
10
  attr_accessor :source_indices_api_key
14
11
 
@@ -38,7 +35,6 @@ module Algolia
38
35
  # Attribute mapping from ruby-style variable name to JSON key.
39
36
  def self.attribute_map
40
37
  {
41
- :app_id => :appId,
42
38
  :source_indices_api_key => :sourceIndicesAPIKey,
43
39
  :suggestions_indices_api_key => :suggestionsIndicesAPIKey,
44
40
  :external_indices_api_key => :externalIndicesAPIKey,
@@ -59,7 +55,6 @@ module Algolia
59
55
  # Attribute type mapping.
60
56
  def self.types_mapping
61
57
  {
62
- :app_id => :String,
63
58
  :source_indices_api_key => :String,
64
59
  :suggestions_indices_api_key => :String,
65
60
  :external_indices_api_key => :String,
@@ -104,10 +99,6 @@ module Algolia
104
99
  h[k.to_sym] = v
105
100
  end
106
101
 
107
- if attributes.key?(:app_id)
108
- self.app_id = attributes[:app_id]
109
- end
110
-
111
102
  if attributes.key?(:source_indices_api_key)
112
103
  self.source_indices_api_key = attributes[:source_indices_api_key]
113
104
  end
@@ -173,7 +164,6 @@ module Algolia
173
164
  return true if equal?(other)
174
165
 
175
166
  self.class == other.class &&
176
- app_id == other.app_id &&
177
167
  source_indices_api_key == other.source_indices_api_key &&
178
168
  suggestions_indices_api_key == other.suggestions_indices_api_key &&
179
169
  external_indices_api_key == other.external_indices_api_key &&
@@ -194,7 +184,7 @@ module Algolia
194
184
  # Calculates hash code according to all attributes.
195
185
  # @return [Integer] Hash code
196
186
  def hash
197
- [app_id, source_indices_api_key, suggestions_indices_api_key, external_indices_api_key, index_name, source_indices, languages, exclude, enable_personalization,
187
+ [source_indices_api_key, suggestions_indices_api_key, external_indices_api_key, index_name, source_indices, languages, exclude, enable_personalization,
198
188
  allow_special_characters].hash
199
189
  end
200
190
 
@@ -10,6 +10,7 @@ module Algolia
10
10
  # List of class defined in oneOf (OpenAPI v3)
11
11
  def openapi_one_of
12
12
  [
13
+ :'Array<HighlightResultOption>',
13
14
  :'Hash<String, HighlightResultOption>',
14
15
  :HighlightResultOption
15
16
  ]
@@ -10,6 +10,7 @@ module Algolia
10
10
  # List of class defined in oneOf (OpenAPI v3)
11
11
  def openapi_one_of
12
12
  [
13
+ :'Array<SnippetResultOption>',
13
14
  :'Hash<String, SnippetResultOption>',
14
15
  :SnippetResultOption
15
16
  ]
@@ -10,6 +10,7 @@ module Algolia
10
10
  # List of class defined in oneOf (OpenAPI v3)
11
11
  def openapi_one_of
12
12
  [
13
+ :'Array<HighlightResultOption>',
13
14
  :'Hash<String, HighlightResultOption>',
14
15
  :HighlightResultOption
15
16
  ]
@@ -10,6 +10,7 @@ module Algolia
10
10
  # List of class defined in oneOf (OpenAPI v3)
11
11
  def openapi_one_of
12
12
  [
13
+ :'Array<SnippetResultOption>',
13
14
  :'Hash<String, SnippetResultOption>',
14
15
  :SnippetResultOption
15
16
  ]
@@ -56,7 +56,7 @@ module Algolia
56
56
  # @return [Faraday::Connection]
57
57
  #
58
58
  def connection(host)
59
- @connections[host.url] ||= Faraday.new(build_url(host)) do |f|
59
+ @connections[build_url(host)] ||= Faraday.new(build_url(host)) do |f|
60
60
  f.adapter @adapter.to_sym
61
61
  end
62
62
  end
@@ -68,7 +68,7 @@ module Algolia
68
68
  # @return [String]
69
69
  #
70
70
  def build_url(host)
71
- host.protocol + host.url
71
+ host.protocol + host.url + (host.port.nil? ? '' : ":#{host.port}")
72
72
  end
73
73
 
74
74
  # Convert query_params to a full query string
@@ -3,7 +3,7 @@ module Algolia
3
3
  class StatefulHost
4
4
  include CallType
5
5
 
6
- attr_reader :url, :protocol, :accept
6
+ attr_reader :url, :protocol, :accept, :port
7
7
  attr_accessor :last_use, :retry_count, :up
8
8
 
9
9
  # @param url [String] host url
@@ -15,6 +15,7 @@ module Algolia
15
15
  def initialize(url, opts = {})
16
16
  @url = url
17
17
  @protocol = opts[:protocol] || 'https://'
18
+ @port = opts[:port]
18
19
  @accept = opts[:accept] || (READ | WRITE)
19
20
  @last_use = opts[:last_use] || Time.now.utc
20
21
  @retry_count = opts[:retry_count] || 0
@@ -4,6 +4,10 @@ require 'faraday/net_http_persistent' unless Faraday::VERSION < '1'
4
4
 
5
5
  module Algolia
6
6
  module Transport
7
+ def self.encode_uri(uri)
8
+ CGI.escape(uri).gsub('+', '%20')
9
+ end
10
+
7
11
  class Transport
8
12
  include RetryOutcomeType
9
13
  include CallType
@@ -50,13 +54,12 @@ module Algolia
50
54
  outcome = @retry_strategy.decide(host, http_response_code: response.status, is_timed_out: response.has_timed_out, network_failure: response.network_failure)
51
55
  if outcome == FAILURE
52
56
  decoded_error = JSON.parse(response.error, :symbolize_names => true)
53
- puts decoded_error
54
- raise AlgoliaHttpError.new(decoded_error[:status], decoded_error[:message])
57
+ raise Algolia::AlgoliaHttpError.new(decoded_error[:status], decoded_error[:message])
55
58
  end
56
59
  return response unless outcome == RETRY
57
60
  end
58
61
 
59
- raise Algolia::AlgoliaUnreachableHostError('Unreachable hosts')
62
+ raise Algolia::AlgoliaUnreachableHostError, 'Unreachable hosts'
60
63
  end
61
64
 
62
65
  private
@@ -114,7 +117,7 @@ module Algolia
114
117
  def stringify_query_params(query_params)
115
118
  query_params.to_h do |key, value|
116
119
  value = value.join(',') if value.is_a?(Array)
117
- [key, value.to_s]
120
+ [Algolia::Transport.encode_uri(key.to_s).to_sym, Algolia::Transport.encode_uri(value.to_s)]
118
121
  end
119
122
  end
120
123
  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.6'.freeze
4
+ VERSION = '3.0.0.alpha.7'.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.6
4
+ version: 3.0.0.alpha.7
5
5
  platform: ruby
6
6
  authors:
7
7
  - Algolia
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2024-01-23 00:00:00.000000000 Z
11
+ date: 2024-02-16 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: faraday