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