algolia 3.8.2 → 3.10.2

Sign up to get free protection for your applications and to get access to all the features.
@@ -1,238 +0,0 @@
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 Search
8
- class UpdatedRuleResponse
9
- # Unique identifier of a rule object.
10
- attr_accessor :object_id
11
-
12
- # Date and time when the object was updated, in RFC 3339 format.
13
- attr_accessor :updated_at
14
-
15
- # Unique identifier of a task. A successful API response means that a task was added to a queue. It might not run immediately. You can check the task's progress with the [`task` operation](#tag/Indices/operation/getTask) and this `taskID`.
16
- attr_accessor :task_id
17
-
18
- # Attribute mapping from ruby-style variable name to JSON key.
19
- def self.attribute_map
20
- {
21
- :object_id => :objectID,
22
- :updated_at => :updatedAt,
23
- :task_id => :taskID
24
- }
25
- end
26
-
27
- # Returns all the JSON keys this model knows about
28
- def self.acceptable_attributes
29
- attribute_map.values
30
- end
31
-
32
- # Attribute type mapping.
33
- def self.types_mapping
34
- {
35
- :object_id => :"String",
36
- :updated_at => :"String",
37
- :task_id => :"Integer"
38
- }
39
- end
40
-
41
- # List of attributes with nullable: true
42
- def self.openapi_nullable
43
- Set.new(
44
- []
45
- )
46
- end
47
-
48
- # Initializes the object
49
- # @param [Hash] attributes Model attributes in the form of hash
50
- def initialize(attributes = {})
51
- if (!attributes.is_a?(Hash))
52
- raise(
53
- ArgumentError,
54
- "The input argument (attributes) must be a hash in `Algolia::UpdatedRuleResponse` initialize method"
55
- )
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({}) { |(k, v), h|
60
- if (!self.class.attribute_map.key?(k.to_sym))
61
- raise(
62
- ArgumentError,
63
- "`#{k}` is not a valid attribute in `Algolia::UpdatedRuleResponse`. Please check the name to make sure it's valid. List of attributes: " +
64
- self.class.attribute_map.keys.inspect
65
- )
66
- end
67
-
68
- h[k.to_sym] = v
69
- }
70
-
71
- if attributes.key?(:object_id)
72
- self.object_id = attributes[:object_id]
73
- else
74
- self.object_id = nil
75
- end
76
-
77
- if attributes.key?(:updated_at)
78
- self.updated_at = attributes[:updated_at]
79
- else
80
- self.updated_at = nil
81
- end
82
-
83
- if attributes.key?(:task_id)
84
- self.task_id = attributes[:task_id]
85
- else
86
- self.task_id = nil
87
- end
88
- end
89
-
90
- # Checks equality by comparing each attribute.
91
- # @param [Object] Object to be compared
92
- def ==(other)
93
- return true if self.equal?(other)
94
- self.class == other.class &&
95
- object_id == other.object_id &&
96
- updated_at == other.updated_at &&
97
- task_id == other.task_id
98
- end
99
-
100
- # @see the `==` method
101
- # @param [Object] Object to be compared
102
- def eql?(other)
103
- self == other
104
- end
105
-
106
- # Calculates hash code according to all attributes.
107
- # @return [Integer] Hash code
108
- def hash
109
- [object_id, updated_at, task_id].hash
110
- end
111
-
112
- # Builds the object from hash
113
- # @param [Hash] attributes Model attributes in the form of hash
114
- # @return [Object] Returns the model itself
115
- def self.build_from_hash(attributes)
116
- return nil unless attributes.is_a?(Hash)
117
- attributes = attributes.transform_keys(&:to_sym)
118
- transformed_hash = {}
119
- types_mapping.each_pair do |key, type|
120
- if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil?
121
- transformed_hash[key.to_sym] = nil
122
- elsif type =~ /\AArray<(.*)>/i
123
- # check to ensure the input is an array given that the attribute
124
- # is documented as an array but the input is not
125
- if attributes[attribute_map[key]].is_a?(Array)
126
- transformed_hash[key.to_sym] = attributes[attribute_map[key]].map { |v|
127
- _deserialize(::Regexp.last_match(1), v)
128
- }
129
- end
130
- elsif !attributes[attribute_map[key]].nil?
131
- transformed_hash[key.to_sym] = _deserialize(type, attributes[attribute_map[key]])
132
- end
133
- end
134
-
135
- new(transformed_hash)
136
- end
137
-
138
- # Deserializes the data based on type
139
- # @param string type Data type
140
- # @param string value Value to be deserialized
141
- # @return [Object] Deserialized data
142
- def self._deserialize(type, value)
143
- case type.to_sym
144
- when :Time
145
- Time.parse(value)
146
- when :Date
147
- Date.parse(value)
148
- when :String
149
- value.to_s
150
- when :Integer
151
- value.to_i
152
- when :Float
153
- value.to_f
154
- when :Boolean
155
- if value.to_s =~ /\A(true|t|yes|y|1)\z/i
156
- true
157
- else
158
- false
159
- end
160
-
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
- # model
176
- else
177
- # models (e.g. Pet) or oneOf
178
- klass = Algolia::Search.const_get(type)
179
- klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass
180
- .build_from_hash(value)
181
- end
182
- end
183
-
184
- # Returns the string representation of the object
185
- # @return [String] String presentation of the object
186
- def to_s
187
- to_hash.to_s
188
- end
189
-
190
- # to_body is an alias to to_hash (backward compatibility)
191
- # @return [Hash] Returns the object in the form of hash
192
- def to_body
193
- to_hash
194
- end
195
-
196
- def to_json(*_args)
197
- to_hash.to_json
198
- end
199
-
200
- # Returns the object in the form of hash
201
- # @return [Hash] Returns the object in the form of hash
202
- def to_hash
203
- hash = {}
204
- self.class.attribute_map.each_pair do |attr, param|
205
- value = send(attr)
206
- if value.nil?
207
- is_nullable = self.class.openapi_nullable.include?(attr)
208
- next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
209
- end
210
-
211
- hash[param] = _to_hash(value)
212
- end
213
-
214
- hash
215
- end
216
-
217
- # Outputs non-array value in the form of hash
218
- # For object, use to_hash. Otherwise, just return the value
219
- # @param [Object] value Any valid value
220
- # @return [Hash] Returns the value in the form of hash
221
- def _to_hash(value)
222
- if value.is_a?(Array)
223
- value.compact.map { |v| _to_hash(v) }
224
- elsif value.is_a?(Hash)
225
- {}.tap do |hash|
226
- value.each { |k, v| hash[k] = _to_hash(v) }
227
- end
228
- elsif value.respond_to?(:to_hash)
229
- value.to_hash
230
- else
231
- value
232
- end
233
- end
234
-
235
- end
236
-
237
- end
238
- end