algolia 3.0.2 → 3.1.0
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 +4 -4
- data/CHANGELOG.md +4 -0
- data/Gemfile.lock +1 -1
- data/lib/algolia/api/abtesting_client.rb +44 -0
- data/lib/algolia/models/abtesting/schedule_ab_test_response.rb +214 -0
- data/lib/algolia/models/abtesting/schedule_ab_tests_request.rb +270 -0
- data/lib/algolia/version.rb +1 -1
- metadata +4 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 4341176aaa1fb5ede3413b4844215ba53d4e51e75f03d1988563d661d8ed4815
|
4
|
+
data.tar.gz: f9c1da9c1e6d2cf40cf576d6ceea212f947a73c7e8e3868c47436eb205b977bc
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 8317dae670e222ca42819edab6a46275b8c0b249729a938679fdebcd52211f7e8b43d22b6ddbe6e994a43ec0eabc885b537452c123fc25722e16bfd17c4d9d20
|
7
|
+
data.tar.gz: b8437399665e10107249c38e6fd0131aaffd0319a4d15d9fe093a1ebd76c9383fb328a656a58d04254427bd91d6cabb95e16a2dd322f83f9104918d470d60956
|
data/CHANGELOG.md
CHANGED
@@ -1,3 +1,7 @@
|
|
1
|
+
## [3.1.0](https://github.com/algolia/algoliasearch-client-ruby/compare/3.0.2...3.1.0)
|
2
|
+
|
3
|
+
- [d53060d96](https://github.com/algolia/api-clients-automation/commit/d53060d96) feat(specs): add /schedule endpoint ([#3350](https://github.com/algolia/api-clients-automation/pull/3350)) by [@febeck](https://github.com/febeck/)
|
4
|
+
|
1
5
|
## [3.0.2](https://github.com/algolia/algoliasearch-client-ruby/compare/3.0.1...3.0.2)
|
2
6
|
|
3
7
|
- [6cfc2d479](https://github.com/algolia/api-clients-automation/commit/6cfc2d479) chore(specs): update rendered title for search params ([#3553](https://github.com/algolia/api-clients-automation/pull/3553)) by [@shortcuts](https://github.com/shortcuts/)
|
data/Gemfile.lock
CHANGED
@@ -409,6 +409,50 @@ module Algolia
|
|
409
409
|
@api_client.deserialize(response.body, request_options[:debug_return_type] || "Abtesting::ListABTestsResponse")
|
410
410
|
end
|
411
411
|
|
412
|
+
# Schedule an A/B test to be started at a later time.
|
413
|
+
#
|
414
|
+
# Required API Key ACLs:
|
415
|
+
# - editSettings
|
416
|
+
# @param schedule_ab_tests_request [ScheduleABTestsRequest] (required)
|
417
|
+
# @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)
|
418
|
+
# @return [Http::Response] the response
|
419
|
+
def schedule_ab_test_with_http_info(schedule_ab_tests_request, request_options = {})
|
420
|
+
# verify the required parameter 'schedule_ab_tests_request' is set
|
421
|
+
if @api_client.config.client_side_validation && schedule_ab_tests_request.nil?
|
422
|
+
raise ArgumentError, "Parameter `schedule_ab_tests_request` is required when calling `schedule_ab_test`."
|
423
|
+
end
|
424
|
+
|
425
|
+
path = "/2/abtests/schedule"
|
426
|
+
query_params = {}
|
427
|
+
query_params = query_params.merge(request_options[:query_params]) unless request_options[:query_params].nil?
|
428
|
+
header_params = {}
|
429
|
+
header_params = header_params.merge(request_options[:header_params]) unless request_options[:header_params].nil?
|
430
|
+
|
431
|
+
post_body = request_options[:debug_body] || @api_client.object_to_http_body(schedule_ab_tests_request)
|
432
|
+
|
433
|
+
new_options = request_options.merge(
|
434
|
+
:operation => :"AbtestingClient.schedule_ab_test",
|
435
|
+
:header_params => header_params,
|
436
|
+
:query_params => query_params,
|
437
|
+
:body => post_body,
|
438
|
+
:use_read_transporter => false
|
439
|
+
)
|
440
|
+
|
441
|
+
@api_client.call_api(:POST, path, new_options)
|
442
|
+
end
|
443
|
+
|
444
|
+
# Schedule an A/B test to be started at a later time.
|
445
|
+
#
|
446
|
+
# Required API Key ACLs:
|
447
|
+
# - editSettings
|
448
|
+
# @param schedule_ab_tests_request [ScheduleABTestsRequest] (required)
|
449
|
+
# @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)
|
450
|
+
# @return [ScheduleABTestResponse]
|
451
|
+
def schedule_ab_test(schedule_ab_tests_request, request_options = {})
|
452
|
+
response = schedule_ab_test_with_http_info(schedule_ab_tests_request, request_options)
|
453
|
+
@api_client.deserialize(response.body, request_options[:debug_return_type] || "Abtesting::ScheduleABTestResponse")
|
454
|
+
end
|
455
|
+
|
412
456
|
# Stops an A/B test by its ID. You can't restart stopped A/B tests.
|
413
457
|
#
|
414
458
|
# Required API Key ACLs:
|
@@ -0,0 +1,214 @@
|
|
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 ScheduleABTestResponse
|
9
|
+
# Unique scheduled A/B test identifier.
|
10
|
+
attr_accessor :ab_test_schedule_id
|
11
|
+
|
12
|
+
# Attribute mapping from ruby-style variable name to JSON key.
|
13
|
+
def self.attribute_map
|
14
|
+
{
|
15
|
+
:ab_test_schedule_id => :abTestScheduleID
|
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
|
+
:ab_test_schedule_id => :"Integer"
|
28
|
+
}
|
29
|
+
end
|
30
|
+
|
31
|
+
# List of attributes with nullable: true
|
32
|
+
def self.openapi_nullable
|
33
|
+
Set.new(
|
34
|
+
[]
|
35
|
+
)
|
36
|
+
end
|
37
|
+
|
38
|
+
# Initializes the object
|
39
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
40
|
+
def initialize(attributes = {})
|
41
|
+
if (!attributes.is_a?(Hash))
|
42
|
+
raise(
|
43
|
+
ArgumentError,
|
44
|
+
"The input argument (attributes) must be a hash in `Algolia::ScheduleABTestResponse` initialize method"
|
45
|
+
)
|
46
|
+
end
|
47
|
+
|
48
|
+
# check to see if the attribute exists and convert string to symbol for hash key
|
49
|
+
attributes = attributes.each_with_object({}) { |(k, v), h|
|
50
|
+
if (!self.class.attribute_map.key?(k.to_sym))
|
51
|
+
raise(
|
52
|
+
ArgumentError,
|
53
|
+
"`#{k}` is not a valid attribute in `Algolia::ScheduleABTestResponse`. Please check the name to make sure it's valid. List of attributes: " +
|
54
|
+
self.class.attribute_map.keys.inspect
|
55
|
+
)
|
56
|
+
end
|
57
|
+
|
58
|
+
h[k.to_sym] = v
|
59
|
+
}
|
60
|
+
|
61
|
+
if attributes.key?(:ab_test_schedule_id)
|
62
|
+
self.ab_test_schedule_id = attributes[:ab_test_schedule_id]
|
63
|
+
else
|
64
|
+
self.ab_test_schedule_id = nil
|
65
|
+
end
|
66
|
+
end
|
67
|
+
|
68
|
+
# Checks equality by comparing each attribute.
|
69
|
+
# @param [Object] Object to be compared
|
70
|
+
def ==(other)
|
71
|
+
return true if self.equal?(other)
|
72
|
+
self.class == other.class &&
|
73
|
+
ab_test_schedule_id == other.ab_test_schedule_id
|
74
|
+
end
|
75
|
+
|
76
|
+
# @see the `==` method
|
77
|
+
# @param [Object] Object to be compared
|
78
|
+
def eql?(other)
|
79
|
+
self == other
|
80
|
+
end
|
81
|
+
|
82
|
+
# Calculates hash code according to all attributes.
|
83
|
+
# @return [Integer] Hash code
|
84
|
+
def hash
|
85
|
+
[ab_test_schedule_id].hash
|
86
|
+
end
|
87
|
+
|
88
|
+
# Builds the object from hash
|
89
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
90
|
+
# @return [Object] Returns the model itself
|
91
|
+
def self.build_from_hash(attributes)
|
92
|
+
return nil unless attributes.is_a?(Hash)
|
93
|
+
attributes = attributes.transform_keys(&:to_sym)
|
94
|
+
transformed_hash = {}
|
95
|
+
types_mapping.each_pair do |key, type|
|
96
|
+
if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil?
|
97
|
+
transformed_hash[key.to_sym] = nil
|
98
|
+
elsif type =~ /\AArray<(.*)>/i
|
99
|
+
# check to ensure the input is an array given that the attribute
|
100
|
+
# is documented as an array but the input is not
|
101
|
+
if attributes[attribute_map[key]].is_a?(Array)
|
102
|
+
transformed_hash[key.to_sym] = attributes[attribute_map[key]].map { |v|
|
103
|
+
_deserialize(::Regexp.last_match(1), v)
|
104
|
+
}
|
105
|
+
end
|
106
|
+
elsif !attributes[attribute_map[key]].nil?
|
107
|
+
transformed_hash[key.to_sym] = _deserialize(type, attributes[attribute_map[key]])
|
108
|
+
end
|
109
|
+
end
|
110
|
+
|
111
|
+
new(transformed_hash)
|
112
|
+
end
|
113
|
+
|
114
|
+
# Deserializes the data based on type
|
115
|
+
# @param string type Data type
|
116
|
+
# @param string value Value to be deserialized
|
117
|
+
# @return [Object] Deserialized data
|
118
|
+
def self._deserialize(type, value)
|
119
|
+
case type.to_sym
|
120
|
+
when :Time
|
121
|
+
Time.parse(value)
|
122
|
+
when :Date
|
123
|
+
Date.parse(value)
|
124
|
+
when :String
|
125
|
+
value.to_s
|
126
|
+
when :Integer
|
127
|
+
value.to_i
|
128
|
+
when :Float
|
129
|
+
value.to_f
|
130
|
+
when :Boolean
|
131
|
+
if value.to_s =~ /\A(true|t|yes|y|1)\z/i
|
132
|
+
true
|
133
|
+
else
|
134
|
+
false
|
135
|
+
end
|
136
|
+
|
137
|
+
when :Object
|
138
|
+
# generic object (usually a Hash), return directly
|
139
|
+
value
|
140
|
+
when /\AArray<(?<inner_type>.+)>\z/
|
141
|
+
inner_type = Regexp.last_match[:inner_type]
|
142
|
+
value.map { |v| _deserialize(inner_type, v) }
|
143
|
+
when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
|
144
|
+
k_type = Regexp.last_match[:k_type]
|
145
|
+
v_type = Regexp.last_match[:v_type]
|
146
|
+
{}.tap do |hash|
|
147
|
+
value.each do |k, v|
|
148
|
+
hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
|
149
|
+
end
|
150
|
+
end
|
151
|
+
# model
|
152
|
+
else
|
153
|
+
# models (e.g. Pet) or oneOf
|
154
|
+
klass = Algolia::Abtesting.const_get(type)
|
155
|
+
klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass
|
156
|
+
.build_from_hash(value)
|
157
|
+
end
|
158
|
+
end
|
159
|
+
|
160
|
+
# Returns the string representation of the object
|
161
|
+
# @return [String] String presentation of the object
|
162
|
+
def to_s
|
163
|
+
to_hash.to_s
|
164
|
+
end
|
165
|
+
|
166
|
+
# to_body is an alias to to_hash (backward compatibility)
|
167
|
+
# @return [Hash] Returns the object in the form of hash
|
168
|
+
def to_body
|
169
|
+
to_hash
|
170
|
+
end
|
171
|
+
|
172
|
+
def to_json(*_args)
|
173
|
+
to_hash.to_json
|
174
|
+
end
|
175
|
+
|
176
|
+
# Returns the object in the form of hash
|
177
|
+
# @return [Hash] Returns the object in the form of hash
|
178
|
+
def to_hash
|
179
|
+
hash = {}
|
180
|
+
self.class.attribute_map.each_pair do |attr, param|
|
181
|
+
value = send(attr)
|
182
|
+
if value.nil?
|
183
|
+
is_nullable = self.class.openapi_nullable.include?(attr)
|
184
|
+
next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
|
185
|
+
end
|
186
|
+
|
187
|
+
hash[param] = _to_hash(value)
|
188
|
+
end
|
189
|
+
|
190
|
+
hash
|
191
|
+
end
|
192
|
+
|
193
|
+
# Outputs non-array value in the form of hash
|
194
|
+
# For object, use to_hash. Otherwise, just return the value
|
195
|
+
# @param [Object] value Any valid value
|
196
|
+
# @return [Hash] Returns the value in the form of hash
|
197
|
+
def _to_hash(value)
|
198
|
+
if value.is_a?(Array)
|
199
|
+
value.compact.map { |v| _to_hash(v) }
|
200
|
+
elsif value.is_a?(Hash)
|
201
|
+
{}.tap do |hash|
|
202
|
+
value.each { |k, v| hash[k] = _to_hash(v) }
|
203
|
+
end
|
204
|
+
elsif value.respond_to?(:to_hash)
|
205
|
+
value.to_hash
|
206
|
+
else
|
207
|
+
value
|
208
|
+
end
|
209
|
+
end
|
210
|
+
|
211
|
+
end
|
212
|
+
|
213
|
+
end
|
214
|
+
end
|
@@ -0,0 +1,270 @@
|
|
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 ScheduleABTestsRequest
|
9
|
+
# A/B test name.
|
10
|
+
attr_accessor :name
|
11
|
+
|
12
|
+
# A/B test variants.
|
13
|
+
attr_accessor :variants
|
14
|
+
|
15
|
+
# Date and time when the A/B test is scheduled to start, in RFC 3339 format.
|
16
|
+
attr_accessor :scheduled_at
|
17
|
+
|
18
|
+
# End date and time of the A/B test, in RFC 3339 format.
|
19
|
+
attr_accessor :end_at
|
20
|
+
|
21
|
+
# Attribute mapping from ruby-style variable name to JSON key.
|
22
|
+
def self.attribute_map
|
23
|
+
{
|
24
|
+
:name => :name,
|
25
|
+
:variants => :variants,
|
26
|
+
:scheduled_at => :scheduledAt,
|
27
|
+
:end_at => :endAt
|
28
|
+
}
|
29
|
+
end
|
30
|
+
|
31
|
+
# Returns all the JSON keys this model knows about
|
32
|
+
def self.acceptable_attributes
|
33
|
+
attribute_map.values
|
34
|
+
end
|
35
|
+
|
36
|
+
# Attribute type mapping.
|
37
|
+
def self.types_mapping
|
38
|
+
{
|
39
|
+
:name => :"String",
|
40
|
+
:variants => :"Array<AddABTestsVariant>",
|
41
|
+
:scheduled_at => :"String",
|
42
|
+
:end_at => :"String"
|
43
|
+
}
|
44
|
+
end
|
45
|
+
|
46
|
+
# List of attributes with nullable: true
|
47
|
+
def self.openapi_nullable
|
48
|
+
Set.new(
|
49
|
+
[]
|
50
|
+
)
|
51
|
+
end
|
52
|
+
|
53
|
+
# Initializes the object
|
54
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
55
|
+
def initialize(attributes = {})
|
56
|
+
if (!attributes.is_a?(Hash))
|
57
|
+
raise(
|
58
|
+
ArgumentError,
|
59
|
+
"The input argument (attributes) must be a hash in `Algolia::ScheduleABTestsRequest` initialize method"
|
60
|
+
)
|
61
|
+
end
|
62
|
+
|
63
|
+
# check to see if the attribute exists and convert string to symbol for hash key
|
64
|
+
attributes = attributes.each_with_object({}) { |(k, v), h|
|
65
|
+
if (!self.class.attribute_map.key?(k.to_sym))
|
66
|
+
raise(
|
67
|
+
ArgumentError,
|
68
|
+
"`#{k}` is not a valid attribute in `Algolia::ScheduleABTestsRequest`. Please check the name to make sure it's valid. List of attributes: " +
|
69
|
+
self.class.attribute_map.keys.inspect
|
70
|
+
)
|
71
|
+
end
|
72
|
+
|
73
|
+
h[k.to_sym] = v
|
74
|
+
}
|
75
|
+
|
76
|
+
if attributes.key?(:name)
|
77
|
+
self.name = attributes[:name]
|
78
|
+
else
|
79
|
+
self.name = nil
|
80
|
+
end
|
81
|
+
|
82
|
+
if attributes.key?(:variants)
|
83
|
+
if (value = attributes[:variants]).is_a?(Array)
|
84
|
+
self.variants = value
|
85
|
+
end
|
86
|
+
else
|
87
|
+
self.variants = nil
|
88
|
+
end
|
89
|
+
|
90
|
+
if attributes.key?(:scheduled_at)
|
91
|
+
self.scheduled_at = attributes[:scheduled_at]
|
92
|
+
else
|
93
|
+
self.scheduled_at = nil
|
94
|
+
end
|
95
|
+
|
96
|
+
if attributes.key?(:end_at)
|
97
|
+
self.end_at = attributes[:end_at]
|
98
|
+
else
|
99
|
+
self.end_at = nil
|
100
|
+
end
|
101
|
+
end
|
102
|
+
|
103
|
+
# Custom attribute writer method with validation
|
104
|
+
# @param [Object] variants Value to be assigned
|
105
|
+
def variants=(variants)
|
106
|
+
if variants.nil?
|
107
|
+
raise ArgumentError, "variants cannot be nil"
|
108
|
+
end
|
109
|
+
|
110
|
+
if variants.length > 2
|
111
|
+
raise ArgumentError, "invalid value for \"variants\", number of items must be less than or equal to 2."
|
112
|
+
end
|
113
|
+
|
114
|
+
if variants.length < 2
|
115
|
+
raise ArgumentError, "invalid value for \"variants\", number of items must be greater than or equal to 2."
|
116
|
+
end
|
117
|
+
|
118
|
+
@variants = variants
|
119
|
+
end
|
120
|
+
|
121
|
+
# Checks equality by comparing each attribute.
|
122
|
+
# @param [Object] Object to be compared
|
123
|
+
def ==(other)
|
124
|
+
return true if self.equal?(other)
|
125
|
+
self.class == other.class &&
|
126
|
+
name == other.name &&
|
127
|
+
variants == other.variants &&
|
128
|
+
scheduled_at == other.scheduled_at &&
|
129
|
+
end_at == other.end_at
|
130
|
+
end
|
131
|
+
|
132
|
+
# @see the `==` method
|
133
|
+
# @param [Object] Object to be compared
|
134
|
+
def eql?(other)
|
135
|
+
self == other
|
136
|
+
end
|
137
|
+
|
138
|
+
# Calculates hash code according to all attributes.
|
139
|
+
# @return [Integer] Hash code
|
140
|
+
def hash
|
141
|
+
[name, variants, scheduled_at, end_at].hash
|
142
|
+
end
|
143
|
+
|
144
|
+
# Builds the object from hash
|
145
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
146
|
+
# @return [Object] Returns the model itself
|
147
|
+
def self.build_from_hash(attributes)
|
148
|
+
return nil unless attributes.is_a?(Hash)
|
149
|
+
attributes = attributes.transform_keys(&:to_sym)
|
150
|
+
transformed_hash = {}
|
151
|
+
types_mapping.each_pair do |key, type|
|
152
|
+
if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil?
|
153
|
+
transformed_hash[key.to_sym] = nil
|
154
|
+
elsif type =~ /\AArray<(.*)>/i
|
155
|
+
# check to ensure the input is an array given that the attribute
|
156
|
+
# is documented as an array but the input is not
|
157
|
+
if attributes[attribute_map[key]].is_a?(Array)
|
158
|
+
transformed_hash[key.to_sym] = attributes[attribute_map[key]].map { |v|
|
159
|
+
_deserialize(::Regexp.last_match(1), v)
|
160
|
+
}
|
161
|
+
end
|
162
|
+
elsif !attributes[attribute_map[key]].nil?
|
163
|
+
transformed_hash[key.to_sym] = _deserialize(type, attributes[attribute_map[key]])
|
164
|
+
end
|
165
|
+
end
|
166
|
+
|
167
|
+
new(transformed_hash)
|
168
|
+
end
|
169
|
+
|
170
|
+
# Deserializes the data based on type
|
171
|
+
# @param string type Data type
|
172
|
+
# @param string value Value to be deserialized
|
173
|
+
# @return [Object] Deserialized data
|
174
|
+
def self._deserialize(type, value)
|
175
|
+
case type.to_sym
|
176
|
+
when :Time
|
177
|
+
Time.parse(value)
|
178
|
+
when :Date
|
179
|
+
Date.parse(value)
|
180
|
+
when :String
|
181
|
+
value.to_s
|
182
|
+
when :Integer
|
183
|
+
value.to_i
|
184
|
+
when :Float
|
185
|
+
value.to_f
|
186
|
+
when :Boolean
|
187
|
+
if value.to_s =~ /\A(true|t|yes|y|1)\z/i
|
188
|
+
true
|
189
|
+
else
|
190
|
+
false
|
191
|
+
end
|
192
|
+
|
193
|
+
when :Object
|
194
|
+
# generic object (usually a Hash), return directly
|
195
|
+
value
|
196
|
+
when /\AArray<(?<inner_type>.+)>\z/
|
197
|
+
inner_type = Regexp.last_match[:inner_type]
|
198
|
+
value.map { |v| _deserialize(inner_type, v) }
|
199
|
+
when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
|
200
|
+
k_type = Regexp.last_match[:k_type]
|
201
|
+
v_type = Regexp.last_match[:v_type]
|
202
|
+
{}.tap do |hash|
|
203
|
+
value.each do |k, v|
|
204
|
+
hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
|
205
|
+
end
|
206
|
+
end
|
207
|
+
# model
|
208
|
+
else
|
209
|
+
# models (e.g. Pet) or oneOf
|
210
|
+
klass = Algolia::Abtesting.const_get(type)
|
211
|
+
klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass
|
212
|
+
.build_from_hash(value)
|
213
|
+
end
|
214
|
+
end
|
215
|
+
|
216
|
+
# Returns the string representation of the object
|
217
|
+
# @return [String] String presentation of the object
|
218
|
+
def to_s
|
219
|
+
to_hash.to_s
|
220
|
+
end
|
221
|
+
|
222
|
+
# to_body is an alias to to_hash (backward compatibility)
|
223
|
+
# @return [Hash] Returns the object in the form of hash
|
224
|
+
def to_body
|
225
|
+
to_hash
|
226
|
+
end
|
227
|
+
|
228
|
+
def to_json(*_args)
|
229
|
+
to_hash.to_json
|
230
|
+
end
|
231
|
+
|
232
|
+
# Returns the object in the form of hash
|
233
|
+
# @return [Hash] Returns the object in the form of hash
|
234
|
+
def to_hash
|
235
|
+
hash = {}
|
236
|
+
self.class.attribute_map.each_pair do |attr, param|
|
237
|
+
value = send(attr)
|
238
|
+
if value.nil?
|
239
|
+
is_nullable = self.class.openapi_nullable.include?(attr)
|
240
|
+
next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
|
241
|
+
end
|
242
|
+
|
243
|
+
hash[param] = _to_hash(value)
|
244
|
+
end
|
245
|
+
|
246
|
+
hash
|
247
|
+
end
|
248
|
+
|
249
|
+
# Outputs non-array value in the form of hash
|
250
|
+
# For object, use to_hash. Otherwise, just return the value
|
251
|
+
# @param [Object] value Any valid value
|
252
|
+
# @return [Hash] Returns the value in the form of hash
|
253
|
+
def _to_hash(value)
|
254
|
+
if value.is_a?(Array)
|
255
|
+
value.compact.map { |v| _to_hash(v) }
|
256
|
+
elsif value.is_a?(Hash)
|
257
|
+
{}.tap do |hash|
|
258
|
+
value.each { |k, v| hash[k] = _to_hash(v) }
|
259
|
+
end
|
260
|
+
elsif value.respond_to?(:to_hash)
|
261
|
+
value.to_hash
|
262
|
+
else
|
263
|
+
value
|
264
|
+
end
|
265
|
+
end
|
266
|
+
|
267
|
+
end
|
268
|
+
|
269
|
+
end
|
270
|
+
end
|
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.0
|
4
|
+
version: 3.1.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-08-
|
11
|
+
date: 2024-08-20 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: faraday
|
@@ -159,6 +159,8 @@ files:
|
|
159
159
|
- lib/algolia/models/abtesting/minimum_detectable_effect.rb
|
160
160
|
- lib/algolia/models/abtesting/outliers.rb
|
161
161
|
- lib/algolia/models/abtesting/outliers_filter.rb
|
162
|
+
- lib/algolia/models/abtesting/schedule_ab_test_response.rb
|
163
|
+
- lib/algolia/models/abtesting/schedule_ab_tests_request.rb
|
162
164
|
- lib/algolia/models/abtesting/status.rb
|
163
165
|
- lib/algolia/models/abtesting/variant.rb
|
164
166
|
- lib/algolia/models/analytics/click_position.rb
|