algolia 3.0.0.beta.4 → 3.0.0.beta.6
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +20 -0
- data/Gemfile.lock +1 -1
- data/LICENSE +21 -0
- data/README.md +4 -4
- data/lib/algolia/api/ingestion_client.rb +424 -58
- data/lib/algolia/api/search_client.rb +158 -3
- 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/recommend/value.rb +16 -4
- 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/fetched_index.rb +14 -4
- 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/models/search/value.rb +16 -4
- data/lib/algolia/version.rb +1 -1
- metadata +14 -7
- data/.openapi-generator/FILES +0 -11
- data/.openapi-generator/VERSION +0 -1
- data/.openapi-generator-ignore +0 -23
@@ -0,0 +1,233 @@
|
|
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 SourceWatchResponse
|
9
|
+
# Universally unique identifier (UUID) of a task run.
|
10
|
+
attr_accessor :run_id
|
11
|
+
|
12
|
+
# depending on the source type, the validation returns sampling data of your source (JSON, CSV, BigQuery).
|
13
|
+
attr_accessor :data
|
14
|
+
|
15
|
+
# in case of error, observability events will be added to the response, if any.
|
16
|
+
attr_accessor :events
|
17
|
+
|
18
|
+
# a message describing the outcome of a validate run.
|
19
|
+
attr_accessor :message
|
20
|
+
|
21
|
+
# Attribute mapping from ruby-style variable name to JSON key.
|
22
|
+
def self.attribute_map
|
23
|
+
{
|
24
|
+
:run_id => :runID,
|
25
|
+
:data => :data,
|
26
|
+
:events => :events,
|
27
|
+
:message => :message
|
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
|
+
:run_id => :String,
|
40
|
+
:data => :'Array<Object>',
|
41
|
+
:events => :'Array<Event>',
|
42
|
+
:message => :String
|
43
|
+
}
|
44
|
+
end
|
45
|
+
|
46
|
+
# List of attributes with nullable: true
|
47
|
+
def self.openapi_nullable
|
48
|
+
Set.new([])
|
49
|
+
end
|
50
|
+
|
51
|
+
# Initializes the object
|
52
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
53
|
+
def initialize(attributes = {})
|
54
|
+
unless attributes.is_a?(Hash)
|
55
|
+
raise ArgumentError, "The input argument (attributes) must be a hash in `Algolia::SourceWatchResponse` initialize method"
|
56
|
+
end
|
57
|
+
|
58
|
+
# check to see if the attribute exists and convert string to symbol for hash key
|
59
|
+
attributes = attributes.each_with_object({}) do |(k, v), h|
|
60
|
+
unless self.class.attribute_map.key?(k.to_sym)
|
61
|
+
raise ArgumentError,
|
62
|
+
"`#{k}` is not a valid attribute in `Algolia::SourceWatchResponse`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
|
63
|
+
end
|
64
|
+
|
65
|
+
h[k.to_sym] = v
|
66
|
+
end
|
67
|
+
|
68
|
+
if attributes.key?(:run_id)
|
69
|
+
self.run_id = attributes[:run_id]
|
70
|
+
end
|
71
|
+
|
72
|
+
if attributes.key?(:data)
|
73
|
+
if (value = attributes[:data]).is_a?(Array)
|
74
|
+
self.data = value
|
75
|
+
end
|
76
|
+
end
|
77
|
+
|
78
|
+
if attributes.key?(:events)
|
79
|
+
if (value = attributes[:events]).is_a?(Array)
|
80
|
+
self.events = value
|
81
|
+
end
|
82
|
+
end
|
83
|
+
|
84
|
+
if attributes.key?(:message)
|
85
|
+
self.message = attributes[:message]
|
86
|
+
else
|
87
|
+
self.message = nil
|
88
|
+
end
|
89
|
+
end
|
90
|
+
|
91
|
+
# Checks equality by comparing each attribute.
|
92
|
+
# @param [Object] Object to be compared
|
93
|
+
def ==(other)
|
94
|
+
return true if equal?(other)
|
95
|
+
|
96
|
+
self.class == other.class &&
|
97
|
+
run_id == other.run_id &&
|
98
|
+
data == other.data &&
|
99
|
+
events == other.events &&
|
100
|
+
message == other.message
|
101
|
+
end
|
102
|
+
|
103
|
+
# @see the `==` method
|
104
|
+
# @param [Object] Object to be compared
|
105
|
+
def eql?(other)
|
106
|
+
self == other
|
107
|
+
end
|
108
|
+
|
109
|
+
# Calculates hash code according to all attributes.
|
110
|
+
# @return [Integer] Hash code
|
111
|
+
def hash
|
112
|
+
[run_id, data, events, message].hash
|
113
|
+
end
|
114
|
+
|
115
|
+
# Builds the object from hash
|
116
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
117
|
+
# @return [Object] Returns the model itself
|
118
|
+
def self.build_from_hash(attributes)
|
119
|
+
return nil unless attributes.is_a?(Hash)
|
120
|
+
|
121
|
+
attributes = attributes.transform_keys(&:to_sym)
|
122
|
+
transformed_hash = {}
|
123
|
+
types_mapping.each_pair do |key, type|
|
124
|
+
if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil?
|
125
|
+
transformed_hash[key.to_sym] = nil
|
126
|
+
elsif type =~ /\AArray<(.*)>/i
|
127
|
+
# check to ensure the input is an array given that the attribute
|
128
|
+
# is documented as an array but the input is not
|
129
|
+
if attributes[attribute_map[key]].is_a?(Array)
|
130
|
+
transformed_hash[key.to_sym] = attributes[attribute_map[key]].map { |v| _deserialize(::Regexp.last_match(1), v) }
|
131
|
+
end
|
132
|
+
elsif !attributes[attribute_map[key]].nil?
|
133
|
+
transformed_hash[key.to_sym] = _deserialize(type, attributes[attribute_map[key]])
|
134
|
+
end
|
135
|
+
end
|
136
|
+
new(transformed_hash)
|
137
|
+
end
|
138
|
+
|
139
|
+
# Deserializes the data based on type
|
140
|
+
# @param string type Data type
|
141
|
+
# @param string value Value to be deserialized
|
142
|
+
# @return [Object] Deserialized data
|
143
|
+
def self._deserialize(type, value)
|
144
|
+
case type.to_sym
|
145
|
+
when :Time
|
146
|
+
Time.parse(value)
|
147
|
+
when :Date
|
148
|
+
Date.parse(value)
|
149
|
+
when :String
|
150
|
+
value.to_s
|
151
|
+
when :Integer
|
152
|
+
value.to_i
|
153
|
+
when :Float
|
154
|
+
value.to_f
|
155
|
+
when :Boolean
|
156
|
+
if value.to_s =~ /\A(true|t|yes|y|1)\z/i
|
157
|
+
true
|
158
|
+
else
|
159
|
+
false
|
160
|
+
end
|
161
|
+
when :Object
|
162
|
+
# generic object (usually a Hash), return directly
|
163
|
+
value
|
164
|
+
when /\AArray<(?<inner_type>.+)>\z/
|
165
|
+
inner_type = Regexp.last_match[:inner_type]
|
166
|
+
value.map { |v| _deserialize(inner_type, v) }
|
167
|
+
when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
|
168
|
+
k_type = Regexp.last_match[:k_type]
|
169
|
+
v_type = Regexp.last_match[:v_type]
|
170
|
+
{}.tap do |hash|
|
171
|
+
value.each do |k, v|
|
172
|
+
hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
|
173
|
+
end
|
174
|
+
end
|
175
|
+
else # model
|
176
|
+
# models (e.g. Pet) or oneOf
|
177
|
+
klass = Algolia::Ingestion.const_get(type)
|
178
|
+
klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
|
179
|
+
end
|
180
|
+
end
|
181
|
+
|
182
|
+
# Returns the string representation of the object
|
183
|
+
# @return [String] String presentation of the object
|
184
|
+
def to_s
|
185
|
+
to_hash.to_s
|
186
|
+
end
|
187
|
+
|
188
|
+
# to_body is an alias to to_hash (backward compatibility)
|
189
|
+
# @return [Hash] Returns the object in the form of hash
|
190
|
+
def to_body
|
191
|
+
to_hash
|
192
|
+
end
|
193
|
+
|
194
|
+
def to_json(*_args)
|
195
|
+
to_hash.to_json
|
196
|
+
end
|
197
|
+
|
198
|
+
# Returns the object in the form of hash
|
199
|
+
# @return [Hash] Returns the object in the form of hash
|
200
|
+
def to_hash
|
201
|
+
hash = {}
|
202
|
+
self.class.attribute_map.each_pair do |attr, param|
|
203
|
+
value = send(attr)
|
204
|
+
if value.nil?
|
205
|
+
is_nullable = self.class.openapi_nullable.include?(attr)
|
206
|
+
next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
|
207
|
+
end
|
208
|
+
|
209
|
+
hash[param] = _to_hash(value)
|
210
|
+
end
|
211
|
+
hash
|
212
|
+
end
|
213
|
+
|
214
|
+
# Outputs non-array value in the form of hash
|
215
|
+
# For object, use to_hash. Otherwise, just return the value
|
216
|
+
# @param [Object] value Any valid value
|
217
|
+
# @return [Hash] Returns the value in the form of hash
|
218
|
+
def _to_hash(value)
|
219
|
+
if value.is_a?(Array)
|
220
|
+
value.compact.map { |v| _to_hash(v) }
|
221
|
+
elsif value.is_a?(Hash)
|
222
|
+
{}.tap do |hash|
|
223
|
+
value.each { |k, v| hash[k] = _to_hash(v) }
|
224
|
+
end
|
225
|
+
elsif value.respond_to? :to_hash
|
226
|
+
value.to_hash
|
227
|
+
else
|
228
|
+
value
|
229
|
+
end
|
230
|
+
end
|
231
|
+
end
|
232
|
+
end
|
233
|
+
end
|
@@ -27,10 +27,13 @@ module Algolia
|
|
27
27
|
|
28
28
|
attr_accessor :action
|
29
29
|
|
30
|
-
# Date of
|
30
|
+
# Date of the last cursor in RFC 3339 format.
|
31
|
+
attr_accessor :cursor
|
32
|
+
|
33
|
+
# Date of creation in RFC 3339 format.
|
31
34
|
attr_accessor :created_at
|
32
35
|
|
33
|
-
# Date of last update in
|
36
|
+
# Date of last update in RFC 3339 format.
|
34
37
|
attr_accessor :updated_at
|
35
38
|
|
36
39
|
class EnumAttributeValidator
|
@@ -66,6 +69,7 @@ module Algolia
|
|
66
69
|
:enabled => :enabled,
|
67
70
|
:failure_threshold => :failureThreshold,
|
68
71
|
:action => :action,
|
72
|
+
:cursor => :cursor,
|
69
73
|
:created_at => :createdAt,
|
70
74
|
:updated_at => :updatedAt
|
71
75
|
}
|
@@ -87,6 +91,7 @@ module Algolia
|
|
87
91
|
:enabled => :Boolean,
|
88
92
|
:failure_threshold => :Integer,
|
89
93
|
:action => :ActionType,
|
94
|
+
:cursor => :String,
|
90
95
|
:created_at => :String,
|
91
96
|
:updated_at => :String
|
92
97
|
}
|
@@ -158,6 +163,10 @@ module Algolia
|
|
158
163
|
self.action = nil
|
159
164
|
end
|
160
165
|
|
166
|
+
if attributes.key?(:cursor)
|
167
|
+
self.cursor = attributes[:cursor]
|
168
|
+
end
|
169
|
+
|
161
170
|
if attributes.key?(:created_at)
|
162
171
|
self.created_at = attributes[:created_at]
|
163
172
|
else
|
@@ -201,6 +210,7 @@ module Algolia
|
|
201
210
|
enabled == other.enabled &&
|
202
211
|
failure_threshold == other.failure_threshold &&
|
203
212
|
action == other.action &&
|
213
|
+
cursor == other.cursor &&
|
204
214
|
created_at == other.created_at &&
|
205
215
|
updated_at == other.updated_at
|
206
216
|
end
|
@@ -214,7 +224,7 @@ module Algolia
|
|
214
224
|
# Calculates hash code according to all attributes.
|
215
225
|
# @return [Integer] Hash code
|
216
226
|
def hash
|
217
|
-
[task_id, source_id, destination_id, trigger, input, enabled, failure_threshold, action, created_at, updated_at].hash
|
227
|
+
[task_id, source_id, destination_id, trigger, input, enabled, failure_threshold, action, cursor, created_at, updated_at].hash
|
218
228
|
end
|
219
229
|
|
220
230
|
# Builds the object from hash
|
@@ -25,6 +25,9 @@ module Algolia
|
|
25
25
|
|
26
26
|
attr_accessor :input
|
27
27
|
|
28
|
+
# Date of the last cursor in RFC 3339 format.
|
29
|
+
attr_accessor :cursor
|
30
|
+
|
28
31
|
class EnumAttributeValidator
|
29
32
|
attr_reader :datatype
|
30
33
|
attr_reader :allowable_values
|
@@ -56,7 +59,8 @@ module Algolia
|
|
56
59
|
:action => :action,
|
57
60
|
:enabled => :enabled,
|
58
61
|
:failure_threshold => :failureThreshold,
|
59
|
-
:input => :input
|
62
|
+
:input => :input,
|
63
|
+
:cursor => :cursor
|
60
64
|
}
|
61
65
|
end
|
62
66
|
|
@@ -74,7 +78,8 @@ module Algolia
|
|
74
78
|
:action => :ActionType,
|
75
79
|
:enabled => :Boolean,
|
76
80
|
:failure_threshold => :Integer,
|
77
|
-
:input => :TaskInput
|
81
|
+
:input => :TaskInput,
|
82
|
+
:cursor => :String
|
78
83
|
}
|
79
84
|
end
|
80
85
|
|
@@ -135,6 +140,10 @@ module Algolia
|
|
135
140
|
if attributes.key?(:input)
|
136
141
|
self.input = attributes[:input]
|
137
142
|
end
|
143
|
+
|
144
|
+
if attributes.key?(:cursor)
|
145
|
+
self.cursor = attributes[:cursor]
|
146
|
+
end
|
138
147
|
end
|
139
148
|
|
140
149
|
# Custom attribute writer method with validation
|
@@ -167,7 +176,8 @@ module Algolia
|
|
167
176
|
action == other.action &&
|
168
177
|
enabled == other.enabled &&
|
169
178
|
failure_threshold == other.failure_threshold &&
|
170
|
-
input == other.input
|
179
|
+
input == other.input &&
|
180
|
+
cursor == other.cursor
|
171
181
|
end
|
172
182
|
|
173
183
|
# @see the `==` method
|
@@ -179,7 +189,7 @@ module Algolia
|
|
179
189
|
# Calculates hash code according to all attributes.
|
180
190
|
# @return [Integer] Hash code
|
181
191
|
def hash
|
182
|
-
[source_id, destination_id, trigger, action, enabled, failure_threshold, input].hash
|
192
|
+
[source_id, destination_id, trigger, action, enabled, failure_threshold, input, cursor].hash
|
183
193
|
end
|
184
194
|
|
185
195
|
# Builds the object from hash
|
@@ -10,7 +10,7 @@ module Algolia
|
|
10
10
|
# Universally unique identifier (UUID) of a task.
|
11
11
|
attr_accessor :task_id
|
12
12
|
|
13
|
-
# Date of creation in
|
13
|
+
# Date of creation in RFC 3339 format.
|
14
14
|
attr_accessor :created_at
|
15
15
|
|
16
16
|
# Attribute mapping from ruby-style variable name to JSON key.
|
@@ -10,7 +10,7 @@ module Algolia
|
|
10
10
|
# Universally unique identifier (UUID) of a task.
|
11
11
|
attr_accessor :task_id
|
12
12
|
|
13
|
-
# Date of last update in
|
13
|
+
# Date of last update in RFC 3339 format.
|
14
14
|
attr_accessor :updated_at
|
15
15
|
|
16
16
|
# Attribute mapping from ruby-style variable name to JSON key.
|
@@ -0,0 +1,257 @@
|
|
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 Transformation
|
9
|
+
# Universally unique identifier (UUID) of a transformation.
|
10
|
+
attr_accessor :transformation_id
|
11
|
+
|
12
|
+
# The source code of the transformation.
|
13
|
+
attr_accessor :code
|
14
|
+
|
15
|
+
# The uniquely identified name of your transformation.
|
16
|
+
attr_accessor :name
|
17
|
+
|
18
|
+
# A descriptive name for your transformation of what it does.
|
19
|
+
attr_accessor :description
|
20
|
+
|
21
|
+
# Date of creation in RFC 3339 format.
|
22
|
+
attr_accessor :created_at
|
23
|
+
|
24
|
+
# Date of last update in RFC 3339 format.
|
25
|
+
attr_accessor :updated_at
|
26
|
+
|
27
|
+
# Attribute mapping from ruby-style variable name to JSON key.
|
28
|
+
def self.attribute_map
|
29
|
+
{
|
30
|
+
:transformation_id => :transformationID,
|
31
|
+
:code => :code,
|
32
|
+
:name => :name,
|
33
|
+
:description => :description,
|
34
|
+
:created_at => :createdAt,
|
35
|
+
:updated_at => :updatedAt
|
36
|
+
}
|
37
|
+
end
|
38
|
+
|
39
|
+
# Returns all the JSON keys this model knows about
|
40
|
+
def self.acceptable_attributes
|
41
|
+
attribute_map.values
|
42
|
+
end
|
43
|
+
|
44
|
+
# Attribute type mapping.
|
45
|
+
def self.types_mapping
|
46
|
+
{
|
47
|
+
:transformation_id => :String,
|
48
|
+
:code => :String,
|
49
|
+
:name => :String,
|
50
|
+
:description => :String,
|
51
|
+
:created_at => :String,
|
52
|
+
:updated_at => :String
|
53
|
+
}
|
54
|
+
end
|
55
|
+
|
56
|
+
# List of attributes with nullable: true
|
57
|
+
def self.openapi_nullable
|
58
|
+
Set.new([])
|
59
|
+
end
|
60
|
+
|
61
|
+
# Initializes the object
|
62
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
63
|
+
def initialize(attributes = {})
|
64
|
+
unless attributes.is_a?(Hash)
|
65
|
+
raise ArgumentError, "The input argument (attributes) must be a hash in `Algolia::Transformation` initialize method"
|
66
|
+
end
|
67
|
+
|
68
|
+
# check to see if the attribute exists and convert string to symbol for hash key
|
69
|
+
attributes = attributes.each_with_object({}) do |(k, v), h|
|
70
|
+
unless self.class.attribute_map.key?(k.to_sym)
|
71
|
+
raise ArgumentError,
|
72
|
+
"`#{k}` is not a valid attribute in `Algolia::Transformation`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
|
73
|
+
end
|
74
|
+
|
75
|
+
h[k.to_sym] = v
|
76
|
+
end
|
77
|
+
|
78
|
+
if attributes.key?(:transformation_id)
|
79
|
+
self.transformation_id = attributes[:transformation_id]
|
80
|
+
else
|
81
|
+
self.transformation_id = nil
|
82
|
+
end
|
83
|
+
|
84
|
+
if attributes.key?(:code)
|
85
|
+
self.code = attributes[:code]
|
86
|
+
else
|
87
|
+
self.code = nil
|
88
|
+
end
|
89
|
+
|
90
|
+
if attributes.key?(:name)
|
91
|
+
self.name = attributes[:name]
|
92
|
+
else
|
93
|
+
self.name = nil
|
94
|
+
end
|
95
|
+
|
96
|
+
if attributes.key?(:description)
|
97
|
+
self.description = attributes[:description]
|
98
|
+
else
|
99
|
+
self.description = nil
|
100
|
+
end
|
101
|
+
|
102
|
+
if attributes.key?(:created_at)
|
103
|
+
self.created_at = attributes[:created_at]
|
104
|
+
else
|
105
|
+
self.created_at = nil
|
106
|
+
end
|
107
|
+
|
108
|
+
if attributes.key?(:updated_at)
|
109
|
+
self.updated_at = attributes[:updated_at]
|
110
|
+
end
|
111
|
+
end
|
112
|
+
|
113
|
+
# Checks equality by comparing each attribute.
|
114
|
+
# @param [Object] Object to be compared
|
115
|
+
def ==(other)
|
116
|
+
return true if equal?(other)
|
117
|
+
|
118
|
+
self.class == other.class &&
|
119
|
+
transformation_id == other.transformation_id &&
|
120
|
+
code == other.code &&
|
121
|
+
name == other.name &&
|
122
|
+
description == other.description &&
|
123
|
+
created_at == other.created_at &&
|
124
|
+
updated_at == other.updated_at
|
125
|
+
end
|
126
|
+
|
127
|
+
# @see the `==` method
|
128
|
+
# @param [Object] Object to be compared
|
129
|
+
def eql?(other)
|
130
|
+
self == other
|
131
|
+
end
|
132
|
+
|
133
|
+
# Calculates hash code according to all attributes.
|
134
|
+
# @return [Integer] Hash code
|
135
|
+
def hash
|
136
|
+
[transformation_id, code, name, description, created_at, updated_at].hash
|
137
|
+
end
|
138
|
+
|
139
|
+
# Builds the object from hash
|
140
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
141
|
+
# @return [Object] Returns the model itself
|
142
|
+
def self.build_from_hash(attributes)
|
143
|
+
return nil unless attributes.is_a?(Hash)
|
144
|
+
|
145
|
+
attributes = attributes.transform_keys(&:to_sym)
|
146
|
+
transformed_hash = {}
|
147
|
+
types_mapping.each_pair do |key, type|
|
148
|
+
if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil?
|
149
|
+
transformed_hash[key.to_sym] = nil
|
150
|
+
elsif type =~ /\AArray<(.*)>/i
|
151
|
+
# check to ensure the input is an array given that the attribute
|
152
|
+
# is documented as an array but the input is not
|
153
|
+
if attributes[attribute_map[key]].is_a?(Array)
|
154
|
+
transformed_hash[key.to_sym] = attributes[attribute_map[key]].map { |v| _deserialize(::Regexp.last_match(1), v) }
|
155
|
+
end
|
156
|
+
elsif !attributes[attribute_map[key]].nil?
|
157
|
+
transformed_hash[key.to_sym] = _deserialize(type, attributes[attribute_map[key]])
|
158
|
+
end
|
159
|
+
end
|
160
|
+
new(transformed_hash)
|
161
|
+
end
|
162
|
+
|
163
|
+
# Deserializes the data based on type
|
164
|
+
# @param string type Data type
|
165
|
+
# @param string value Value to be deserialized
|
166
|
+
# @return [Object] Deserialized data
|
167
|
+
def self._deserialize(type, value)
|
168
|
+
case type.to_sym
|
169
|
+
when :Time
|
170
|
+
Time.parse(value)
|
171
|
+
when :Date
|
172
|
+
Date.parse(value)
|
173
|
+
when :String
|
174
|
+
value.to_s
|
175
|
+
when :Integer
|
176
|
+
value.to_i
|
177
|
+
when :Float
|
178
|
+
value.to_f
|
179
|
+
when :Boolean
|
180
|
+
if value.to_s =~ /\A(true|t|yes|y|1)\z/i
|
181
|
+
true
|
182
|
+
else
|
183
|
+
false
|
184
|
+
end
|
185
|
+
when :Object
|
186
|
+
# generic object (usually a Hash), return directly
|
187
|
+
value
|
188
|
+
when /\AArray<(?<inner_type>.+)>\z/
|
189
|
+
inner_type = Regexp.last_match[:inner_type]
|
190
|
+
value.map { |v| _deserialize(inner_type, v) }
|
191
|
+
when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
|
192
|
+
k_type = Regexp.last_match[:k_type]
|
193
|
+
v_type = Regexp.last_match[:v_type]
|
194
|
+
{}.tap do |hash|
|
195
|
+
value.each do |k, v|
|
196
|
+
hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
|
197
|
+
end
|
198
|
+
end
|
199
|
+
else # model
|
200
|
+
# models (e.g. Pet) or oneOf
|
201
|
+
klass = Algolia::Ingestion.const_get(type)
|
202
|
+
klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
|
203
|
+
end
|
204
|
+
end
|
205
|
+
|
206
|
+
# Returns the string representation of the object
|
207
|
+
# @return [String] String presentation of the object
|
208
|
+
def to_s
|
209
|
+
to_hash.to_s
|
210
|
+
end
|
211
|
+
|
212
|
+
# to_body is an alias to to_hash (backward compatibility)
|
213
|
+
# @return [Hash] Returns the object in the form of hash
|
214
|
+
def to_body
|
215
|
+
to_hash
|
216
|
+
end
|
217
|
+
|
218
|
+
def to_json(*_args)
|
219
|
+
to_hash.to_json
|
220
|
+
end
|
221
|
+
|
222
|
+
# Returns the object in the form of hash
|
223
|
+
# @return [Hash] Returns the object in the form of hash
|
224
|
+
def to_hash
|
225
|
+
hash = {}
|
226
|
+
self.class.attribute_map.each_pair do |attr, param|
|
227
|
+
value = send(attr)
|
228
|
+
if value.nil?
|
229
|
+
is_nullable = self.class.openapi_nullable.include?(attr)
|
230
|
+
next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
|
231
|
+
end
|
232
|
+
|
233
|
+
hash[param] = _to_hash(value)
|
234
|
+
end
|
235
|
+
hash
|
236
|
+
end
|
237
|
+
|
238
|
+
# Outputs non-array value in the form of hash
|
239
|
+
# For object, use to_hash. Otherwise, just return the value
|
240
|
+
# @param [Object] value Any valid value
|
241
|
+
# @return [Hash] Returns the value in the form of hash
|
242
|
+
def _to_hash(value)
|
243
|
+
if value.is_a?(Array)
|
244
|
+
value.compact.map { |v| _to_hash(v) }
|
245
|
+
elsif value.is_a?(Hash)
|
246
|
+
{}.tap do |hash|
|
247
|
+
value.each { |k, v| hash[k] = _to_hash(v) }
|
248
|
+
end
|
249
|
+
elsif value.respond_to? :to_hash
|
250
|
+
value.to_hash
|
251
|
+
else
|
252
|
+
value
|
253
|
+
end
|
254
|
+
end
|
255
|
+
end
|
256
|
+
end
|
257
|
+
end
|