allq_rest 1.2.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/Gemfile +7 -0
- data/Gemfile.lock +69 -0
- data/README.md +111 -0
- data/Rakefile +8 -0
- data/allq_client-1.2.0.gem +0 -0
- data/allq_client.gemspec +46 -0
- data/allq_rest.gemspec +34 -0
- data/deploy.sh +3 -0
- data/docs/ActionsApi.md +544 -0
- data/docs/AdminApi.md +98 -0
- data/docs/BasicPayload.md +11 -0
- data/docs/BasicResponse.md +8 -0
- data/docs/JobRef.md +8 -0
- data/docs/JobResponse.md +12 -0
- data/docs/NewJob.md +13 -0
- data/docs/NewParentJob.md +16 -0
- data/docs/StatsInfo.md +9 -0
- data/docs/StatsResults.md +10 -0
- data/docs/StatsTube.md +14 -0
- data/docs/Throttle.md +9 -0
- data/docs/TubeRef.md +8 -0
- data/git_push.sh +55 -0
- data/lib/.DS_Store +0 -0
- data/lib/allq_client.rb +53 -0
- data/lib/allq_client/.DS_Store +0 -0
- data/lib/allq_client/api/actions_api.rb +702 -0
- data/lib/allq_client/api/admin_api.rb +181 -0
- data/lib/allq_client/api_client.rb +388 -0
- data/lib/allq_client/api_error.rb +38 -0
- data/lib/allq_client/configuration.rb +202 -0
- data/lib/allq_client/models/basic_payload.rb +218 -0
- data/lib/allq_client/models/basic_response.rb +188 -0
- data/lib/allq_client/models/job_ref.rb +190 -0
- data/lib/allq_client/models/job_response.rb +249 -0
- data/lib/allq_client/models/multiple_job_response.rb +187 -0
- data/lib/allq_client/models/new_job.rb +270 -0
- data/lib/allq_client/models/new_parent_job.rb +302 -0
- data/lib/allq_client/models/stats_info.rb +204 -0
- data/lib/allq_client/models/stats_results.rb +253 -0
- data/lib/allq_client/models/stats_tube.rb +285 -0
- data/lib/allq_client/models/throttle.rb +209 -0
- data/lib/allq_client/models/tube_ref.rb +190 -0
- data/lib/allq_client/version.rb +15 -0
- data/spec/.DS_Store +0 -0
- data/spec/api/actions_api_spec.rb +575 -0
- data/spec/api/admin_api_spec.rb +58 -0
- data/spec/api_client_spec.rb +226 -0
- data/spec/configuration_spec.rb +42 -0
- data/spec/models/basic_payload_spec.rb +60 -0
- data/spec/models/basic_response_spec.rb +42 -0
- data/spec/models/job_ref_spec.rb +42 -0
- data/spec/models/job_response_spec.rb +66 -0
- data/spec/models/new_job_spec.rb +72 -0
- data/spec/models/new_parent_job_spec.rb +90 -0
- data/spec/models/stats_info_spec.rb +48 -0
- data/spec/models/stats_results_spec.rb +54 -0
- data/spec/models/stats_tube_spec.rb +78 -0
- data/spec/models/throttle_spec.rb +48 -0
- data/spec/models/tube_ref_spec.rb +42 -0
- data/spec/spec_helper.rb +111 -0
- metadata +299 -0
@@ -0,0 +1,302 @@
|
|
1
|
+
=begin
|
2
|
+
#AllQ
|
3
|
+
|
4
|
+
#No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen)
|
5
|
+
|
6
|
+
OpenAPI spec version: 1.0
|
7
|
+
|
8
|
+
Generated by: https://github.com/swagger-api/swagger-codegen.git
|
9
|
+
Swagger Codegen version: 2.4.2
|
10
|
+
|
11
|
+
=end
|
12
|
+
|
13
|
+
require 'date'
|
14
|
+
|
15
|
+
module Allq
|
16
|
+
# Model for a parent job
|
17
|
+
class NewParentJob
|
18
|
+
# Tube name
|
19
|
+
attr_accessor :tube
|
20
|
+
|
21
|
+
# Text payload
|
22
|
+
attr_accessor :body
|
23
|
+
|
24
|
+
# Time to live when reserved (in seconds)
|
25
|
+
attr_accessor :ttl
|
26
|
+
|
27
|
+
# Delay before becoming available for processing in seconds
|
28
|
+
attr_accessor :delay
|
29
|
+
|
30
|
+
# Priority of job in tube
|
31
|
+
attr_accessor :priority
|
32
|
+
|
33
|
+
# Parent job id (if applicable)
|
34
|
+
attr_accessor :parent_id
|
35
|
+
|
36
|
+
# Timeout to run
|
37
|
+
attr_accessor :timeout
|
38
|
+
|
39
|
+
# Execute job after timeout
|
40
|
+
attr_accessor :run_on_timeout
|
41
|
+
|
42
|
+
# Number of children
|
43
|
+
attr_accessor :limit
|
44
|
+
|
45
|
+
# Attribute mapping from ruby-style variable name to JSON key.
|
46
|
+
def self.attribute_map
|
47
|
+
{
|
48
|
+
:'tube' => :'tube',
|
49
|
+
:'body' => :'body',
|
50
|
+
:'ttl' => :'ttl',
|
51
|
+
:'delay' => :'delay',
|
52
|
+
:'priority' => :'priority',
|
53
|
+
:'parent_id' => :'parent_id',
|
54
|
+
:'timeout' => :'timeout',
|
55
|
+
:'run_on_timeout' => :'run_on_timeout',
|
56
|
+
:'limit' => :'limit'
|
57
|
+
}
|
58
|
+
end
|
59
|
+
|
60
|
+
# Attribute type mapping.
|
61
|
+
def self.swagger_types
|
62
|
+
{
|
63
|
+
:'tube' => :'String',
|
64
|
+
:'body' => :'String',
|
65
|
+
:'ttl' => :'Integer',
|
66
|
+
:'delay' => :'Integer',
|
67
|
+
:'priority' => :'Integer',
|
68
|
+
:'parent_id' => :'String',
|
69
|
+
:'timeout' => :'Integer',
|
70
|
+
:'run_on_timeout' => :'BOOLEAN',
|
71
|
+
:'limit' => :'Integer'
|
72
|
+
}
|
73
|
+
end
|
74
|
+
|
75
|
+
# Initializes the object
|
76
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
77
|
+
def initialize(attributes = {})
|
78
|
+
return unless attributes.is_a?(Hash)
|
79
|
+
|
80
|
+
# convert string to symbol for hash key
|
81
|
+
attributes = attributes.each_with_object({}) { |(k, v), h| h[k.to_sym] = v }
|
82
|
+
|
83
|
+
if attributes.has_key?(:'tube')
|
84
|
+
self.tube = attributes[:'tube']
|
85
|
+
else
|
86
|
+
self.tube = 'default'
|
87
|
+
end
|
88
|
+
|
89
|
+
if attributes.has_key?(:'body')
|
90
|
+
self.body = attributes[:'body']
|
91
|
+
else
|
92
|
+
self.body = '<BODY_TEXT>'
|
93
|
+
end
|
94
|
+
|
95
|
+
if attributes.has_key?(:'ttl')
|
96
|
+
self.ttl = attributes[:'ttl']
|
97
|
+
else
|
98
|
+
self.ttl = 1200
|
99
|
+
end
|
100
|
+
|
101
|
+
if attributes.has_key?(:'delay')
|
102
|
+
self.delay = attributes[:'delay']
|
103
|
+
else
|
104
|
+
self.delay = 0
|
105
|
+
end
|
106
|
+
|
107
|
+
if attributes.has_key?(:'priority')
|
108
|
+
self.priority = attributes[:'priority']
|
109
|
+
else
|
110
|
+
self.priority = 5
|
111
|
+
end
|
112
|
+
|
113
|
+
if attributes.has_key?(:'parent_id')
|
114
|
+
self.parent_id = attributes[:'parent_id']
|
115
|
+
end
|
116
|
+
|
117
|
+
if attributes.has_key?(:'timeout')
|
118
|
+
self.timeout = attributes[:'timeout']
|
119
|
+
end
|
120
|
+
|
121
|
+
if attributes.has_key?(:'run_on_timeout')
|
122
|
+
self.run_on_timeout = attributes[:'run_on_timeout']
|
123
|
+
else
|
124
|
+
self.run_on_timeout = false
|
125
|
+
end
|
126
|
+
|
127
|
+
if attributes.has_key?(:'limit')
|
128
|
+
self.limit = attributes[:'limit']
|
129
|
+
end
|
130
|
+
end
|
131
|
+
|
132
|
+
# Show invalid properties with the reasons. Usually used together with valid?
|
133
|
+
# @return Array for valid properties with the reasons
|
134
|
+
def list_invalid_properties
|
135
|
+
invalid_properties = Array.new
|
136
|
+
if @tube.nil?
|
137
|
+
invalid_properties.push('invalid value for "tube", tube cannot be nil.')
|
138
|
+
end
|
139
|
+
|
140
|
+
if @body.nil?
|
141
|
+
invalid_properties.push('invalid value for "body", body cannot be nil.')
|
142
|
+
end
|
143
|
+
|
144
|
+
if @ttl.nil?
|
145
|
+
invalid_properties.push('invalid value for "ttl", ttl cannot be nil.')
|
146
|
+
end
|
147
|
+
|
148
|
+
if @delay.nil?
|
149
|
+
invalid_properties.push('invalid value for "delay", delay cannot be nil.')
|
150
|
+
end
|
151
|
+
|
152
|
+
if @priority.nil?
|
153
|
+
invalid_properties.push('invalid value for "priority", priority cannot be nil.')
|
154
|
+
end
|
155
|
+
|
156
|
+
invalid_properties
|
157
|
+
end
|
158
|
+
|
159
|
+
# Check to see if the all the properties in the model are valid
|
160
|
+
# @return true if the model is valid
|
161
|
+
def valid?
|
162
|
+
return false if @tube.nil?
|
163
|
+
return false if @body.nil?
|
164
|
+
return false if @ttl.nil?
|
165
|
+
return false if @delay.nil?
|
166
|
+
return false if @priority.nil?
|
167
|
+
true
|
168
|
+
end
|
169
|
+
|
170
|
+
# Checks equality by comparing each attribute.
|
171
|
+
# @param [Object] Object to be compared
|
172
|
+
def ==(o)
|
173
|
+
return true if self.equal?(o)
|
174
|
+
self.class == o.class &&
|
175
|
+
tube == o.tube &&
|
176
|
+
body == o.body &&
|
177
|
+
ttl == o.ttl &&
|
178
|
+
delay == o.delay &&
|
179
|
+
priority == o.priority &&
|
180
|
+
parent_id == o.parent_id &&
|
181
|
+
timeout == o.timeout &&
|
182
|
+
run_on_timeout == o.run_on_timeout &&
|
183
|
+
limit == o.limit
|
184
|
+
end
|
185
|
+
|
186
|
+
# @see the `==` method
|
187
|
+
# @param [Object] Object to be compared
|
188
|
+
def eql?(o)
|
189
|
+
self == o
|
190
|
+
end
|
191
|
+
|
192
|
+
# Calculates hash code according to all attributes.
|
193
|
+
# @return [Fixnum] Hash code
|
194
|
+
def hash
|
195
|
+
[tube, body, ttl, delay, priority, parent_id, timeout, run_on_timeout, limit].hash
|
196
|
+
end
|
197
|
+
|
198
|
+
# Builds the object from hash
|
199
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
200
|
+
# @return [Object] Returns the model itself
|
201
|
+
def build_from_hash(attributes)
|
202
|
+
return nil unless attributes.is_a?(Hash)
|
203
|
+
self.class.swagger_types.each_pair do |key, type|
|
204
|
+
if type =~ /\AArray<(.*)>/i
|
205
|
+
# check to ensure the input is an array given that the the attribute
|
206
|
+
# is documented as an array but the input is not
|
207
|
+
if attributes[self.class.attribute_map[key]].is_a?(Array)
|
208
|
+
self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
|
209
|
+
end
|
210
|
+
elsif !attributes[self.class.attribute_map[key]].nil?
|
211
|
+
self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
|
212
|
+
end # or else data not found in attributes(hash), not an issue as the data can be optional
|
213
|
+
end
|
214
|
+
|
215
|
+
self
|
216
|
+
end
|
217
|
+
|
218
|
+
# Deserializes the data based on type
|
219
|
+
# @param string type Data type
|
220
|
+
# @param string value Value to be deserialized
|
221
|
+
# @return [Object] Deserialized data
|
222
|
+
def _deserialize(type, value)
|
223
|
+
case type.to_sym
|
224
|
+
when :DateTime
|
225
|
+
DateTime.parse(value)
|
226
|
+
when :Date
|
227
|
+
Date.parse(value)
|
228
|
+
when :String
|
229
|
+
value.to_s
|
230
|
+
when :Integer
|
231
|
+
value.to_i
|
232
|
+
when :Float
|
233
|
+
value.to_f
|
234
|
+
when :BOOLEAN
|
235
|
+
if value.to_s =~ /\A(true|t|yes|y|1)\z/i
|
236
|
+
true
|
237
|
+
else
|
238
|
+
false
|
239
|
+
end
|
240
|
+
when :Object
|
241
|
+
# generic object (usually a Hash), return directly
|
242
|
+
value
|
243
|
+
when /\AArray<(?<inner_type>.+)>\z/
|
244
|
+
inner_type = Regexp.last_match[:inner_type]
|
245
|
+
value.map { |v| _deserialize(inner_type, v) }
|
246
|
+
when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
|
247
|
+
k_type = Regexp.last_match[:k_type]
|
248
|
+
v_type = Regexp.last_match[:v_type]
|
249
|
+
{}.tap do |hash|
|
250
|
+
value.each do |k, v|
|
251
|
+
hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
|
252
|
+
end
|
253
|
+
end
|
254
|
+
else # model
|
255
|
+
temp_model = Allq.const_get(type).new
|
256
|
+
temp_model.build_from_hash(value)
|
257
|
+
end
|
258
|
+
end
|
259
|
+
|
260
|
+
# Returns the string representation of the object
|
261
|
+
# @return [String] String presentation of the object
|
262
|
+
def to_s
|
263
|
+
to_hash.to_s
|
264
|
+
end
|
265
|
+
|
266
|
+
# to_body is an alias to to_hash (backward compatibility)
|
267
|
+
# @return [Hash] Returns the object in the form of hash
|
268
|
+
def to_body
|
269
|
+
to_hash
|
270
|
+
end
|
271
|
+
|
272
|
+
# Returns the object in the form of hash
|
273
|
+
# @return [Hash] Returns the object in the form of hash
|
274
|
+
def to_hash
|
275
|
+
hash = {}
|
276
|
+
self.class.attribute_map.each_pair do |attr, param|
|
277
|
+
value = self.send(attr)
|
278
|
+
next if value.nil?
|
279
|
+
hash[param] = _to_hash(value)
|
280
|
+
end
|
281
|
+
hash
|
282
|
+
end
|
283
|
+
|
284
|
+
# Outputs non-array value in the form of hash
|
285
|
+
# For object, use to_hash. Otherwise, just return the value
|
286
|
+
# @param [Object] value Any valid value
|
287
|
+
# @return [Hash] Returns the value in the form of hash
|
288
|
+
def _to_hash(value)
|
289
|
+
if value.is_a?(Array)
|
290
|
+
value.compact.map { |v| _to_hash(v) }
|
291
|
+
elsif value.is_a?(Hash)
|
292
|
+
{}.tap do |hash|
|
293
|
+
value.each { |k, v| hash[k] = _to_hash(v) }
|
294
|
+
end
|
295
|
+
elsif value.respond_to? :to_hash
|
296
|
+
value.to_hash
|
297
|
+
else
|
298
|
+
value
|
299
|
+
end
|
300
|
+
end
|
301
|
+
end
|
302
|
+
end
|
@@ -0,0 +1,204 @@
|
|
1
|
+
=begin
|
2
|
+
#AllQ
|
3
|
+
|
4
|
+
#No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen)
|
5
|
+
|
6
|
+
OpenAPI spec version: 1.0
|
7
|
+
|
8
|
+
Generated by: https://github.com/swagger-api/swagger-codegen.git
|
9
|
+
Swagger Codegen version: 2.4.2
|
10
|
+
|
11
|
+
=end
|
12
|
+
|
13
|
+
require 'date'
|
14
|
+
|
15
|
+
module Allq
|
16
|
+
# Individual Server Info
|
17
|
+
class StatsInfo
|
18
|
+
# Name of tube
|
19
|
+
attr_accessor :tube_name
|
20
|
+
|
21
|
+
attr_accessor :info
|
22
|
+
|
23
|
+
# Attribute mapping from ruby-style variable name to JSON key.
|
24
|
+
def self.attribute_map
|
25
|
+
{
|
26
|
+
:'tube_name' => :'tube_name',
|
27
|
+
:'info' => :'info'
|
28
|
+
}
|
29
|
+
end
|
30
|
+
|
31
|
+
# Attribute type mapping.
|
32
|
+
def self.swagger_types
|
33
|
+
{
|
34
|
+
:'tube_name' => :'String',
|
35
|
+
:'info' => :'StatsTube'
|
36
|
+
}
|
37
|
+
end
|
38
|
+
|
39
|
+
# Initializes the object
|
40
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
41
|
+
def initialize(attributes = {})
|
42
|
+
return unless attributes.is_a?(Hash)
|
43
|
+
|
44
|
+
# convert string to symbol for hash key
|
45
|
+
attributes = attributes.each_with_object({}) { |(k, v), h| h[k.to_sym] = v }
|
46
|
+
|
47
|
+
if attributes.has_key?(:'tube_name')
|
48
|
+
self.tube_name = attributes[:'tube_name']
|
49
|
+
end
|
50
|
+
|
51
|
+
if attributes.has_key?(:'info')
|
52
|
+
self.info = attributes[:'info']
|
53
|
+
end
|
54
|
+
end
|
55
|
+
|
56
|
+
# Show invalid properties with the reasons. Usually used together with valid?
|
57
|
+
# @return Array for valid properties with the reasons
|
58
|
+
def list_invalid_properties
|
59
|
+
invalid_properties = Array.new
|
60
|
+
if @tube_name.nil?
|
61
|
+
invalid_properties.push('invalid value for "tube_name", tube_name cannot be nil.')
|
62
|
+
end
|
63
|
+
|
64
|
+
if @info.nil?
|
65
|
+
invalid_properties.push('invalid value for "info", info cannot be nil.')
|
66
|
+
end
|
67
|
+
|
68
|
+
invalid_properties
|
69
|
+
end
|
70
|
+
|
71
|
+
# Check to see if the all the properties in the model are valid
|
72
|
+
# @return true if the model is valid
|
73
|
+
def valid?
|
74
|
+
return false if @tube_name.nil?
|
75
|
+
return false if @info.nil?
|
76
|
+
true
|
77
|
+
end
|
78
|
+
|
79
|
+
# Checks equality by comparing each attribute.
|
80
|
+
# @param [Object] Object to be compared
|
81
|
+
def ==(o)
|
82
|
+
return true if self.equal?(o)
|
83
|
+
self.class == o.class &&
|
84
|
+
tube_name == o.tube_name &&
|
85
|
+
info == o.info
|
86
|
+
end
|
87
|
+
|
88
|
+
# @see the `==` method
|
89
|
+
# @param [Object] Object to be compared
|
90
|
+
def eql?(o)
|
91
|
+
self == o
|
92
|
+
end
|
93
|
+
|
94
|
+
# Calculates hash code according to all attributes.
|
95
|
+
# @return [Fixnum] Hash code
|
96
|
+
def hash
|
97
|
+
[tube_name, info].hash
|
98
|
+
end
|
99
|
+
|
100
|
+
# Builds the object from hash
|
101
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
102
|
+
# @return [Object] Returns the model itself
|
103
|
+
def build_from_hash(attributes)
|
104
|
+
return nil unless attributes.is_a?(Hash)
|
105
|
+
self.class.swagger_types.each_pair do |key, type|
|
106
|
+
if type =~ /\AArray<(.*)>/i
|
107
|
+
# check to ensure the input is an array given that the the attribute
|
108
|
+
# is documented as an array but the input is not
|
109
|
+
if attributes[self.class.attribute_map[key]].is_a?(Array)
|
110
|
+
self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
|
111
|
+
end
|
112
|
+
elsif !attributes[self.class.attribute_map[key]].nil?
|
113
|
+
self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
|
114
|
+
end # or else data not found in attributes(hash), not an issue as the data can be optional
|
115
|
+
end
|
116
|
+
|
117
|
+
self
|
118
|
+
end
|
119
|
+
|
120
|
+
# Deserializes the data based on type
|
121
|
+
# @param string type Data type
|
122
|
+
# @param string value Value to be deserialized
|
123
|
+
# @return [Object] Deserialized data
|
124
|
+
def _deserialize(type, value)
|
125
|
+
case type.to_sym
|
126
|
+
when :DateTime
|
127
|
+
DateTime.parse(value)
|
128
|
+
when :Date
|
129
|
+
Date.parse(value)
|
130
|
+
when :String
|
131
|
+
value.to_s
|
132
|
+
when :Integer
|
133
|
+
value.to_i
|
134
|
+
when :Float
|
135
|
+
value.to_f
|
136
|
+
when :BOOLEAN
|
137
|
+
if value.to_s =~ /\A(true|t|yes|y|1)\z/i
|
138
|
+
true
|
139
|
+
else
|
140
|
+
false
|
141
|
+
end
|
142
|
+
when :Object
|
143
|
+
# generic object (usually a Hash), return directly
|
144
|
+
value
|
145
|
+
when /\AArray<(?<inner_type>.+)>\z/
|
146
|
+
inner_type = Regexp.last_match[:inner_type]
|
147
|
+
value.map { |v| _deserialize(inner_type, v) }
|
148
|
+
when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
|
149
|
+
k_type = Regexp.last_match[:k_type]
|
150
|
+
v_type = Regexp.last_match[:v_type]
|
151
|
+
{}.tap do |hash|
|
152
|
+
value.each do |k, v|
|
153
|
+
hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
|
154
|
+
end
|
155
|
+
end
|
156
|
+
else # model
|
157
|
+
temp_model = Allq.const_get(type).new
|
158
|
+
temp_model.build_from_hash(value)
|
159
|
+
end
|
160
|
+
end
|
161
|
+
|
162
|
+
# Returns the string representation of the object
|
163
|
+
# @return [String] String presentation of the object
|
164
|
+
def to_s
|
165
|
+
to_hash.to_s
|
166
|
+
end
|
167
|
+
|
168
|
+
# to_body is an alias to to_hash (backward compatibility)
|
169
|
+
# @return [Hash] Returns the object in the form of hash
|
170
|
+
def to_body
|
171
|
+
to_hash
|
172
|
+
end
|
173
|
+
|
174
|
+
# Returns the object in the form of hash
|
175
|
+
# @return [Hash] Returns the object in the form of hash
|
176
|
+
def to_hash
|
177
|
+
hash = {}
|
178
|
+
self.class.attribute_map.each_pair do |attr, param|
|
179
|
+
value = self.send(attr)
|
180
|
+
next if value.nil?
|
181
|
+
hash[param] = _to_hash(value)
|
182
|
+
end
|
183
|
+
hash
|
184
|
+
end
|
185
|
+
|
186
|
+
# Outputs non-array value in the form of hash
|
187
|
+
# For object, use to_hash. Otherwise, just return the value
|
188
|
+
# @param [Object] value Any valid value
|
189
|
+
# @return [Hash] Returns the value in the form of hash
|
190
|
+
def _to_hash(value)
|
191
|
+
if value.is_a?(Array)
|
192
|
+
value.compact.map { |v| _to_hash(v) }
|
193
|
+
elsif value.is_a?(Hash)
|
194
|
+
{}.tap do |hash|
|
195
|
+
value.each { |k, v| hash[k] = _to_hash(v) }
|
196
|
+
end
|
197
|
+
elsif value.respond_to? :to_hash
|
198
|
+
value.to_hash
|
199
|
+
else
|
200
|
+
value
|
201
|
+
end
|
202
|
+
end
|
203
|
+
end
|
204
|
+
end
|