algolia 3.7.1 → 3.8.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +5 -0
- data/Gemfile.lock +1 -1
- data/lib/algolia/api/abtesting_client.rb +44 -0
- data/lib/algolia/models/abtesting/{effect.rb → effect_metric.rb} +3 -3
- data/lib/algolia/models/abtesting/estimate_ab_test_request.rb +227 -0
- data/lib/algolia/models/abtesting/estimate_ab_test_response.rb +224 -0
- data/lib/algolia/models/abtesting/estimate_configuration.rb +232 -0
- data/lib/algolia/models/abtesting/minimum_detectable_effect.rb +11 -7
- data/lib/algolia/models/ingestion/task.rb +0 -2
- data/lib/algolia/models/ingestion/task_v1.rb +0 -2
- data/lib/algolia/version.rb +1 -1
- metadata +6 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 78f8f133aabc7a4e26ef0d03cec1bf249668e8ca3f2262dfe3651f2cc3a03f3d
|
4
|
+
data.tar.gz: 4cf06a16860371429af9a5135b491c294ba68f9e162a7b5418fd03eca409bc3d
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 2012ce78d9c053ee7512de20223f274522b38986bf2064278aa00b157ba220a5339cd1a9bdb7e5c80d5ed14df80757fce5b2f312ff22492cece79309a3178fbd
|
7
|
+
data.tar.gz: 9a626f040e6ee439bcaad40d61e1dc8cf4455f536edc06986cbcafcb3d5ca85dda8efed0ac8fc0e9cdea82f81a64cca51004577aa78340953702ae4792799d84
|
data/CHANGELOG.md
CHANGED
@@ -1,3 +1,8 @@
|
|
1
|
+
## [3.8.0](https://github.com/algolia/algoliasearch-client-ruby/compare/3.7.1...3.8.0)
|
2
|
+
|
3
|
+
- [4c73f4c9a](https://github.com/algolia/api-clients-automation/commit/4c73f4c9a) feat(specs): add estimate path and responses ([#4057](https://github.com/algolia/api-clients-automation/pull/4057)) by [@cdhawke](https://github.com/cdhawke/)
|
4
|
+
- [39ad05495](https://github.com/algolia/api-clients-automation/commit/39ad05495) feat(specs): update estimate response type ([#4101](https://github.com/algolia/api-clients-automation/pull/4101)) by [@cdhawke](https://github.com/cdhawke/)
|
5
|
+
|
1
6
|
## [3.7.1](https://github.com/algolia/algoliasearch-client-ruby/compare/3.7.0...3.7.1)
|
2
7
|
|
3
8
|
- [801241e12](https://github.com/algolia/api-clients-automation/commit/801241e12) fix(specs): add secrets payload for updates ([#4061](https://github.com/algolia/api-clients-automation/pull/4061)) by [@shortcuts](https://github.com/shortcuts/)
|
data/Gemfile.lock
CHANGED
@@ -319,6 +319,50 @@ module Algolia
|
|
319
319
|
@api_client.deserialize(response.body, request_options[:debug_return_type] || "Abtesting::ABTestResponse")
|
320
320
|
end
|
321
321
|
|
322
|
+
# Given the traffic percentage and the expected effect size, this endpoint estimates the sample size and duration of an A/B test based on historical traffic.
|
323
|
+
#
|
324
|
+
# Required API Key ACLs:
|
325
|
+
# - analytics
|
326
|
+
# @param estimate_ab_test_request [EstimateABTestRequest] (required)
|
327
|
+
# @param request_options: The request options to send along with the query, they will be merged with the transporter base parameters (headers, query params, timeouts, etc.). (optional)
|
328
|
+
# @return [Http::Response] the response
|
329
|
+
def estimate_ab_test_with_http_info(estimate_ab_test_request, request_options = {})
|
330
|
+
# verify the required parameter 'estimate_ab_test_request' is set
|
331
|
+
if @api_client.config.client_side_validation && estimate_ab_test_request.nil?
|
332
|
+
raise ArgumentError, "Parameter `estimate_ab_test_request` is required when calling `estimate_ab_test`."
|
333
|
+
end
|
334
|
+
|
335
|
+
path = "/2/abtests/estimate"
|
336
|
+
query_params = {}
|
337
|
+
query_params = query_params.merge(request_options[:query_params]) unless request_options[:query_params].nil?
|
338
|
+
header_params = {}
|
339
|
+
header_params = header_params.merge(request_options[:header_params]) unless request_options[:header_params].nil?
|
340
|
+
|
341
|
+
post_body = request_options[:debug_body] || @api_client.object_to_http_body(estimate_ab_test_request)
|
342
|
+
|
343
|
+
new_options = request_options.merge(
|
344
|
+
:operation => :"AbtestingClient.estimate_ab_test",
|
345
|
+
:header_params => header_params,
|
346
|
+
:query_params => query_params,
|
347
|
+
:body => post_body,
|
348
|
+
:use_read_transporter => false
|
349
|
+
)
|
350
|
+
|
351
|
+
@api_client.call_api(:POST, path, new_options)
|
352
|
+
end
|
353
|
+
|
354
|
+
# Given the traffic percentage and the expected effect size, this endpoint estimates the sample size and duration of an A/B test based on historical traffic.
|
355
|
+
#
|
356
|
+
# Required API Key ACLs:
|
357
|
+
# - analytics
|
358
|
+
# @param estimate_ab_test_request [EstimateABTestRequest] (required)
|
359
|
+
# @param request_options: The request options to send along with the query, they will be merged with the transporter base parameters (headers, query params, timeouts, etc.). (optional)
|
360
|
+
# @return [EstimateABTestResponse]
|
361
|
+
def estimate_ab_test(estimate_ab_test_request, request_options = {})
|
362
|
+
response = estimate_ab_test_with_http_info(estimate_ab_test_request, request_options)
|
363
|
+
@api_client.deserialize(response.body, request_options[:debug_return_type] || "Abtesting::EstimateABTestResponse")
|
364
|
+
end
|
365
|
+
|
322
366
|
# Retrieves the details for an A/B test by its ID.
|
323
367
|
#
|
324
368
|
# Required API Key ACLs:
|
@@ -5,7 +5,7 @@ require "time"
|
|
5
5
|
|
6
6
|
module Algolia
|
7
7
|
module Abtesting
|
8
|
-
class
|
8
|
+
class EffectMetric
|
9
9
|
ADD_TO_CART_RATE = "addToCartRate".freeze
|
10
10
|
CLICK_THROUGH_RATE = "clickThroughRate".freeze
|
11
11
|
CONVERSION_RATE = "conversionRate".freeze
|
@@ -26,8 +26,8 @@ module Algolia
|
|
26
26
|
# @param [String] The enum value in the form of the string
|
27
27
|
# @return [String] The enum value
|
28
28
|
def build_from_hash(value)
|
29
|
-
return value if
|
30
|
-
raise "Invalid ENUM value #{value} for class #
|
29
|
+
return value if EffectMetric.all_vars.include?(value)
|
30
|
+
raise "Invalid ENUM value #{value} for class #EffectMetric"
|
31
31
|
end
|
32
32
|
end
|
33
33
|
end
|
@@ -0,0 +1,227 @@
|
|
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 Abtesting
|
8
|
+
class EstimateABTestRequest
|
9
|
+
attr_accessor :configuration
|
10
|
+
|
11
|
+
# A/B test variants.
|
12
|
+
attr_accessor :variants
|
13
|
+
|
14
|
+
# Attribute mapping from ruby-style variable name to JSON key.
|
15
|
+
def self.attribute_map
|
16
|
+
{
|
17
|
+
:configuration => :configuration,
|
18
|
+
:variants => :variants
|
19
|
+
}
|
20
|
+
end
|
21
|
+
|
22
|
+
# Returns all the JSON keys this model knows about
|
23
|
+
def self.acceptable_attributes
|
24
|
+
attribute_map.values
|
25
|
+
end
|
26
|
+
|
27
|
+
# Attribute type mapping.
|
28
|
+
def self.types_mapping
|
29
|
+
{
|
30
|
+
:configuration => :"EstimateConfiguration",
|
31
|
+
:variants => :"Array<AddABTestsVariant>"
|
32
|
+
}
|
33
|
+
end
|
34
|
+
|
35
|
+
# List of attributes with nullable: true
|
36
|
+
def self.openapi_nullable
|
37
|
+
Set.new(
|
38
|
+
[]
|
39
|
+
)
|
40
|
+
end
|
41
|
+
|
42
|
+
# Initializes the object
|
43
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
44
|
+
def initialize(attributes = {})
|
45
|
+
if (!attributes.is_a?(Hash))
|
46
|
+
raise(
|
47
|
+
ArgumentError,
|
48
|
+
"The input argument (attributes) must be a hash in `Algolia::EstimateABTestRequest` initialize method"
|
49
|
+
)
|
50
|
+
end
|
51
|
+
|
52
|
+
# check to see if the attribute exists and convert string to symbol for hash key
|
53
|
+
attributes = attributes.each_with_object({}) { |(k, v), h|
|
54
|
+
if (!self.class.attribute_map.key?(k.to_sym))
|
55
|
+
raise(
|
56
|
+
ArgumentError,
|
57
|
+
"`#{k}` is not a valid attribute in `Algolia::EstimateABTestRequest`. Please check the name to make sure it's valid. List of attributes: " +
|
58
|
+
self.class.attribute_map.keys.inspect
|
59
|
+
)
|
60
|
+
end
|
61
|
+
|
62
|
+
h[k.to_sym] = v
|
63
|
+
}
|
64
|
+
|
65
|
+
if attributes.key?(:configuration)
|
66
|
+
self.configuration = attributes[:configuration]
|
67
|
+
else
|
68
|
+
self.configuration = nil
|
69
|
+
end
|
70
|
+
|
71
|
+
if attributes.key?(:variants)
|
72
|
+
if (value = attributes[:variants]).is_a?(Array)
|
73
|
+
self.variants = value
|
74
|
+
end
|
75
|
+
else
|
76
|
+
self.variants = nil
|
77
|
+
end
|
78
|
+
end
|
79
|
+
|
80
|
+
# Checks equality by comparing each attribute.
|
81
|
+
# @param [Object] Object to be compared
|
82
|
+
def ==(other)
|
83
|
+
return true if self.equal?(other)
|
84
|
+
self.class == other.class &&
|
85
|
+
configuration == other.configuration &&
|
86
|
+
variants == other.variants
|
87
|
+
end
|
88
|
+
|
89
|
+
# @see the `==` method
|
90
|
+
# @param [Object] Object to be compared
|
91
|
+
def eql?(other)
|
92
|
+
self == other
|
93
|
+
end
|
94
|
+
|
95
|
+
# Calculates hash code according to all attributes.
|
96
|
+
# @return [Integer] Hash code
|
97
|
+
def hash
|
98
|
+
[configuration, variants].hash
|
99
|
+
end
|
100
|
+
|
101
|
+
# Builds the object from hash
|
102
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
103
|
+
# @return [Object] Returns the model itself
|
104
|
+
def self.build_from_hash(attributes)
|
105
|
+
return nil unless attributes.is_a?(Hash)
|
106
|
+
attributes = attributes.transform_keys(&:to_sym)
|
107
|
+
transformed_hash = {}
|
108
|
+
types_mapping.each_pair do |key, type|
|
109
|
+
if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil?
|
110
|
+
transformed_hash[key.to_sym] = nil
|
111
|
+
elsif type =~ /\AArray<(.*)>/i
|
112
|
+
# check to ensure the input is an array given that the attribute
|
113
|
+
# is documented as an array but the input is not
|
114
|
+
if attributes[attribute_map[key]].is_a?(Array)
|
115
|
+
transformed_hash[key.to_sym] = attributes[attribute_map[key]].map { |v|
|
116
|
+
_deserialize(::Regexp.last_match(1), v)
|
117
|
+
}
|
118
|
+
end
|
119
|
+
elsif !attributes[attribute_map[key]].nil?
|
120
|
+
transformed_hash[key.to_sym] = _deserialize(type, attributes[attribute_map[key]])
|
121
|
+
end
|
122
|
+
end
|
123
|
+
|
124
|
+
new(transformed_hash)
|
125
|
+
end
|
126
|
+
|
127
|
+
# Deserializes the data based on type
|
128
|
+
# @param string type Data type
|
129
|
+
# @param string value Value to be deserialized
|
130
|
+
# @return [Object] Deserialized data
|
131
|
+
def self._deserialize(type, value)
|
132
|
+
case type.to_sym
|
133
|
+
when :Time
|
134
|
+
Time.parse(value)
|
135
|
+
when :Date
|
136
|
+
Date.parse(value)
|
137
|
+
when :String
|
138
|
+
value.to_s
|
139
|
+
when :Integer
|
140
|
+
value.to_i
|
141
|
+
when :Float
|
142
|
+
value.to_f
|
143
|
+
when :Boolean
|
144
|
+
if value.to_s =~ /\A(true|t|yes|y|1)\z/i
|
145
|
+
true
|
146
|
+
else
|
147
|
+
false
|
148
|
+
end
|
149
|
+
|
150
|
+
when :Object
|
151
|
+
# generic object (usually a Hash), return directly
|
152
|
+
value
|
153
|
+
when /\AArray<(?<inner_type>.+)>\z/
|
154
|
+
inner_type = Regexp.last_match[:inner_type]
|
155
|
+
value.map { |v| _deserialize(inner_type, v) }
|
156
|
+
when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
|
157
|
+
k_type = Regexp.last_match[:k_type]
|
158
|
+
v_type = Regexp.last_match[:v_type]
|
159
|
+
{}.tap do |hash|
|
160
|
+
value.each do |k, v|
|
161
|
+
hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
|
162
|
+
end
|
163
|
+
end
|
164
|
+
# model
|
165
|
+
else
|
166
|
+
# models (e.g. Pet) or oneOf
|
167
|
+
klass = Algolia::Abtesting.const_get(type)
|
168
|
+
klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass
|
169
|
+
.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
|
+
|
203
|
+
hash
|
204
|
+
end
|
205
|
+
|
206
|
+
# Outputs non-array value in the form of hash
|
207
|
+
# For object, use to_hash. Otherwise, just return the value
|
208
|
+
# @param [Object] value Any valid value
|
209
|
+
# @return [Hash] Returns the value in the form of hash
|
210
|
+
def _to_hash(value)
|
211
|
+
if value.is_a?(Array)
|
212
|
+
value.compact.map { |v| _to_hash(v) }
|
213
|
+
elsif value.is_a?(Hash)
|
214
|
+
{}.tap do |hash|
|
215
|
+
value.each { |k, v| hash[k] = _to_hash(v) }
|
216
|
+
end
|
217
|
+
elsif value.respond_to?(:to_hash)
|
218
|
+
value.to_hash
|
219
|
+
else
|
220
|
+
value
|
221
|
+
end
|
222
|
+
end
|
223
|
+
|
224
|
+
end
|
225
|
+
|
226
|
+
end
|
227
|
+
end
|
@@ -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 Abtesting
|
8
|
+
class EstimateABTestResponse
|
9
|
+
# Estimated number of days needed to reach the sample sizes required for detecting the configured effect. This value is based on historical traffic.
|
10
|
+
attr_accessor :duration_days
|
11
|
+
|
12
|
+
# Sample size estimates for each variant. The first element is the control variant. Each element is the estimated number of searches required to achieve the desired statistical significance.
|
13
|
+
attr_accessor :sample_sizes
|
14
|
+
|
15
|
+
# Attribute mapping from ruby-style variable name to JSON key.
|
16
|
+
def self.attribute_map
|
17
|
+
{
|
18
|
+
:duration_days => :durationDays,
|
19
|
+
:sample_sizes => :sampleSizes
|
20
|
+
}
|
21
|
+
end
|
22
|
+
|
23
|
+
# Returns all the JSON keys this model knows about
|
24
|
+
def self.acceptable_attributes
|
25
|
+
attribute_map.values
|
26
|
+
end
|
27
|
+
|
28
|
+
# Attribute type mapping.
|
29
|
+
def self.types_mapping
|
30
|
+
{
|
31
|
+
:duration_days => :"Integer",
|
32
|
+
:sample_sizes => :"Array<Integer>"
|
33
|
+
}
|
34
|
+
end
|
35
|
+
|
36
|
+
# List of attributes with nullable: true
|
37
|
+
def self.openapi_nullable
|
38
|
+
Set.new(
|
39
|
+
[]
|
40
|
+
)
|
41
|
+
end
|
42
|
+
|
43
|
+
# Initializes the object
|
44
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
45
|
+
def initialize(attributes = {})
|
46
|
+
if (!attributes.is_a?(Hash))
|
47
|
+
raise(
|
48
|
+
ArgumentError,
|
49
|
+
"The input argument (attributes) must be a hash in `Algolia::EstimateABTestResponse` initialize method"
|
50
|
+
)
|
51
|
+
end
|
52
|
+
|
53
|
+
# check to see if the attribute exists and convert string to symbol for hash key
|
54
|
+
attributes = attributes.each_with_object({}) { |(k, v), h|
|
55
|
+
if (!self.class.attribute_map.key?(k.to_sym))
|
56
|
+
raise(
|
57
|
+
ArgumentError,
|
58
|
+
"`#{k}` is not a valid attribute in `Algolia::EstimateABTestResponse`. Please check the name to make sure it's valid. List of attributes: " +
|
59
|
+
self.class.attribute_map.keys.inspect
|
60
|
+
)
|
61
|
+
end
|
62
|
+
|
63
|
+
h[k.to_sym] = v
|
64
|
+
}
|
65
|
+
|
66
|
+
if attributes.key?(:duration_days)
|
67
|
+
self.duration_days = attributes[:duration_days]
|
68
|
+
end
|
69
|
+
|
70
|
+
if attributes.key?(:sample_sizes)
|
71
|
+
if (value = attributes[:sample_sizes]).is_a?(Array)
|
72
|
+
self.sample_sizes = value
|
73
|
+
end
|
74
|
+
end
|
75
|
+
end
|
76
|
+
|
77
|
+
# Checks equality by comparing each attribute.
|
78
|
+
# @param [Object] Object to be compared
|
79
|
+
def ==(other)
|
80
|
+
return true if self.equal?(other)
|
81
|
+
self.class == other.class &&
|
82
|
+
duration_days == other.duration_days &&
|
83
|
+
sample_sizes == other.sample_sizes
|
84
|
+
end
|
85
|
+
|
86
|
+
# @see the `==` method
|
87
|
+
# @param [Object] Object to be compared
|
88
|
+
def eql?(other)
|
89
|
+
self == other
|
90
|
+
end
|
91
|
+
|
92
|
+
# Calculates hash code according to all attributes.
|
93
|
+
# @return [Integer] Hash code
|
94
|
+
def hash
|
95
|
+
[duration_days, sample_sizes].hash
|
96
|
+
end
|
97
|
+
|
98
|
+
# Builds the object from hash
|
99
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
100
|
+
# @return [Object] Returns the model itself
|
101
|
+
def self.build_from_hash(attributes)
|
102
|
+
return nil unless attributes.is_a?(Hash)
|
103
|
+
attributes = attributes.transform_keys(&:to_sym)
|
104
|
+
transformed_hash = {}
|
105
|
+
types_mapping.each_pair do |key, type|
|
106
|
+
if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil?
|
107
|
+
transformed_hash[key.to_sym] = nil
|
108
|
+
elsif type =~ /\AArray<(.*)>/i
|
109
|
+
# check to ensure the input is an array given that the attribute
|
110
|
+
# is documented as an array but the input is not
|
111
|
+
if attributes[attribute_map[key]].is_a?(Array)
|
112
|
+
transformed_hash[key.to_sym] = attributes[attribute_map[key]].map { |v|
|
113
|
+
_deserialize(::Regexp.last_match(1), v)
|
114
|
+
}
|
115
|
+
end
|
116
|
+
elsif !attributes[attribute_map[key]].nil?
|
117
|
+
transformed_hash[key.to_sym] = _deserialize(type, attributes[attribute_map[key]])
|
118
|
+
end
|
119
|
+
end
|
120
|
+
|
121
|
+
new(transformed_hash)
|
122
|
+
end
|
123
|
+
|
124
|
+
# Deserializes the data based on type
|
125
|
+
# @param string type Data type
|
126
|
+
# @param string value Value to be deserialized
|
127
|
+
# @return [Object] Deserialized data
|
128
|
+
def self._deserialize(type, value)
|
129
|
+
case type.to_sym
|
130
|
+
when :Time
|
131
|
+
Time.parse(value)
|
132
|
+
when :Date
|
133
|
+
Date.parse(value)
|
134
|
+
when :String
|
135
|
+
value.to_s
|
136
|
+
when :Integer
|
137
|
+
value.to_i
|
138
|
+
when :Float
|
139
|
+
value.to_f
|
140
|
+
when :Boolean
|
141
|
+
if value.to_s =~ /\A(true|t|yes|y|1)\z/i
|
142
|
+
true
|
143
|
+
else
|
144
|
+
false
|
145
|
+
end
|
146
|
+
|
147
|
+
when :Object
|
148
|
+
# generic object (usually a Hash), return directly
|
149
|
+
value
|
150
|
+
when /\AArray<(?<inner_type>.+)>\z/
|
151
|
+
inner_type = Regexp.last_match[:inner_type]
|
152
|
+
value.map { |v| _deserialize(inner_type, v) }
|
153
|
+
when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
|
154
|
+
k_type = Regexp.last_match[:k_type]
|
155
|
+
v_type = Regexp.last_match[:v_type]
|
156
|
+
{}.tap do |hash|
|
157
|
+
value.each do |k, v|
|
158
|
+
hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
|
159
|
+
end
|
160
|
+
end
|
161
|
+
# model
|
162
|
+
else
|
163
|
+
# models (e.g. Pet) or oneOf
|
164
|
+
klass = Algolia::Abtesting.const_get(type)
|
165
|
+
klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass
|
166
|
+
.build_from_hash(value)
|
167
|
+
end
|
168
|
+
end
|
169
|
+
|
170
|
+
# Returns the string representation of the object
|
171
|
+
# @return [String] String presentation of the object
|
172
|
+
def to_s
|
173
|
+
to_hash.to_s
|
174
|
+
end
|
175
|
+
|
176
|
+
# to_body is an alias to to_hash (backward compatibility)
|
177
|
+
# @return [Hash] Returns the object in the form of hash
|
178
|
+
def to_body
|
179
|
+
to_hash
|
180
|
+
end
|
181
|
+
|
182
|
+
def to_json(*_args)
|
183
|
+
to_hash.to_json
|
184
|
+
end
|
185
|
+
|
186
|
+
# Returns the object in the form of hash
|
187
|
+
# @return [Hash] Returns the object in the form of hash
|
188
|
+
def to_hash
|
189
|
+
hash = {}
|
190
|
+
self.class.attribute_map.each_pair do |attr, param|
|
191
|
+
value = send(attr)
|
192
|
+
if value.nil?
|
193
|
+
is_nullable = self.class.openapi_nullable.include?(attr)
|
194
|
+
next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
|
195
|
+
end
|
196
|
+
|
197
|
+
hash[param] = _to_hash(value)
|
198
|
+
end
|
199
|
+
|
200
|
+
hash
|
201
|
+
end
|
202
|
+
|
203
|
+
# Outputs non-array value in the form of hash
|
204
|
+
# For object, use to_hash. Otherwise, just return the value
|
205
|
+
# @param [Object] value Any valid value
|
206
|
+
# @return [Hash] Returns the value in the form of hash
|
207
|
+
def _to_hash(value)
|
208
|
+
if value.is_a?(Array)
|
209
|
+
value.compact.map { |v| _to_hash(v) }
|
210
|
+
elsif value.is_a?(Hash)
|
211
|
+
{}.tap do |hash|
|
212
|
+
value.each { |k, v| hash[k] = _to_hash(v) }
|
213
|
+
end
|
214
|
+
elsif value.respond_to?(:to_hash)
|
215
|
+
value.to_hash
|
216
|
+
else
|
217
|
+
value
|
218
|
+
end
|
219
|
+
end
|
220
|
+
|
221
|
+
end
|
222
|
+
|
223
|
+
end
|
224
|
+
end
|
@@ -0,0 +1,232 @@
|
|
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 Abtesting
|
8
|
+
# A/B test configuration for estimating the sample size and duration using minimum detectable effect.
|
9
|
+
class EstimateConfiguration
|
10
|
+
attr_accessor :outliers
|
11
|
+
|
12
|
+
attr_accessor :empty_search
|
13
|
+
|
14
|
+
attr_accessor :minimum_detectable_effect
|
15
|
+
|
16
|
+
# Attribute mapping from ruby-style variable name to JSON key.
|
17
|
+
def self.attribute_map
|
18
|
+
{
|
19
|
+
:outliers => :outliers,
|
20
|
+
:empty_search => :emptySearch,
|
21
|
+
:minimum_detectable_effect => :minimumDetectableEffect
|
22
|
+
}
|
23
|
+
end
|
24
|
+
|
25
|
+
# Returns all the JSON keys this model knows about
|
26
|
+
def self.acceptable_attributes
|
27
|
+
attribute_map.values
|
28
|
+
end
|
29
|
+
|
30
|
+
# Attribute type mapping.
|
31
|
+
def self.types_mapping
|
32
|
+
{
|
33
|
+
:outliers => :"Outliers",
|
34
|
+
:empty_search => :"EmptySearch",
|
35
|
+
:minimum_detectable_effect => :"MinimumDetectableEffect"
|
36
|
+
}
|
37
|
+
end
|
38
|
+
|
39
|
+
# List of attributes with nullable: true
|
40
|
+
def self.openapi_nullable
|
41
|
+
Set.new(
|
42
|
+
[]
|
43
|
+
)
|
44
|
+
end
|
45
|
+
|
46
|
+
# Initializes the object
|
47
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
48
|
+
def initialize(attributes = {})
|
49
|
+
if (!attributes.is_a?(Hash))
|
50
|
+
raise(
|
51
|
+
ArgumentError,
|
52
|
+
"The input argument (attributes) must be a hash in `Algolia::EstimateConfiguration` initialize method"
|
53
|
+
)
|
54
|
+
end
|
55
|
+
|
56
|
+
# check to see if the attribute exists and convert string to symbol for hash key
|
57
|
+
attributes = attributes.each_with_object({}) { |(k, v), h|
|
58
|
+
if (!self.class.attribute_map.key?(k.to_sym))
|
59
|
+
raise(
|
60
|
+
ArgumentError,
|
61
|
+
"`#{k}` is not a valid attribute in `Algolia::EstimateConfiguration`. Please check the name to make sure it's valid. List of attributes: " +
|
62
|
+
self.class.attribute_map.keys.inspect
|
63
|
+
)
|
64
|
+
end
|
65
|
+
|
66
|
+
h[k.to_sym] = v
|
67
|
+
}
|
68
|
+
|
69
|
+
if attributes.key?(:outliers)
|
70
|
+
self.outliers = attributes[:outliers]
|
71
|
+
end
|
72
|
+
|
73
|
+
if attributes.key?(:empty_search)
|
74
|
+
self.empty_search = attributes[:empty_search]
|
75
|
+
end
|
76
|
+
|
77
|
+
if attributes.key?(:minimum_detectable_effect)
|
78
|
+
self.minimum_detectable_effect = attributes[:minimum_detectable_effect]
|
79
|
+
else
|
80
|
+
self.minimum_detectable_effect = nil
|
81
|
+
end
|
82
|
+
end
|
83
|
+
|
84
|
+
# Checks equality by comparing each attribute.
|
85
|
+
# @param [Object] Object to be compared
|
86
|
+
def ==(other)
|
87
|
+
return true if self.equal?(other)
|
88
|
+
self.class == other.class &&
|
89
|
+
outliers == other.outliers &&
|
90
|
+
empty_search == other.empty_search &&
|
91
|
+
minimum_detectable_effect == other.minimum_detectable_effect
|
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
|
+
[outliers, empty_search, minimum_detectable_effect].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
|
+
attributes = attributes.transform_keys(&:to_sym)
|
112
|
+
transformed_hash = {}
|
113
|
+
types_mapping.each_pair do |key, type|
|
114
|
+
if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil?
|
115
|
+
transformed_hash[key.to_sym] = nil
|
116
|
+
elsif type =~ /\AArray<(.*)>/i
|
117
|
+
# check to ensure the input is an array given that the attribute
|
118
|
+
# is documented as an array but the input is not
|
119
|
+
if attributes[attribute_map[key]].is_a?(Array)
|
120
|
+
transformed_hash[key.to_sym] = attributes[attribute_map[key]].map { |v|
|
121
|
+
_deserialize(::Regexp.last_match(1), v)
|
122
|
+
}
|
123
|
+
end
|
124
|
+
elsif !attributes[attribute_map[key]].nil?
|
125
|
+
transformed_hash[key.to_sym] = _deserialize(type, attributes[attribute_map[key]])
|
126
|
+
end
|
127
|
+
end
|
128
|
+
|
129
|
+
new(transformed_hash)
|
130
|
+
end
|
131
|
+
|
132
|
+
# Deserializes the data based on type
|
133
|
+
# @param string type Data type
|
134
|
+
# @param string value Value to be deserialized
|
135
|
+
# @return [Object] Deserialized data
|
136
|
+
def self._deserialize(type, value)
|
137
|
+
case type.to_sym
|
138
|
+
when :Time
|
139
|
+
Time.parse(value)
|
140
|
+
when :Date
|
141
|
+
Date.parse(value)
|
142
|
+
when :String
|
143
|
+
value.to_s
|
144
|
+
when :Integer
|
145
|
+
value.to_i
|
146
|
+
when :Float
|
147
|
+
value.to_f
|
148
|
+
when :Boolean
|
149
|
+
if value.to_s =~ /\A(true|t|yes|y|1)\z/i
|
150
|
+
true
|
151
|
+
else
|
152
|
+
false
|
153
|
+
end
|
154
|
+
|
155
|
+
when :Object
|
156
|
+
# generic object (usually a Hash), return directly
|
157
|
+
value
|
158
|
+
when /\AArray<(?<inner_type>.+)>\z/
|
159
|
+
inner_type = Regexp.last_match[:inner_type]
|
160
|
+
value.map { |v| _deserialize(inner_type, v) }
|
161
|
+
when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
|
162
|
+
k_type = Regexp.last_match[:k_type]
|
163
|
+
v_type = Regexp.last_match[:v_type]
|
164
|
+
{}.tap do |hash|
|
165
|
+
value.each do |k, v|
|
166
|
+
hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
|
167
|
+
end
|
168
|
+
end
|
169
|
+
# model
|
170
|
+
else
|
171
|
+
# models (e.g. Pet) or oneOf
|
172
|
+
klass = Algolia::Abtesting.const_get(type)
|
173
|
+
klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass
|
174
|
+
.build_from_hash(value)
|
175
|
+
end
|
176
|
+
end
|
177
|
+
|
178
|
+
# Returns the string representation of the object
|
179
|
+
# @return [String] String presentation of the object
|
180
|
+
def to_s
|
181
|
+
to_hash.to_s
|
182
|
+
end
|
183
|
+
|
184
|
+
# to_body is an alias to to_hash (backward compatibility)
|
185
|
+
# @return [Hash] Returns the object in the form of hash
|
186
|
+
def to_body
|
187
|
+
to_hash
|
188
|
+
end
|
189
|
+
|
190
|
+
def to_json(*_args)
|
191
|
+
to_hash.to_json
|
192
|
+
end
|
193
|
+
|
194
|
+
# Returns the object in the form of hash
|
195
|
+
# @return [Hash] Returns the object in the form of hash
|
196
|
+
def to_hash
|
197
|
+
hash = {}
|
198
|
+
self.class.attribute_map.each_pair do |attr, param|
|
199
|
+
value = send(attr)
|
200
|
+
if value.nil?
|
201
|
+
is_nullable = self.class.openapi_nullable.include?(attr)
|
202
|
+
next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
|
203
|
+
end
|
204
|
+
|
205
|
+
hash[param] = _to_hash(value)
|
206
|
+
end
|
207
|
+
|
208
|
+
hash
|
209
|
+
end
|
210
|
+
|
211
|
+
# Outputs non-array value in the form of hash
|
212
|
+
# For object, use to_hash. Otherwise, just return the value
|
213
|
+
# @param [Object] value Any valid value
|
214
|
+
# @return [Hash] Returns the value in the form of hash
|
215
|
+
def _to_hash(value)
|
216
|
+
if value.is_a?(Array)
|
217
|
+
value.compact.map { |v| _to_hash(v) }
|
218
|
+
elsif value.is_a?(Hash)
|
219
|
+
{}.tap do |hash|
|
220
|
+
value.each { |k, v| hash[k] = _to_hash(v) }
|
221
|
+
end
|
222
|
+
elsif value.respond_to?(:to_hash)
|
223
|
+
value.to_hash
|
224
|
+
else
|
225
|
+
value
|
226
|
+
end
|
227
|
+
end
|
228
|
+
|
229
|
+
end
|
230
|
+
|
231
|
+
end
|
232
|
+
end
|
@@ -10,13 +10,13 @@ module Algolia
|
|
10
10
|
# Smallest difference in an observable metric between variants. For example, to detect a 10% difference between variants, set this value to 0.1.
|
11
11
|
attr_accessor :size
|
12
12
|
|
13
|
-
attr_accessor :
|
13
|
+
attr_accessor :metric
|
14
14
|
|
15
15
|
# Attribute mapping from ruby-style variable name to JSON key.
|
16
16
|
def self.attribute_map
|
17
17
|
{
|
18
18
|
:size => :size,
|
19
|
-
:
|
19
|
+
:metric => :metric
|
20
20
|
}
|
21
21
|
end
|
22
22
|
|
@@ -29,7 +29,7 @@ module Algolia
|
|
29
29
|
def self.types_mapping
|
30
30
|
{
|
31
31
|
:size => :"Float",
|
32
|
-
:
|
32
|
+
:metric => :"EffectMetric"
|
33
33
|
}
|
34
34
|
end
|
35
35
|
|
@@ -65,10 +65,14 @@ module Algolia
|
|
65
65
|
|
66
66
|
if attributes.key?(:size)
|
67
67
|
self.size = attributes[:size]
|
68
|
+
else
|
69
|
+
self.size = nil
|
68
70
|
end
|
69
71
|
|
70
|
-
if attributes.key?(:
|
71
|
-
self.
|
72
|
+
if attributes.key?(:metric)
|
73
|
+
self.metric = attributes[:metric]
|
74
|
+
else
|
75
|
+
self.metric = nil
|
72
76
|
end
|
73
77
|
end
|
74
78
|
|
@@ -78,7 +82,7 @@ module Algolia
|
|
78
82
|
return true if self.equal?(other)
|
79
83
|
self.class == other.class &&
|
80
84
|
size == other.size &&
|
81
|
-
|
85
|
+
metric == other.metric
|
82
86
|
end
|
83
87
|
|
84
88
|
# @see the `==` method
|
@@ -90,7 +94,7 @@ module Algolia
|
|
90
94
|
# Calculates hash code according to all attributes.
|
91
95
|
# @return [Integer] Hash code
|
92
96
|
def hash
|
93
|
-
[size,
|
97
|
+
[size, metric].hash
|
94
98
|
end
|
95
99
|
|
96
100
|
# Builds the object from hash
|
data/lib/algolia/version.rb
CHANGED
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.
|
4
|
+
version: 3.8.0
|
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-11-
|
11
|
+
date: 2024-11-14 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: faraday
|
@@ -154,10 +154,13 @@ files:
|
|
154
154
|
- lib/algolia/models/abtesting/add_ab_tests_request.rb
|
155
155
|
- lib/algolia/models/abtesting/add_ab_tests_variant.rb
|
156
156
|
- lib/algolia/models/abtesting/currency.rb
|
157
|
-
- lib/algolia/models/abtesting/
|
157
|
+
- lib/algolia/models/abtesting/effect_metric.rb
|
158
158
|
- lib/algolia/models/abtesting/empty_search.rb
|
159
159
|
- lib/algolia/models/abtesting/empty_search_filter.rb
|
160
160
|
- lib/algolia/models/abtesting/error_base.rb
|
161
|
+
- lib/algolia/models/abtesting/estimate_ab_test_request.rb
|
162
|
+
- lib/algolia/models/abtesting/estimate_ab_test_response.rb
|
163
|
+
- lib/algolia/models/abtesting/estimate_configuration.rb
|
161
164
|
- lib/algolia/models/abtesting/filter_effects.rb
|
162
165
|
- lib/algolia/models/abtesting/list_ab_tests_response.rb
|
163
166
|
- lib/algolia/models/abtesting/minimum_detectable_effect.rb
|