telestream_cloud_qc 2.0.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (73) hide show
  1. checksums.yaml +7 -0
  2. data/Gemfile +7 -0
  3. data/README.md +58 -0
  4. data/Rakefile +8 -0
  5. data/docs/Alert.md +13 -0
  6. data/docs/AudioStream.md +13 -0
  7. data/docs/Container.md +9 -0
  8. data/docs/Data.md +10 -0
  9. data/docs/Data1.md +9 -0
  10. data/docs/ExtraFile.md +10 -0
  11. data/docs/Job.md +12 -0
  12. data/docs/JobData.md +9 -0
  13. data/docs/JobDetails.md +9 -0
  14. data/docs/JobDetailsResult.md +8 -0
  15. data/docs/JobsCollection.md +12 -0
  16. data/docs/Media.md +10 -0
  17. data/docs/Options.md +7 -0
  18. data/docs/Project.md +12 -0
  19. data/docs/Proxy.md +12 -0
  20. data/docs/QcApi.md +719 -0
  21. data/docs/UploadSession.md +13 -0
  22. data/docs/VideoStream.md +13 -0
  23. data/docs/VideoUploadBody.md +12 -0
  24. data/git_push.sh +55 -0
  25. data/lib/telestream_cloud_qc/api/qc_api.rb +781 -0
  26. data/lib/telestream_cloud_qc/api_client.rb +389 -0
  27. data/lib/telestream_cloud_qc/api_error.rb +38 -0
  28. data/lib/telestream_cloud_qc/configuration.rb +209 -0
  29. data/lib/telestream_cloud_qc/models/alert.rb +236 -0
  30. data/lib/telestream_cloud_qc/models/audio_stream.rb +238 -0
  31. data/lib/telestream_cloud_qc/models/container.rb +198 -0
  32. data/lib/telestream_cloud_qc/models/data.rb +208 -0
  33. data/lib/telestream_cloud_qc/models/data_1.rb +197 -0
  34. data/lib/telestream_cloud_qc/models/extra_file.rb +221 -0
  35. data/lib/telestream_cloud_qc/models/job.rb +269 -0
  36. data/lib/telestream_cloud_qc/models/job_data.rb +197 -0
  37. data/lib/telestream_cloud_qc/models/job_details.rb +199 -0
  38. data/lib/telestream_cloud_qc/models/job_details_result.rb +190 -0
  39. data/lib/telestream_cloud_qc/models/jobs_collection.rb +230 -0
  40. data/lib/telestream_cloud_qc/models/media.rb +210 -0
  41. data/lib/telestream_cloud_qc/models/options.rb +179 -0
  42. data/lib/telestream_cloud_qc/models/project.rb +262 -0
  43. data/lib/telestream_cloud_qc/models/proxy.rb +224 -0
  44. data/lib/telestream_cloud_qc/models/upload_session.rb +249 -0
  45. data/lib/telestream_cloud_qc/models/video_stream.rb +235 -0
  46. data/lib/telestream_cloud_qc/models/video_upload_body.rb +242 -0
  47. data/lib/telestream_cloud_qc/uploader.rb +244 -0
  48. data/lib/telestream_cloud_qc/version.rb +18 -0
  49. data/lib/telestream_cloud_qc.rb +64 -0
  50. data/spec/api/qc_api_spec.rb +202 -0
  51. data/spec/api_client_spec.rb +226 -0
  52. data/spec/configuration_spec.rb +42 -0
  53. data/spec/models/alert_spec.rb +72 -0
  54. data/spec/models/audio_stream_spec.rb +72 -0
  55. data/spec/models/container_spec.rb +48 -0
  56. data/spec/models/data_1_spec.rb +48 -0
  57. data/spec/models/data_spec.rb +54 -0
  58. data/spec/models/extra_file_spec.rb +54 -0
  59. data/spec/models/job_data_spec.rb +48 -0
  60. data/spec/models/job_details_result_spec.rb +42 -0
  61. data/spec/models/job_details_spec.rb +48 -0
  62. data/spec/models/job_spec.rb +74 -0
  63. data/spec/models/jobs_collection_spec.rb +66 -0
  64. data/spec/models/media_spec.rb +54 -0
  65. data/spec/models/options_spec.rb +36 -0
  66. data/spec/models/project_spec.rb +70 -0
  67. data/spec/models/proxy_spec.rb +66 -0
  68. data/spec/models/upload_session_spec.rb +72 -0
  69. data/spec/models/video_stream_spec.rb +72 -0
  70. data/spec/models/video_upload_body_spec.rb +66 -0
  71. data/spec/spec_helper.rb +111 -0
  72. data/telestream_cloud_qc.gemspec +47 -0
  73. metadata +336 -0
@@ -0,0 +1,190 @@
1
+ =begin
2
+ #Qc API
3
+
4
+ #QC API
5
+
6
+ OpenAPI spec version: 2.0.0
7
+ Contact: cloudsupport@telestream.net
8
+ Generated by: https://github.com/swagger-api/swagger-codegen.git
9
+ Swagger Codegen version: 2.3.0
10
+
11
+ =end
12
+
13
+ require 'date'
14
+
15
+ module TelestreamCloud::Qc
16
+ # Job type specific result
17
+ class JobDetailsResult
18
+ attr_accessor :alerts
19
+
20
+
21
+ # Attribute mapping from ruby-style variable name to JSON key.
22
+ def self.attribute_map
23
+ {
24
+ :'alerts' => :'alerts'
25
+ }
26
+ end
27
+
28
+ # Attribute type mapping.
29
+ def self.swagger_types
30
+ {
31
+ :'alerts' => :'Array<Alert>'
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?(:'alerts')
44
+ if (value = attributes[:'alerts']).is_a?(Array)
45
+ self.alerts = value
46
+ end
47
+ end
48
+
49
+ end
50
+
51
+ # Show invalid properties with the reasons. Usually used together with valid?
52
+ # @return Array for valid properties with the reasons
53
+ def list_invalid_properties
54
+ invalid_properties = Array.new
55
+ return invalid_properties
56
+ end
57
+
58
+ # Check to see if the all the properties in the model are valid
59
+ # @return true if the model is valid
60
+ def valid?
61
+ return true
62
+ end
63
+
64
+ # Checks equality by comparing each attribute.
65
+ # @param [Object] Object to be compared
66
+ def ==(o)
67
+ return true if self.equal?(o)
68
+ self.class == o.class &&
69
+ alerts == o.alerts
70
+ end
71
+
72
+ # @see the `==` method
73
+ # @param [Object] Object to be compared
74
+ def eql?(o)
75
+ self == o
76
+ end
77
+
78
+ # Calculates hash code according to all attributes.
79
+ # @return [Fixnum] Hash code
80
+ def hash
81
+ [alerts].hash
82
+ end
83
+
84
+ # Builds the object from hash
85
+ # @param [Hash] attributes Model attributes in the form of hash
86
+ # @return [Object] Returns the model itself
87
+ def build_from_hash(attributes)
88
+ return nil unless attributes.is_a?(Hash)
89
+ self.class.swagger_types.each_pair do |key, type|
90
+ if type =~ /\AArray<(.*)>/i
91
+ # check to ensure the input is an array given that the the attribute
92
+ # is documented as an array but the input is not
93
+ if attributes[self.class.attribute_map[key]].is_a?(Array)
94
+ self.send("#{key}=", attributes[self.class.attribute_map[key]].map{ |v| _deserialize($1, v) } )
95
+ end
96
+ elsif !attributes[self.class.attribute_map[key]].nil?
97
+ self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
98
+ end # or else data not found in attributes(hash), not an issue as the data can be optional
99
+ end
100
+
101
+ self
102
+ end
103
+
104
+ # Deserializes the data based on type
105
+ # @param string type Data type
106
+ # @param string value Value to be deserialized
107
+ # @return [Object] Deserialized data
108
+ def _deserialize(type, value)
109
+ case type.to_sym
110
+ when :DateTime
111
+ DateTime.parse(value)
112
+ when :Date
113
+ Date.parse(value)
114
+ when :String
115
+ value.to_s
116
+ when :Integer
117
+ value.to_i
118
+ when :Float
119
+ value.to_f
120
+ when :BOOLEAN
121
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
122
+ true
123
+ else
124
+ false
125
+ end
126
+ when :Object
127
+ # generic object (usually a Hash), return directly
128
+ value
129
+ when /\AArray<(?<inner_type>.+)>\z/
130
+ inner_type = Regexp.last_match[:inner_type]
131
+ value.map { |v| _deserialize(inner_type, v) }
132
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
133
+ k_type = Regexp.last_match[:k_type]
134
+ v_type = Regexp.last_match[:v_type]
135
+ {}.tap do |hash|
136
+ value.each do |k, v|
137
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
138
+ end
139
+ end
140
+ else # model
141
+ temp_model = TelestreamCloud::Qc.const_get(type).new
142
+ temp_model.build_from_hash(value)
143
+ end
144
+ end
145
+
146
+ # Returns the string representation of the object
147
+ # @return [String] String presentation of the object
148
+ def to_s
149
+ to_hash.to_s
150
+ end
151
+
152
+ # to_body is an alias to to_hash (backward compatibility)
153
+ # @return [Hash] Returns the object in the form of hash
154
+ def to_body
155
+ to_hash
156
+ end
157
+
158
+ # Returns the object in the form of hash
159
+ # @return [Hash] Returns the object in the form of hash
160
+ def to_hash
161
+ hash = {}
162
+ self.class.attribute_map.each_pair do |attr, param|
163
+ value = self.send(attr)
164
+ next if value.nil?
165
+ hash[param] = _to_hash(value)
166
+ end
167
+ hash
168
+ end
169
+
170
+ # Outputs non-array value in the form of hash
171
+ # For object, use to_hash. Otherwise, just return the value
172
+ # @param [Object] value Any valid value
173
+ # @return [Hash] Returns the value in the form of hash
174
+ def _to_hash(value)
175
+ if value.is_a?(Array)
176
+ value.compact.map{ |v| _to_hash(v) }
177
+ elsif value.is_a?(Hash)
178
+ {}.tap do |hash|
179
+ value.each { |k, v| hash[k] = _to_hash(v) }
180
+ end
181
+ elsif value.respond_to? :to_hash
182
+ value.to_hash
183
+ else
184
+ value
185
+ end
186
+ end
187
+
188
+ end
189
+
190
+ end
@@ -0,0 +1,230 @@
1
+ =begin
2
+ #Qc API
3
+
4
+ #QC API
5
+
6
+ OpenAPI spec version: 2.0.0
7
+ Contact: cloudsupport@telestream.net
8
+ Generated by: https://github.com/swagger-api/swagger-codegen.git
9
+ Swagger Codegen version: 2.3.0
10
+
11
+ =end
12
+
13
+ require 'date'
14
+
15
+ module TelestreamCloud::Qc
16
+
17
+ class JobsCollection
18
+ attr_accessor :jobs
19
+
20
+ # A number of the fetched page.
21
+ attr_accessor :page
22
+
23
+ # A number of jobs per page.
24
+ attr_accessor :per_page
25
+
26
+ # A number of all pages.
27
+ attr_accessor :page_count
28
+
29
+ # A number of all jobs stored in the db.
30
+ attr_accessor :total_count
31
+
32
+
33
+ # Attribute mapping from ruby-style variable name to JSON key.
34
+ def self.attribute_map
35
+ {
36
+ :'jobs' => :'jobs',
37
+ :'page' => :'page',
38
+ :'per_page' => :'per_page',
39
+ :'page_count' => :'page_count',
40
+ :'total_count' => :'total_count'
41
+ }
42
+ end
43
+
44
+ # Attribute type mapping.
45
+ def self.swagger_types
46
+ {
47
+ :'jobs' => :'Array<Job>',
48
+ :'page' => :'Integer',
49
+ :'per_page' => :'Integer',
50
+ :'page_count' => :'Integer',
51
+ :'total_count' => :'Integer'
52
+ }
53
+ end
54
+
55
+ # Initializes the object
56
+ # @param [Hash] attributes Model attributes in the form of hash
57
+ def initialize(attributes = {})
58
+ return unless attributes.is_a?(Hash)
59
+
60
+ # convert string to symbol for hash key
61
+ attributes = attributes.each_with_object({}){|(k,v), h| h[k.to_sym] = v}
62
+
63
+ if attributes.has_key?(:'jobs')
64
+ if (value = attributes[:'jobs']).is_a?(Array)
65
+ self.jobs = value
66
+ end
67
+ end
68
+
69
+ if attributes.has_key?(:'page')
70
+ self.page = attributes[:'page']
71
+ end
72
+
73
+ if attributes.has_key?(:'per_page')
74
+ self.per_page = attributes[:'per_page']
75
+ end
76
+
77
+ if attributes.has_key?(:'page_count')
78
+ self.page_count = attributes[:'page_count']
79
+ end
80
+
81
+ if attributes.has_key?(:'total_count')
82
+ self.total_count = attributes[:'total_count']
83
+ end
84
+
85
+ end
86
+
87
+ # Show invalid properties with the reasons. Usually used together with valid?
88
+ # @return Array for valid properties with the reasons
89
+ def list_invalid_properties
90
+ invalid_properties = Array.new
91
+ return invalid_properties
92
+ end
93
+
94
+ # Check to see if the all the properties in the model are valid
95
+ # @return true if the model is valid
96
+ def valid?
97
+ return true
98
+ end
99
+
100
+ # Checks equality by comparing each attribute.
101
+ # @param [Object] Object to be compared
102
+ def ==(o)
103
+ return true if self.equal?(o)
104
+ self.class == o.class &&
105
+ jobs == o.jobs &&
106
+ page == o.page &&
107
+ per_page == o.per_page &&
108
+ page_count == o.page_count &&
109
+ total_count == o.total_count
110
+ end
111
+
112
+ # @see the `==` method
113
+ # @param [Object] Object to be compared
114
+ def eql?(o)
115
+ self == o
116
+ end
117
+
118
+ # Calculates hash code according to all attributes.
119
+ # @return [Fixnum] Hash code
120
+ def hash
121
+ [jobs, page, per_page, page_count, total_count].hash
122
+ end
123
+
124
+ # Builds the object from hash
125
+ # @param [Hash] attributes Model attributes in the form of hash
126
+ # @return [Object] Returns the model itself
127
+ def build_from_hash(attributes)
128
+ return nil unless attributes.is_a?(Hash)
129
+ self.class.swagger_types.each_pair do |key, type|
130
+ if type =~ /\AArray<(.*)>/i
131
+ # check to ensure the input is an array given that the the attribute
132
+ # is documented as an array but the input is not
133
+ if attributes[self.class.attribute_map[key]].is_a?(Array)
134
+ self.send("#{key}=", attributes[self.class.attribute_map[key]].map{ |v| _deserialize($1, v) } )
135
+ end
136
+ elsif !attributes[self.class.attribute_map[key]].nil?
137
+ self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
138
+ end # or else data not found in attributes(hash), not an issue as the data can be optional
139
+ end
140
+
141
+ self
142
+ end
143
+
144
+ # Deserializes the data based on type
145
+ # @param string type Data type
146
+ # @param string value Value to be deserialized
147
+ # @return [Object] Deserialized data
148
+ def _deserialize(type, value)
149
+ case type.to_sym
150
+ when :DateTime
151
+ DateTime.parse(value)
152
+ when :Date
153
+ Date.parse(value)
154
+ when :String
155
+ value.to_s
156
+ when :Integer
157
+ value.to_i
158
+ when :Float
159
+ value.to_f
160
+ when :BOOLEAN
161
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
162
+ true
163
+ else
164
+ false
165
+ end
166
+ when :Object
167
+ # generic object (usually a Hash), return directly
168
+ value
169
+ when /\AArray<(?<inner_type>.+)>\z/
170
+ inner_type = Regexp.last_match[:inner_type]
171
+ value.map { |v| _deserialize(inner_type, v) }
172
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
173
+ k_type = Regexp.last_match[:k_type]
174
+ v_type = Regexp.last_match[:v_type]
175
+ {}.tap do |hash|
176
+ value.each do |k, v|
177
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
178
+ end
179
+ end
180
+ else # model
181
+ temp_model = TelestreamCloud::Qc.const_get(type).new
182
+ temp_model.build_from_hash(value)
183
+ end
184
+ end
185
+
186
+ # Returns the string representation of the object
187
+ # @return [String] String presentation of the object
188
+ def to_s
189
+ to_hash.to_s
190
+ end
191
+
192
+ # to_body is an alias to to_hash (backward compatibility)
193
+ # @return [Hash] Returns the object in the form of hash
194
+ def to_body
195
+ to_hash
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 = self.send(attr)
204
+ next if value.nil?
205
+ hash[param] = _to_hash(value)
206
+ end
207
+ hash
208
+ end
209
+
210
+ # Outputs non-array value in the form of hash
211
+ # For object, use to_hash. Otherwise, just return the value
212
+ # @param [Object] value Any valid value
213
+ # @return [Hash] Returns the value in the form of hash
214
+ def _to_hash(value)
215
+ if value.is_a?(Array)
216
+ value.compact.map{ |v| _to_hash(v) }
217
+ elsif value.is_a?(Hash)
218
+ {}.tap do |hash|
219
+ value.each { |k, v| hash[k] = _to_hash(v) }
220
+ end
221
+ elsif value.respond_to? :to_hash
222
+ value.to_hash
223
+ else
224
+ value
225
+ end
226
+ end
227
+
228
+ end
229
+
230
+ end
@@ -0,0 +1,210 @@
1
+ =begin
2
+ #Qc API
3
+
4
+ #QC API
5
+
6
+ OpenAPI spec version: 2.0.0
7
+ Contact: cloudsupport@telestream.net
8
+ Generated by: https://github.com/swagger-api/swagger-codegen.git
9
+ Swagger Codegen version: 2.3.0
10
+
11
+ =end
12
+
13
+ require 'date'
14
+
15
+ module TelestreamCloud::Qc
16
+ # Description of the processed media file.
17
+ class Media
18
+ attr_accessor :audio
19
+
20
+ attr_accessor :video
21
+
22
+ attr_accessor :container
23
+
24
+
25
+ # Attribute mapping from ruby-style variable name to JSON key.
26
+ def self.attribute_map
27
+ {
28
+ :'audio' => :'audio',
29
+ :'video' => :'video',
30
+ :'container' => :'container'
31
+ }
32
+ end
33
+
34
+ # Attribute type mapping.
35
+ def self.swagger_types
36
+ {
37
+ :'audio' => :'Array<AudioStream>',
38
+ :'video' => :'Array<VideoStream>',
39
+ :'container' => :'Container'
40
+ }
41
+ end
42
+
43
+ # Initializes the object
44
+ # @param [Hash] attributes Model attributes in the form of hash
45
+ def initialize(attributes = {})
46
+ return unless attributes.is_a?(Hash)
47
+
48
+ # convert string to symbol for hash key
49
+ attributes = attributes.each_with_object({}){|(k,v), h| h[k.to_sym] = v}
50
+
51
+ if attributes.has_key?(:'audio')
52
+ if (value = attributes[:'audio']).is_a?(Array)
53
+ self.audio = value
54
+ end
55
+ end
56
+
57
+ if attributes.has_key?(:'video')
58
+ if (value = attributes[:'video']).is_a?(Array)
59
+ self.video = value
60
+ end
61
+ end
62
+
63
+ if attributes.has_key?(:'container')
64
+ self.container = attributes[:'container']
65
+ end
66
+
67
+ end
68
+
69
+ # Show invalid properties with the reasons. Usually used together with valid?
70
+ # @return Array for valid properties with the reasons
71
+ def list_invalid_properties
72
+ invalid_properties = Array.new
73
+ return 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 true
80
+ end
81
+
82
+ # Checks equality by comparing each attribute.
83
+ # @param [Object] Object to be compared
84
+ def ==(o)
85
+ return true if self.equal?(o)
86
+ self.class == o.class &&
87
+ audio == o.audio &&
88
+ video == o.video &&
89
+ container == o.container
90
+ end
91
+
92
+ # @see the `==` method
93
+ # @param [Object] Object to be compared
94
+ def eql?(o)
95
+ self == o
96
+ end
97
+
98
+ # Calculates hash code according to all attributes.
99
+ # @return [Fixnum] Hash code
100
+ def hash
101
+ [audio, video, container].hash
102
+ end
103
+
104
+ # Builds the object from hash
105
+ # @param [Hash] attributes Model attributes in the form of hash
106
+ # @return [Object] Returns the model itself
107
+ def build_from_hash(attributes)
108
+ return nil unless attributes.is_a?(Hash)
109
+ self.class.swagger_types.each_pair do |key, type|
110
+ if type =~ /\AArray<(.*)>/i
111
+ # check to ensure the input is an array given that the the attribute
112
+ # is documented as an array but the input is not
113
+ if attributes[self.class.attribute_map[key]].is_a?(Array)
114
+ self.send("#{key}=", attributes[self.class.attribute_map[key]].map{ |v| _deserialize($1, v) } )
115
+ end
116
+ elsif !attributes[self.class.attribute_map[key]].nil?
117
+ self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
118
+ end # or else data not found in attributes(hash), not an issue as the data can be optional
119
+ end
120
+
121
+ self
122
+ end
123
+
124
+ # Deserializes the data based on type
125
+ # @param string type Data type
126
+ # @param string value Value to be deserialized
127
+ # @return [Object] Deserialized data
128
+ def _deserialize(type, value)
129
+ case type.to_sym
130
+ when :DateTime
131
+ DateTime.parse(value)
132
+ when :Date
133
+ Date.parse(value)
134
+ when :String
135
+ value.to_s
136
+ when :Integer
137
+ value.to_i
138
+ when :Float
139
+ value.to_f
140
+ when :BOOLEAN
141
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
142
+ true
143
+ else
144
+ false
145
+ end
146
+ when :Object
147
+ # generic object (usually a Hash), return directly
148
+ value
149
+ when /\AArray<(?<inner_type>.+)>\z/
150
+ inner_type = Regexp.last_match[:inner_type]
151
+ value.map { |v| _deserialize(inner_type, v) }
152
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
153
+ k_type = Regexp.last_match[:k_type]
154
+ v_type = Regexp.last_match[:v_type]
155
+ {}.tap do |hash|
156
+ value.each do |k, v|
157
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
158
+ end
159
+ end
160
+ else # model
161
+ temp_model = TelestreamCloud::Qc.const_get(type).new
162
+ temp_model.build_from_hash(value)
163
+ end
164
+ end
165
+
166
+ # Returns the string representation of the object
167
+ # @return [String] String presentation of the object
168
+ def to_s
169
+ to_hash.to_s
170
+ end
171
+
172
+ # to_body is an alias to to_hash (backward compatibility)
173
+ # @return [Hash] Returns the object in the form of hash
174
+ def to_body
175
+ to_hash
176
+ end
177
+
178
+ # Returns the object in the form of hash
179
+ # @return [Hash] Returns the object in the form of hash
180
+ def to_hash
181
+ hash = {}
182
+ self.class.attribute_map.each_pair do |attr, param|
183
+ value = self.send(attr)
184
+ next if value.nil?
185
+ hash[param] = _to_hash(value)
186
+ end
187
+ hash
188
+ end
189
+
190
+ # Outputs non-array value in the form of hash
191
+ # For object, use to_hash. Otherwise, just return the value
192
+ # @param [Object] value Any valid value
193
+ # @return [Hash] Returns the value in the form of hash
194
+ def _to_hash(value)
195
+ if value.is_a?(Array)
196
+ value.compact.map{ |v| _to_hash(v) }
197
+ elsif value.is_a?(Hash)
198
+ {}.tap do |hash|
199
+ value.each { |k, v| hash[k] = _to_hash(v) }
200
+ end
201
+ elsif value.respond_to? :to_hash
202
+ value.to_hash
203
+ else
204
+ value
205
+ end
206
+ end
207
+
208
+ end
209
+
210
+ end