algolia 3.0.0.beta.3 → 3.0.0.beta.5
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.openapi-generator/VERSION +1 -1
- data/CHANGELOG.md +16 -0
- data/Gemfile.lock +1 -1
- data/README.md +1 -1
- data/lib/algolia/api/ingestion_client.rb +424 -58
- data/lib/algolia/api/search_client.rb +148 -0
- data/lib/algolia/models/ingestion/authentication.rb +2 -2
- data/lib/algolia/models/ingestion/authentication_create_response.rb +1 -1
- data/lib/algolia/models/ingestion/authentication_update_response.rb +1 -1
- data/lib/algolia/models/ingestion/delete_response.rb +1 -1
- data/lib/algolia/models/ingestion/destination.rb +2 -2
- data/lib/algolia/models/ingestion/destination_create_response.rb +1 -1
- data/lib/algolia/models/ingestion/destination_update_response.rb +1 -1
- data/lib/algolia/models/ingestion/event.rb +1 -1
- data/lib/algolia/models/ingestion/list_transformations_response.rb +212 -0
- data/lib/algolia/models/ingestion/on_demand_date_utils_input.rb +2 -2
- data/lib/algolia/models/ingestion/on_demand_trigger.rb +1 -1
- data/lib/algolia/models/ingestion/run.rb +3 -3
- data/lib/algolia/models/ingestion/run_response.rb +1 -1
- data/lib/algolia/models/ingestion/schedule_trigger.rb +2 -2
- data/lib/algolia/models/ingestion/sort_keys.rb +35 -0
- data/lib/algolia/models/ingestion/source.rb +2 -2
- data/lib/algolia/models/ingestion/source_create_response.rb +1 -1
- data/lib/algolia/models/ingestion/source_update_response.rb +1 -1
- data/lib/algolia/models/ingestion/source_watch_response.rb +233 -0
- data/lib/algolia/models/ingestion/task.rb +13 -3
- data/lib/algolia/models/ingestion/task_create.rb +14 -4
- data/lib/algolia/models/ingestion/task_create_response.rb +1 -1
- data/lib/algolia/models/ingestion/task_update_response.rb +1 -1
- data/lib/algolia/models/ingestion/transformation.rb +257 -0
- data/lib/algolia/models/ingestion/transformation_create.rb +224 -0
- data/lib/algolia/models/ingestion/{docker_source_discover.rb → transformation_create_response.rb} +14 -13
- data/lib/algolia/models/ingestion/{docker_source_streams.rb → transformation_search.rb} +12 -12
- data/lib/algolia/models/ingestion/transformation_try.rb +211 -0
- data/lib/algolia/models/ingestion/transformation_try_response.rb +210 -0
- data/lib/algolia/models/ingestion/transformation_try_response_error.rb +208 -0
- data/lib/algolia/models/ingestion/transformation_update_response.rb +212 -0
- data/lib/algolia/models/ingestion/window.rb +2 -2
- data/lib/algolia/models/recommend/base_search_response.rb +2 -4
- data/lib/algolia/models/recommend/fallback_params.rb +3 -1
- data/lib/algolia/models/recommend/recommendations_results.rb +1 -1
- data/lib/algolia/models/recommend/search_params.rb +3 -1
- data/lib/algolia/models/recommend/search_params_object.rb +3 -1
- data/lib/algolia/models/recommend/trending_facets_query.rb +3 -1
- data/lib/algolia/models/search/base_index_settings.rb +2 -4
- data/lib/algolia/models/search/base_search_response.rb +2 -4
- data/lib/algolia/models/search/browse_params_object.rb +3 -1
- data/lib/algolia/models/search/browse_response.rb +1 -1
- data/lib/algolia/models/search/consequence_params.rb +3 -1
- data/lib/algolia/models/search/index_settings.rb +4 -2
- data/lib/algolia/models/search/search_for_facets.rb +3 -1
- data/lib/algolia/models/search/search_for_hits.rb +3 -1
- data/lib/algolia/models/search/search_params_object.rb +3 -1
- data/lib/algolia/models/search/search_response.rb +1 -1
- data/lib/algolia/models/search/secured_api_key_restrictions.rb +3 -3
- data/lib/algolia/transport/transport.rb +8 -8
- data/lib/algolia/version.rb +1 -1
- metadata +13 -4
@@ -0,0 +1,210 @@
|
|
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
|
+
class TransformationTryResponse
|
9
|
+
# The array of records returned by the transformation service.
|
10
|
+
attr_accessor :payloads
|
11
|
+
|
12
|
+
attr_accessor :error
|
13
|
+
|
14
|
+
# Attribute mapping from ruby-style variable name to JSON key.
|
15
|
+
def self.attribute_map
|
16
|
+
{
|
17
|
+
:payloads => :payloads,
|
18
|
+
:error => :error
|
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
|
+
:payloads => :'Array<Object>',
|
31
|
+
:error => :TransformationTryResponseError
|
32
|
+
}
|
33
|
+
end
|
34
|
+
|
35
|
+
# List of attributes with nullable: true
|
36
|
+
def self.openapi_nullable
|
37
|
+
Set.new([])
|
38
|
+
end
|
39
|
+
|
40
|
+
# Initializes the object
|
41
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
42
|
+
def initialize(attributes = {})
|
43
|
+
unless attributes.is_a?(Hash)
|
44
|
+
raise ArgumentError, "The input argument (attributes) must be a hash in `Algolia::TransformationTryResponse` initialize method"
|
45
|
+
end
|
46
|
+
|
47
|
+
# check to see if the attribute exists and convert string to symbol for hash key
|
48
|
+
attributes = attributes.each_with_object({}) do |(k, v), h|
|
49
|
+
unless self.class.attribute_map.key?(k.to_sym)
|
50
|
+
raise ArgumentError,
|
51
|
+
"`#{k}` is not a valid attribute in `Algolia::TransformationTryResponse`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
|
52
|
+
end
|
53
|
+
|
54
|
+
h[k.to_sym] = v
|
55
|
+
end
|
56
|
+
|
57
|
+
if attributes.key?(:payloads)
|
58
|
+
if (value = attributes[:payloads]).is_a?(Array)
|
59
|
+
self.payloads = value
|
60
|
+
end
|
61
|
+
else
|
62
|
+
self.payloads = nil
|
63
|
+
end
|
64
|
+
|
65
|
+
if attributes.key?(:error)
|
66
|
+
self.error = attributes[:error]
|
67
|
+
end
|
68
|
+
end
|
69
|
+
|
70
|
+
# Checks equality by comparing each attribute.
|
71
|
+
# @param [Object] Object to be compared
|
72
|
+
def ==(other)
|
73
|
+
return true if equal?(other)
|
74
|
+
|
75
|
+
self.class == other.class &&
|
76
|
+
payloads == other.payloads &&
|
77
|
+
error == other.error
|
78
|
+
end
|
79
|
+
|
80
|
+
# @see the `==` method
|
81
|
+
# @param [Object] Object to be compared
|
82
|
+
def eql?(other)
|
83
|
+
self == other
|
84
|
+
end
|
85
|
+
|
86
|
+
# Calculates hash code according to all attributes.
|
87
|
+
# @return [Integer] Hash code
|
88
|
+
def hash
|
89
|
+
[payloads, error].hash
|
90
|
+
end
|
91
|
+
|
92
|
+
# Builds the object from hash
|
93
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
94
|
+
# @return [Object] Returns the model itself
|
95
|
+
def self.build_from_hash(attributes)
|
96
|
+
return nil unless attributes.is_a?(Hash)
|
97
|
+
|
98
|
+
attributes = attributes.transform_keys(&:to_sym)
|
99
|
+
transformed_hash = {}
|
100
|
+
types_mapping.each_pair do |key, type|
|
101
|
+
if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil?
|
102
|
+
transformed_hash[key.to_sym] = nil
|
103
|
+
elsif type =~ /\AArray<(.*)>/i
|
104
|
+
# check to ensure the input is an array given that the attribute
|
105
|
+
# is documented as an array but the input is not
|
106
|
+
if attributes[attribute_map[key]].is_a?(Array)
|
107
|
+
transformed_hash[key.to_sym] = attributes[attribute_map[key]].map { |v| _deserialize(::Regexp.last_match(1), v) }
|
108
|
+
end
|
109
|
+
elsif !attributes[attribute_map[key]].nil?
|
110
|
+
transformed_hash[key.to_sym] = _deserialize(type, attributes[attribute_map[key]])
|
111
|
+
end
|
112
|
+
end
|
113
|
+
new(transformed_hash)
|
114
|
+
end
|
115
|
+
|
116
|
+
# Deserializes the data based on type
|
117
|
+
# @param string type Data type
|
118
|
+
# @param string value Value to be deserialized
|
119
|
+
# @return [Object] Deserialized data
|
120
|
+
def self._deserialize(type, value)
|
121
|
+
case type.to_sym
|
122
|
+
when :Time
|
123
|
+
Time.parse(value)
|
124
|
+
when :Date
|
125
|
+
Date.parse(value)
|
126
|
+
when :String
|
127
|
+
value.to_s
|
128
|
+
when :Integer
|
129
|
+
value.to_i
|
130
|
+
when :Float
|
131
|
+
value.to_f
|
132
|
+
when :Boolean
|
133
|
+
if value.to_s =~ /\A(true|t|yes|y|1)\z/i
|
134
|
+
true
|
135
|
+
else
|
136
|
+
false
|
137
|
+
end
|
138
|
+
when :Object
|
139
|
+
# generic object (usually a Hash), return directly
|
140
|
+
value
|
141
|
+
when /\AArray<(?<inner_type>.+)>\z/
|
142
|
+
inner_type = Regexp.last_match[:inner_type]
|
143
|
+
value.map { |v| _deserialize(inner_type, v) }
|
144
|
+
when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
|
145
|
+
k_type = Regexp.last_match[:k_type]
|
146
|
+
v_type = Regexp.last_match[:v_type]
|
147
|
+
{}.tap do |hash|
|
148
|
+
value.each do |k, v|
|
149
|
+
hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
|
150
|
+
end
|
151
|
+
end
|
152
|
+
else # model
|
153
|
+
# models (e.g. Pet) or oneOf
|
154
|
+
klass = Algolia::Ingestion.const_get(type)
|
155
|
+
klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
|
156
|
+
end
|
157
|
+
end
|
158
|
+
|
159
|
+
# Returns the string representation of the object
|
160
|
+
# @return [String] String presentation of the object
|
161
|
+
def to_s
|
162
|
+
to_hash.to_s
|
163
|
+
end
|
164
|
+
|
165
|
+
# to_body is an alias to to_hash (backward compatibility)
|
166
|
+
# @return [Hash] Returns the object in the form of hash
|
167
|
+
def to_body
|
168
|
+
to_hash
|
169
|
+
end
|
170
|
+
|
171
|
+
def to_json(*_args)
|
172
|
+
to_hash.to_json
|
173
|
+
end
|
174
|
+
|
175
|
+
# Returns the object in the form of hash
|
176
|
+
# @return [Hash] Returns the object in the form of hash
|
177
|
+
def to_hash
|
178
|
+
hash = {}
|
179
|
+
self.class.attribute_map.each_pair do |attr, param|
|
180
|
+
value = send(attr)
|
181
|
+
if value.nil?
|
182
|
+
is_nullable = self.class.openapi_nullable.include?(attr)
|
183
|
+
next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
|
184
|
+
end
|
185
|
+
|
186
|
+
hash[param] = _to_hash(value)
|
187
|
+
end
|
188
|
+
hash
|
189
|
+
end
|
190
|
+
|
191
|
+
# Outputs non-array value in the form of hash
|
192
|
+
# For object, use to_hash. Otherwise, just return the value
|
193
|
+
# @param [Object] value Any valid value
|
194
|
+
# @return [Hash] Returns the value in the form of hash
|
195
|
+
def _to_hash(value)
|
196
|
+
if value.is_a?(Array)
|
197
|
+
value.compact.map { |v| _to_hash(v) }
|
198
|
+
elsif value.is_a?(Hash)
|
199
|
+
{}.tap do |hash|
|
200
|
+
value.each { |k, v| hash[k] = _to_hash(v) }
|
201
|
+
end
|
202
|
+
elsif value.respond_to? :to_hash
|
203
|
+
value.to_hash
|
204
|
+
else
|
205
|
+
value
|
206
|
+
end
|
207
|
+
end
|
208
|
+
end
|
209
|
+
end
|
210
|
+
end
|
@@ -0,0 +1,208 @@
|
|
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
|
+
# The error if the transformation failed.
|
9
|
+
class TransformationTryResponseError
|
10
|
+
# The error status code.
|
11
|
+
attr_accessor :code
|
12
|
+
|
13
|
+
# A descriptive message explaining the failure.
|
14
|
+
attr_accessor :message
|
15
|
+
|
16
|
+
# Attribute mapping from ruby-style variable name to JSON key.
|
17
|
+
def self.attribute_map
|
18
|
+
{
|
19
|
+
:code => :code,
|
20
|
+
:message => :message
|
21
|
+
}
|
22
|
+
end
|
23
|
+
|
24
|
+
# Returns all the JSON keys this model knows about
|
25
|
+
def self.acceptable_attributes
|
26
|
+
attribute_map.values
|
27
|
+
end
|
28
|
+
|
29
|
+
# Attribute type mapping.
|
30
|
+
def self.types_mapping
|
31
|
+
{
|
32
|
+
:code => :Integer,
|
33
|
+
:message => :String
|
34
|
+
}
|
35
|
+
end
|
36
|
+
|
37
|
+
# List of attributes with nullable: true
|
38
|
+
def self.openapi_nullable
|
39
|
+
Set.new([])
|
40
|
+
end
|
41
|
+
|
42
|
+
# Initializes the object
|
43
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
44
|
+
def initialize(attributes = {})
|
45
|
+
unless attributes.is_a?(Hash)
|
46
|
+
raise ArgumentError, "The input argument (attributes) must be a hash in `Algolia::TransformationTryResponseError` initialize method"
|
47
|
+
end
|
48
|
+
|
49
|
+
# check to see if the attribute exists and convert string to symbol for hash key
|
50
|
+
attributes = attributes.each_with_object({}) do |(k, v), h|
|
51
|
+
unless self.class.attribute_map.key?(k.to_sym)
|
52
|
+
raise ArgumentError,
|
53
|
+
"`#{k}` is not a valid attribute in `Algolia::TransformationTryResponseError`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
|
54
|
+
end
|
55
|
+
|
56
|
+
h[k.to_sym] = v
|
57
|
+
end
|
58
|
+
|
59
|
+
if attributes.key?(:code)
|
60
|
+
self.code = attributes[:code]
|
61
|
+
end
|
62
|
+
|
63
|
+
if attributes.key?(:message)
|
64
|
+
self.message = attributes[:message]
|
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 equal?(other)
|
72
|
+
|
73
|
+
self.class == other.class &&
|
74
|
+
code == other.code &&
|
75
|
+
message == other.message
|
76
|
+
end
|
77
|
+
|
78
|
+
# @see the `==` method
|
79
|
+
# @param [Object] Object to be compared
|
80
|
+
def eql?(other)
|
81
|
+
self == other
|
82
|
+
end
|
83
|
+
|
84
|
+
# Calculates hash code according to all attributes.
|
85
|
+
# @return [Integer] Hash code
|
86
|
+
def hash
|
87
|
+
[code, message].hash
|
88
|
+
end
|
89
|
+
|
90
|
+
# Builds the object from hash
|
91
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
92
|
+
# @return [Object] Returns the model itself
|
93
|
+
def self.build_from_hash(attributes)
|
94
|
+
return nil unless attributes.is_a?(Hash)
|
95
|
+
|
96
|
+
attributes = attributes.transform_keys(&:to_sym)
|
97
|
+
transformed_hash = {}
|
98
|
+
types_mapping.each_pair do |key, type|
|
99
|
+
if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil?
|
100
|
+
transformed_hash[key.to_sym] = nil
|
101
|
+
elsif type =~ /\AArray<(.*)>/i
|
102
|
+
# check to ensure the input is an array given that the attribute
|
103
|
+
# is documented as an array but the input is not
|
104
|
+
if attributes[attribute_map[key]].is_a?(Array)
|
105
|
+
transformed_hash[key.to_sym] = attributes[attribute_map[key]].map { |v| _deserialize(::Regexp.last_match(1), v) }
|
106
|
+
end
|
107
|
+
elsif !attributes[attribute_map[key]].nil?
|
108
|
+
transformed_hash[key.to_sym] = _deserialize(type, attributes[attribute_map[key]])
|
109
|
+
end
|
110
|
+
end
|
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
|
+
when :Object
|
137
|
+
# generic object (usually a Hash), return directly
|
138
|
+
value
|
139
|
+
when /\AArray<(?<inner_type>.+)>\z/
|
140
|
+
inner_type = Regexp.last_match[:inner_type]
|
141
|
+
value.map { |v| _deserialize(inner_type, v) }
|
142
|
+
when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
|
143
|
+
k_type = Regexp.last_match[:k_type]
|
144
|
+
v_type = Regexp.last_match[:v_type]
|
145
|
+
{}.tap do |hash|
|
146
|
+
value.each do |k, v|
|
147
|
+
hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
|
148
|
+
end
|
149
|
+
end
|
150
|
+
else # model
|
151
|
+
# models (e.g. Pet) or oneOf
|
152
|
+
klass = Algolia::Ingestion.const_get(type)
|
153
|
+
klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
|
154
|
+
end
|
155
|
+
end
|
156
|
+
|
157
|
+
# Returns the string representation of the object
|
158
|
+
# @return [String] String presentation of the object
|
159
|
+
def to_s
|
160
|
+
to_hash.to_s
|
161
|
+
end
|
162
|
+
|
163
|
+
# to_body is an alias to to_hash (backward compatibility)
|
164
|
+
# @return [Hash] Returns the object in the form of hash
|
165
|
+
def to_body
|
166
|
+
to_hash
|
167
|
+
end
|
168
|
+
|
169
|
+
def to_json(*_args)
|
170
|
+
to_hash.to_json
|
171
|
+
end
|
172
|
+
|
173
|
+
# Returns the object in the form of hash
|
174
|
+
# @return [Hash] Returns the object in the form of hash
|
175
|
+
def to_hash
|
176
|
+
hash = {}
|
177
|
+
self.class.attribute_map.each_pair do |attr, param|
|
178
|
+
value = send(attr)
|
179
|
+
if value.nil?
|
180
|
+
is_nullable = self.class.openapi_nullable.include?(attr)
|
181
|
+
next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
|
182
|
+
end
|
183
|
+
|
184
|
+
hash[param] = _to_hash(value)
|
185
|
+
end
|
186
|
+
hash
|
187
|
+
end
|
188
|
+
|
189
|
+
# Outputs non-array value in the form of hash
|
190
|
+
# For object, use to_hash. Otherwise, just return the value
|
191
|
+
# @param [Object] value Any valid value
|
192
|
+
# @return [Hash] Returns the value in the form of hash
|
193
|
+
def _to_hash(value)
|
194
|
+
if value.is_a?(Array)
|
195
|
+
value.compact.map { |v| _to_hash(v) }
|
196
|
+
elsif value.is_a?(Hash)
|
197
|
+
{}.tap do |hash|
|
198
|
+
value.each { |k, v| hash[k] = _to_hash(v) }
|
199
|
+
end
|
200
|
+
elsif value.respond_to? :to_hash
|
201
|
+
value.to_hash
|
202
|
+
else
|
203
|
+
value
|
204
|
+
end
|
205
|
+
end
|
206
|
+
end
|
207
|
+
end
|
208
|
+
end
|
@@ -0,0 +1,212 @@
|
|
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
|
+
# API response for updating a transformation.
|
9
|
+
class TransformationUpdateResponse
|
10
|
+
# Universally unique identifier (UUID) of a transformation.
|
11
|
+
attr_accessor :transformation_id
|
12
|
+
|
13
|
+
# Date of last update in RFC 3339 format.
|
14
|
+
attr_accessor :updated_at
|
15
|
+
|
16
|
+
# Attribute mapping from ruby-style variable name to JSON key.
|
17
|
+
def self.attribute_map
|
18
|
+
{
|
19
|
+
:transformation_id => :transformationID,
|
20
|
+
:updated_at => :updatedAt
|
21
|
+
}
|
22
|
+
end
|
23
|
+
|
24
|
+
# Returns all the JSON keys this model knows about
|
25
|
+
def self.acceptable_attributes
|
26
|
+
attribute_map.values
|
27
|
+
end
|
28
|
+
|
29
|
+
# Attribute type mapping.
|
30
|
+
def self.types_mapping
|
31
|
+
{
|
32
|
+
:transformation_id => :String,
|
33
|
+
:updated_at => :String
|
34
|
+
}
|
35
|
+
end
|
36
|
+
|
37
|
+
# List of attributes with nullable: true
|
38
|
+
def self.openapi_nullable
|
39
|
+
Set.new([])
|
40
|
+
end
|
41
|
+
|
42
|
+
# Initializes the object
|
43
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
44
|
+
def initialize(attributes = {})
|
45
|
+
unless attributes.is_a?(Hash)
|
46
|
+
raise ArgumentError, "The input argument (attributes) must be a hash in `Algolia::TransformationUpdateResponse` initialize method"
|
47
|
+
end
|
48
|
+
|
49
|
+
# check to see if the attribute exists and convert string to symbol for hash key
|
50
|
+
attributes = attributes.each_with_object({}) do |(k, v), h|
|
51
|
+
unless self.class.attribute_map.key?(k.to_sym)
|
52
|
+
raise ArgumentError,
|
53
|
+
"`#{k}` is not a valid attribute in `Algolia::TransformationUpdateResponse`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
|
54
|
+
end
|
55
|
+
|
56
|
+
h[k.to_sym] = v
|
57
|
+
end
|
58
|
+
|
59
|
+
if attributes.key?(:transformation_id)
|
60
|
+
self.transformation_id = attributes[:transformation_id]
|
61
|
+
else
|
62
|
+
self.transformation_id = nil
|
63
|
+
end
|
64
|
+
|
65
|
+
if attributes.key?(:updated_at)
|
66
|
+
self.updated_at = attributes[:updated_at]
|
67
|
+
else
|
68
|
+
self.updated_at = nil
|
69
|
+
end
|
70
|
+
end
|
71
|
+
|
72
|
+
# Checks equality by comparing each attribute.
|
73
|
+
# @param [Object] Object to be compared
|
74
|
+
def ==(other)
|
75
|
+
return true if equal?(other)
|
76
|
+
|
77
|
+
self.class == other.class &&
|
78
|
+
transformation_id == other.transformation_id &&
|
79
|
+
updated_at == other.updated_at
|
80
|
+
end
|
81
|
+
|
82
|
+
# @see the `==` method
|
83
|
+
# @param [Object] Object to be compared
|
84
|
+
def eql?(other)
|
85
|
+
self == other
|
86
|
+
end
|
87
|
+
|
88
|
+
# Calculates hash code according to all attributes.
|
89
|
+
# @return [Integer] Hash code
|
90
|
+
def hash
|
91
|
+
[transformation_id, updated_at].hash
|
92
|
+
end
|
93
|
+
|
94
|
+
# Builds the object from hash
|
95
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
96
|
+
# @return [Object] Returns the model itself
|
97
|
+
def self.build_from_hash(attributes)
|
98
|
+
return nil unless attributes.is_a?(Hash)
|
99
|
+
|
100
|
+
attributes = attributes.transform_keys(&:to_sym)
|
101
|
+
transformed_hash = {}
|
102
|
+
types_mapping.each_pair do |key, type|
|
103
|
+
if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil?
|
104
|
+
transformed_hash[key.to_sym] = nil
|
105
|
+
elsif type =~ /\AArray<(.*)>/i
|
106
|
+
# check to ensure the input is an array given that the attribute
|
107
|
+
# is documented as an array but the input is not
|
108
|
+
if attributes[attribute_map[key]].is_a?(Array)
|
109
|
+
transformed_hash[key.to_sym] = attributes[attribute_map[key]].map { |v| _deserialize(::Regexp.last_match(1), v) }
|
110
|
+
end
|
111
|
+
elsif !attributes[attribute_map[key]].nil?
|
112
|
+
transformed_hash[key.to_sym] = _deserialize(type, attributes[attribute_map[key]])
|
113
|
+
end
|
114
|
+
end
|
115
|
+
new(transformed_hash)
|
116
|
+
end
|
117
|
+
|
118
|
+
# Deserializes the data based on type
|
119
|
+
# @param string type Data type
|
120
|
+
# @param string value Value to be deserialized
|
121
|
+
# @return [Object] Deserialized data
|
122
|
+
def self._deserialize(type, value)
|
123
|
+
case type.to_sym
|
124
|
+
when :Time
|
125
|
+
Time.parse(value)
|
126
|
+
when :Date
|
127
|
+
Date.parse(value)
|
128
|
+
when :String
|
129
|
+
value.to_s
|
130
|
+
when :Integer
|
131
|
+
value.to_i
|
132
|
+
when :Float
|
133
|
+
value.to_f
|
134
|
+
when :Boolean
|
135
|
+
if value.to_s =~ /\A(true|t|yes|y|1)\z/i
|
136
|
+
true
|
137
|
+
else
|
138
|
+
false
|
139
|
+
end
|
140
|
+
when :Object
|
141
|
+
# generic object (usually a Hash), return directly
|
142
|
+
value
|
143
|
+
when /\AArray<(?<inner_type>.+)>\z/
|
144
|
+
inner_type = Regexp.last_match[:inner_type]
|
145
|
+
value.map { |v| _deserialize(inner_type, v) }
|
146
|
+
when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
|
147
|
+
k_type = Regexp.last_match[:k_type]
|
148
|
+
v_type = Regexp.last_match[:v_type]
|
149
|
+
{}.tap do |hash|
|
150
|
+
value.each do |k, v|
|
151
|
+
hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
|
152
|
+
end
|
153
|
+
end
|
154
|
+
else # model
|
155
|
+
# models (e.g. Pet) or oneOf
|
156
|
+
klass = Algolia::Ingestion.const_get(type)
|
157
|
+
klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
|
158
|
+
end
|
159
|
+
end
|
160
|
+
|
161
|
+
# Returns the string representation of the object
|
162
|
+
# @return [String] String presentation of the object
|
163
|
+
def to_s
|
164
|
+
to_hash.to_s
|
165
|
+
end
|
166
|
+
|
167
|
+
# to_body is an alias to to_hash (backward compatibility)
|
168
|
+
# @return [Hash] Returns the object in the form of hash
|
169
|
+
def to_body
|
170
|
+
to_hash
|
171
|
+
end
|
172
|
+
|
173
|
+
def to_json(*_args)
|
174
|
+
to_hash.to_json
|
175
|
+
end
|
176
|
+
|
177
|
+
# Returns the object in the form of hash
|
178
|
+
# @return [Hash] Returns the object in the form of hash
|
179
|
+
def to_hash
|
180
|
+
hash = {}
|
181
|
+
self.class.attribute_map.each_pair do |attr, param|
|
182
|
+
value = send(attr)
|
183
|
+
if value.nil?
|
184
|
+
is_nullable = self.class.openapi_nullable.include?(attr)
|
185
|
+
next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
|
186
|
+
end
|
187
|
+
|
188
|
+
hash[param] = _to_hash(value)
|
189
|
+
end
|
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
|
+
end
|
211
|
+
end
|
212
|
+
end
|
@@ -7,10 +7,10 @@ module Algolia
|
|
7
7
|
module Ingestion
|
8
8
|
# Time window by which to filter the observability data.
|
9
9
|
class Window
|
10
|
-
# Date in
|
10
|
+
# Date in RFC 3339 format representing the oldest data in the time window.
|
11
11
|
attr_accessor :start_date
|
12
12
|
|
13
|
-
# Date in
|
13
|
+
# Date in RFC 3339 format representing the newest data in the time window.
|
14
14
|
attr_accessor :end_date
|
15
15
|
|
16
16
|
# Attribute mapping from ruby-style variable name to JSON key.
|
@@ -81,7 +81,7 @@ module Algolia
|
|
81
81
|
# Host name of the server that processed the request.
|
82
82
|
attr_accessor :server_used
|
83
83
|
|
84
|
-
# An object with custom data. You can store up to
|
84
|
+
# An object with custom data. You can store up to 32kB as custom data.
|
85
85
|
attr_accessor :user_data
|
86
86
|
|
87
87
|
# Unique identifier for the query. This is used for [click analytics](https://www.algolia.com/doc/guides/analytics/click-analytics/).
|
@@ -164,9 +164,7 @@ module Algolia
|
|
164
164
|
|
165
165
|
# List of attributes with nullable: true
|
166
166
|
def self.openapi_nullable
|
167
|
-
Set.new([
|
168
|
-
:user_data
|
169
|
-
])
|
167
|
+
Set.new([])
|
170
168
|
end
|
171
169
|
|
172
170
|
# Initializes the object
|
@@ -81,7 +81,7 @@ module Algolia
|
|
81
81
|
# Host name of the server that processed the request.
|
82
82
|
attr_accessor :server_used
|
83
83
|
|
84
|
-
# An object with custom data. You can store up to
|
84
|
+
# An object with custom data. You can store up to 32kB as custom data.
|
85
85
|
attr_accessor :user_data
|
86
86
|
|
87
87
|
# Unique identifier for the query. This is used for [click analytics](https://www.algolia.com/doc/guides/analytics/click-analytics/).
|