shotstack 0.0.10 → 0.1.3

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.
@@ -1,12 +1,12 @@
1
1
  =begin
2
- #shotstack
2
+ #Shotstack
3
3
 
4
- #The Shotstack API is a video editing service that allows for the programatic creation of videos using JSON.
4
+ #The Shotstack API is a video editing service that allows for the automated creation of videos using JSON. You can configure an edit and POST it to the Shotstack API which will render your video and provide a file location when complete. For more details check https://shotstack.io
5
5
 
6
- OpenAPI spec version: v1
6
+ The version of the OpenAPI document: v1
7
7
 
8
8
  Generated by: https://openapi-generator.tech
9
- OpenAPI Generator version: 4.0.0-beta3
9
+ OpenAPI Generator version: 4.2.1
10
10
 
11
11
  =end
12
12
 
@@ -14,8 +14,10 @@ require 'date'
14
14
 
15
15
  module Shotstack
16
16
  class RenderResponse
17
+ # `true` if status available, else `false`.
17
18
  attr_accessor :success
18
19
 
20
+ # `OK` or an error message.
19
21
  attr_accessor :message
20
22
 
21
23
  attr_accessor :response
@@ -38,6 +40,12 @@ module Shotstack
38
40
  }
39
41
  end
40
42
 
43
+ # List of attributes with nullable: true
44
+ def self.openapi_nullable
45
+ Set.new([
46
+ ])
47
+ end
48
+
41
49
  # Initializes the object
42
50
  # @param [Hash] attributes Model attributes in the form of hash
43
51
  def initialize(attributes = {})
@@ -202,7 +210,11 @@ module Shotstack
202
210
  hash = {}
203
211
  self.class.attribute_map.each_pair do |attr, param|
204
212
  value = self.send(attr)
205
- next if value.nil?
213
+ if value.nil?
214
+ is_nullable = self.class.openapi_nullable.include?(attr)
215
+ next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
216
+ end
217
+
206
218
  hash[param] = _to_hash(value)
207
219
  end
208
220
  hash
@@ -1,12 +1,12 @@
1
1
  =begin
2
- #shotstack
2
+ #Shotstack
3
3
 
4
- #The Shotstack API is a video editing service that allows for the programatic creation of videos using JSON.
4
+ #The Shotstack API is a video editing service that allows for the automated creation of videos using JSON. You can configure an edit and POST it to the Shotstack API which will render your video and provide a file location when complete. For more details check https://shotstack.io
5
5
 
6
- OpenAPI spec version: v1
6
+ The version of the OpenAPI document: v1
7
7
 
8
8
  Generated by: https://openapi-generator.tech
9
- OpenAPI Generator version: 4.0.0-beta3
9
+ OpenAPI Generator version: 4.2.1
10
10
 
11
11
  =end
12
12
 
@@ -14,21 +14,42 @@ require 'date'
14
14
 
15
15
  module Shotstack
16
16
  class RenderResponseData
17
- # The status of the render task
18
- attr_accessor :status
19
-
20
- # The id of the render task in UUID format
17
+ # The id of the render task in UUID format.
21
18
  attr_accessor :id
22
19
 
23
- # The owner id of the render task
20
+ # The owner id of the render task.
24
21
  attr_accessor :owner
25
22
 
23
+ # The customer subscription plan.
24
+ attr_accessor :plan
25
+
26
+ # The status of the render task. <ul> <li>`queued` - render is queued waiting to be rendered</li> <li>`fetching` - assets are being fetched</li> <li>`rendering` - the video is being rendered</li> <li>`saving` - the final video is being saved to storage</li> <li>`done` - the video is ready to be downloaded</li> <li>`failed` - there was an error rendering the video</li> </ul>
27
+ attr_accessor :status
28
+
29
+ # An error message, only displayed if an error occurred.
30
+ attr_accessor :error
31
+
32
+ # The output video length in seconds.
33
+ attr_accessor :duration
34
+
35
+ # The time taken to render the video in milliseconds.
36
+ attr_accessor :render_time
37
+
38
+ # The URL of the final video. This will only be available if status is done.
39
+ attr_accessor :url
40
+
41
+ # The URL of the poster image if requested. This will only be available if status is done.
42
+ attr_accessor :poster
43
+
44
+ # The URL of the thumbnail image if requested. This will only be available if status is done.
45
+ attr_accessor :thumbnail
46
+
26
47
  attr_accessor :data
27
48
 
28
- # The time the render task was initially queued
49
+ # The time the render task was initially queued.
29
50
  attr_accessor :created
30
51
 
31
- # The time the render status was last updated
52
+ # The time the render status was last updated.
32
53
  attr_accessor :updated
33
54
 
34
55
  class EnumAttributeValidator
@@ -56,9 +77,16 @@ module Shotstack
56
77
  # Attribute mapping from ruby-style variable name to JSON key.
57
78
  def self.attribute_map
58
79
  {
59
- :'status' => :'status',
60
80
  :'id' => :'id',
61
81
  :'owner' => :'owner',
82
+ :'plan' => :'plan',
83
+ :'status' => :'status',
84
+ :'error' => :'error',
85
+ :'duration' => :'duration',
86
+ :'render_time' => :'renderTime',
87
+ :'url' => :'url',
88
+ :'poster' => :'poster',
89
+ :'thumbnail' => :'thumbnail',
62
90
  :'data' => :'data',
63
91
  :'created' => :'created',
64
92
  :'updated' => :'updated'
@@ -68,15 +96,28 @@ module Shotstack
68
96
  # Attribute type mapping.
69
97
  def self.openapi_types
70
98
  {
71
- :'status' => :'String',
72
99
  :'id' => :'String',
73
100
  :'owner' => :'String',
101
+ :'plan' => :'String',
102
+ :'status' => :'String',
103
+ :'error' => :'String',
104
+ :'duration' => :'Float',
105
+ :'render_time' => :'Float',
106
+ :'url' => :'String',
107
+ :'poster' => :'String',
108
+ :'thumbnail' => :'String',
74
109
  :'data' => :'Edit',
75
110
  :'created' => :'String',
76
111
  :'updated' => :'String'
77
112
  }
78
113
  end
79
114
 
115
+ # List of attributes with nullable: true
116
+ def self.openapi_nullable
117
+ Set.new([
118
+ ])
119
+ end
120
+
80
121
  # Initializes the object
81
122
  # @param [Hash] attributes Model attributes in the form of hash
82
123
  def initialize(attributes = {})
@@ -92,10 +133,6 @@ module Shotstack
92
133
  h[k.to_sym] = v
93
134
  }
94
135
 
95
- if attributes.key?(:'status')
96
- self.status = attributes[:'status']
97
- end
98
-
99
136
  if attributes.key?(:'id')
100
137
  self.id = attributes[:'id']
101
138
  end
@@ -104,6 +141,38 @@ module Shotstack
104
141
  self.owner = attributes[:'owner']
105
142
  end
106
143
 
144
+ if attributes.key?(:'plan')
145
+ self.plan = attributes[:'plan']
146
+ end
147
+
148
+ if attributes.key?(:'status')
149
+ self.status = attributes[:'status']
150
+ end
151
+
152
+ if attributes.key?(:'error')
153
+ self.error = attributes[:'error']
154
+ end
155
+
156
+ if attributes.key?(:'duration')
157
+ self.duration = attributes[:'duration']
158
+ end
159
+
160
+ if attributes.key?(:'render_time')
161
+ self.render_time = attributes[:'render_time']
162
+ end
163
+
164
+ if attributes.key?(:'url')
165
+ self.url = attributes[:'url']
166
+ end
167
+
168
+ if attributes.key?(:'poster')
169
+ self.poster = attributes[:'poster']
170
+ end
171
+
172
+ if attributes.key?(:'thumbnail')
173
+ self.thumbnail = attributes[:'thumbnail']
174
+ end
175
+
107
176
  if attributes.key?(:'data')
108
177
  self.data = attributes[:'data']
109
178
  end
@@ -121,10 +190,6 @@ module Shotstack
121
190
  # @return Array for valid properties with the reasons
122
191
  def list_invalid_properties
123
192
  invalid_properties = Array.new
124
- if @status.nil?
125
- invalid_properties.push('invalid value for "status", status cannot be nil.')
126
- end
127
-
128
193
  if @id.nil?
129
194
  invalid_properties.push('invalid value for "id", id cannot be nil.')
130
195
  end
@@ -133,6 +198,10 @@ module Shotstack
133
198
  invalid_properties.push('invalid value for "owner", owner cannot be nil.')
134
199
  end
135
200
 
201
+ if @status.nil?
202
+ invalid_properties.push('invalid value for "status", status cannot be nil.')
203
+ end
204
+
136
205
  if @data.nil?
137
206
  invalid_properties.push('invalid value for "data", data cannot be nil.')
138
207
  end
@@ -151,11 +220,11 @@ module Shotstack
151
220
  # Check to see if the all the properties in the model are valid
152
221
  # @return true if the model is valid
153
222
  def valid?
223
+ return false if @id.nil?
224
+ return false if @owner.nil?
154
225
  return false if @status.nil?
155
226
  status_validator = EnumAttributeValidator.new('String', ["queued", "fetching", "rendering", "saving", "done", "failed"])
156
227
  return false unless status_validator.valid?(@status)
157
- return false if @id.nil?
158
- return false if @owner.nil?
159
228
  return false if @data.nil?
160
229
  return false if @created.nil?
161
230
  return false if @updated.nil?
@@ -177,9 +246,16 @@ module Shotstack
177
246
  def ==(o)
178
247
  return true if self.equal?(o)
179
248
  self.class == o.class &&
180
- status == o.status &&
181
249
  id == o.id &&
182
250
  owner == o.owner &&
251
+ plan == o.plan &&
252
+ status == o.status &&
253
+ error == o.error &&
254
+ duration == o.duration &&
255
+ render_time == o.render_time &&
256
+ url == o.url &&
257
+ poster == o.poster &&
258
+ thumbnail == o.thumbnail &&
183
259
  data == o.data &&
184
260
  created == o.created &&
185
261
  updated == o.updated
@@ -194,7 +270,7 @@ module Shotstack
194
270
  # Calculates hash code according to all attributes.
195
271
  # @return [Integer] Hash code
196
272
  def hash
197
- [status, id, owner, data, created, updated].hash
273
+ [id, owner, plan, status, error, duration, render_time, url, poster, thumbnail, data, created, updated].hash
198
274
  end
199
275
 
200
276
  # Builds the object from hash
@@ -283,7 +359,11 @@ module Shotstack
283
359
  hash = {}
284
360
  self.class.attribute_map.each_pair do |attr, param|
285
361
  value = self.send(attr)
286
- next if value.nil?
362
+ if value.nil?
363
+ is_nullable = self.class.openapi_nullable.include?(attr)
364
+ next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
365
+ end
366
+
287
367
  hash[param] = _to_hash(value)
288
368
  end
289
369
  hash
@@ -1,31 +1,57 @@
1
1
  =begin
2
- #shotstack
2
+ #Shotstack
3
3
 
4
- #The Shotstack API is a video editing service that allows for the programatic creation of videos using JSON.
4
+ #The Shotstack API is a video editing service that allows for the automated creation of videos using JSON. You can configure an edit and POST it to the Shotstack API which will render your video and provide a file location when complete. For more details check https://shotstack.io
5
5
 
6
- OpenAPI spec version: v1
6
+ The version of the OpenAPI document: v1
7
7
 
8
8
  Generated by: https://openapi-generator.tech
9
- OpenAPI Generator version: 4.0.0-beta3
9
+ OpenAPI Generator version: 4.2.1
10
10
 
11
11
  =end
12
12
 
13
13
  require 'date'
14
14
 
15
15
  module Shotstack
16
- # A music or audio file in mp3 format that plays for the duration of the rendered video or the length of the audio file, which ever is shortest.
16
+ # A music or audio file in mp3 format that plays for the duration of the rendered video or the length of the audio file, which ever is shortest.
17
17
  class Soundtrack
18
- # The URL of the mp3 audio file. The URL must be publicly accessible or include credentials.
18
+ # The URL of the mp3 audio file. The URL must be publicly accessible or include credentials.
19
19
  attr_accessor :src
20
20
 
21
- # The effect to apply to the audio file
21
+ # The effect to apply to the audio file <ul> <li>`fadeIn` - fade volume in only</li> <li>`fadeOut` - fade volume out only</li> <li>`fadeInFadeOut` - fade volume in and out</li> </ul>
22
22
  attr_accessor :effect
23
23
 
24
+ # Set the volume for the soundtrack between 0 and 1 where 0 is muted and 1 is full volume (defaults to 1).
25
+ attr_accessor :volume
26
+
27
+ class EnumAttributeValidator
28
+ attr_reader :datatype
29
+ attr_reader :allowable_values
30
+
31
+ def initialize(datatype, allowable_values)
32
+ @allowable_values = allowable_values.map do |value|
33
+ case datatype.to_s
34
+ when /Integer/i
35
+ value.to_i
36
+ when /Float/i
37
+ value.to_f
38
+ else
39
+ value
40
+ end
41
+ end
42
+ end
43
+
44
+ def valid?(value)
45
+ !value || allowable_values.include?(value)
46
+ end
47
+ end
48
+
24
49
  # Attribute mapping from ruby-style variable name to JSON key.
25
50
  def self.attribute_map
26
51
  {
27
52
  :'src' => :'src',
28
- :'effect' => :'effect'
53
+ :'effect' => :'effect',
54
+ :'volume' => :'volume'
29
55
  }
30
56
  end
31
57
 
@@ -33,10 +59,17 @@ module Shotstack
33
59
  def self.openapi_types
34
60
  {
35
61
  :'src' => :'String',
36
- :'effect' => :'String'
62
+ :'effect' => :'String',
63
+ :'volume' => :'Float'
37
64
  }
38
65
  end
39
66
 
67
+ # List of attributes with nullable: true
68
+ def self.openapi_nullable
69
+ Set.new([
70
+ ])
71
+ end
72
+
40
73
  # Initializes the object
41
74
  # @param [Hash] attributes Model attributes in the form of hash
42
75
  def initialize(attributes = {})
@@ -59,6 +92,12 @@ module Shotstack
59
92
  if attributes.key?(:'effect')
60
93
  self.effect = attributes[:'effect']
61
94
  end
95
+
96
+ if attributes.key?(:'volume')
97
+ self.volume = attributes[:'volume']
98
+ else
99
+ self.volume = 1
100
+ end
62
101
  end
63
102
 
64
103
  # Show invalid properties with the reasons. Usually used together with valid?
@@ -69,10 +108,6 @@ module Shotstack
69
108
  invalid_properties.push('invalid value for "src", src cannot be nil.')
70
109
  end
71
110
 
72
- if @effect.nil?
73
- invalid_properties.push('invalid value for "effect", effect cannot be nil.')
74
- end
75
-
76
111
  invalid_properties
77
112
  end
78
113
 
@@ -80,17 +115,29 @@ module Shotstack
80
115
  # @return true if the model is valid
81
116
  def valid?
82
117
  return false if @src.nil?
83
- return false if @effect.nil?
118
+ effect_validator = EnumAttributeValidator.new('String', ["fadeIn", "fadeOut", "fadeInFadeOut"])
119
+ return false unless effect_validator.valid?(@effect)
84
120
  true
85
121
  end
86
122
 
123
+ # Custom attribute writer method checking allowed values (enum).
124
+ # @param [Object] effect Object to be assigned
125
+ def effect=(effect)
126
+ validator = EnumAttributeValidator.new('String', ["fadeIn", "fadeOut", "fadeInFadeOut"])
127
+ unless validator.valid?(effect)
128
+ fail ArgumentError, "invalid value for \"effect\", must be one of #{validator.allowable_values}."
129
+ end
130
+ @effect = effect
131
+ end
132
+
87
133
  # Checks equality by comparing each attribute.
88
134
  # @param [Object] Object to be compared
89
135
  def ==(o)
90
136
  return true if self.equal?(o)
91
137
  self.class == o.class &&
92
138
  src == o.src &&
93
- effect == o.effect
139
+ effect == o.effect &&
140
+ volume == o.volume
94
141
  end
95
142
 
96
143
  # @see the `==` method
@@ -102,7 +149,7 @@ module Shotstack
102
149
  # Calculates hash code according to all attributes.
103
150
  # @return [Integer] Hash code
104
151
  def hash
105
- [src, effect].hash
152
+ [src, effect, volume].hash
106
153
  end
107
154
 
108
155
  # Builds the object from hash
@@ -191,7 +238,11 @@ module Shotstack
191
238
  hash = {}
192
239
  self.class.attribute_map.each_pair do |attr, param|
193
240
  value = self.send(attr)
194
- next if value.nil?
241
+ if value.nil?
242
+ is_nullable = self.class.openapi_nullable.include?(attr)
243
+ next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
244
+ end
245
+
195
246
  hash[param] = _to_hash(value)
196
247
  end
197
248
  hash
@@ -0,0 +1,228 @@
1
+ =begin
2
+ #Shotstack
3
+
4
+ #The Shotstack API is a video editing service that allows for the automated creation of videos using JSON. You can configure an edit and POST it to the Shotstack API which will render your video and provide a file location when complete. For more details check https://shotstack.io
5
+
6
+ The version of the OpenAPI document: v1
7
+
8
+ Generated by: https://openapi-generator.tech
9
+ OpenAPI Generator version: 4.2.1
10
+
11
+ =end
12
+
13
+ require 'date'
14
+
15
+ module Shotstack
16
+ # Generate a thumbnail image for the video at a specific point from the timeline.
17
+ class Thumbnail
18
+ # The point on the timeline in seconds to capture a single frame to use as the thumbnail image.
19
+ attr_accessor :capture
20
+
21
+ # Scale the thumbnail size to a fraction of the viewport size - i.e. setting the scale to 0.5 will scale the thumbnail to half the size of the viewport.
22
+ attr_accessor :scale
23
+
24
+ # Attribute mapping from ruby-style variable name to JSON key.
25
+ def self.attribute_map
26
+ {
27
+ :'capture' => :'capture',
28
+ :'scale' => :'scale'
29
+ }
30
+ end
31
+
32
+ # Attribute type mapping.
33
+ def self.openapi_types
34
+ {
35
+ :'capture' => :'Float',
36
+ :'scale' => :'Float'
37
+ }
38
+ end
39
+
40
+ # List of attributes with nullable: true
41
+ def self.openapi_nullable
42
+ Set.new([
43
+ ])
44
+ end
45
+
46
+ # Initializes the object
47
+ # @param [Hash] attributes Model attributes in the form of hash
48
+ def initialize(attributes = {})
49
+ if (!attributes.is_a?(Hash))
50
+ fail ArgumentError, "The input argument (attributes) must be a hash in `Shotstack::Thumbnail` initialize method"
51
+ end
52
+
53
+ # check to see if the attribute exists and convert string to symbol for hash key
54
+ attributes = attributes.each_with_object({}) { |(k, v), h|
55
+ if (!self.class.attribute_map.key?(k.to_sym))
56
+ fail ArgumentError, "`#{k}` is not a valid attribute in `Shotstack::Thumbnail`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
57
+ end
58
+ h[k.to_sym] = v
59
+ }
60
+
61
+ if attributes.key?(:'capture')
62
+ self.capture = attributes[:'capture']
63
+ end
64
+
65
+ if attributes.key?(:'scale')
66
+ self.scale = attributes[:'scale']
67
+ end
68
+ end
69
+
70
+ # Show invalid properties with the reasons. Usually used together with valid?
71
+ # @return Array for valid properties with the reasons
72
+ def list_invalid_properties
73
+ invalid_properties = Array.new
74
+ if @capture.nil?
75
+ invalid_properties.push('invalid value for "capture", capture cannot be nil.')
76
+ end
77
+
78
+ if @scale.nil?
79
+ invalid_properties.push('invalid value for "scale", scale cannot be nil.')
80
+ end
81
+
82
+ invalid_properties
83
+ end
84
+
85
+ # Check to see if the all the properties in the model are valid
86
+ # @return true if the model is valid
87
+ def valid?
88
+ return false if @capture.nil?
89
+ return false if @scale.nil?
90
+ true
91
+ end
92
+
93
+ # Checks equality by comparing each attribute.
94
+ # @param [Object] Object to be compared
95
+ def ==(o)
96
+ return true if self.equal?(o)
97
+ self.class == o.class &&
98
+ capture == o.capture &&
99
+ scale == o.scale
100
+ end
101
+
102
+ # @see the `==` method
103
+ # @param [Object] Object to be compared
104
+ def eql?(o)
105
+ self == o
106
+ end
107
+
108
+ # Calculates hash code according to all attributes.
109
+ # @return [Integer] Hash code
110
+ def hash
111
+ [capture, scale].hash
112
+ end
113
+
114
+ # Builds the object from hash
115
+ # @param [Hash] attributes Model attributes in the form of hash
116
+ # @return [Object] Returns the model itself
117
+ def self.build_from_hash(attributes)
118
+ new.build_from_hash(attributes)
119
+ end
120
+
121
+ # Builds the object from hash
122
+ # @param [Hash] attributes Model attributes in the form of hash
123
+ # @return [Object] Returns the model itself
124
+ def build_from_hash(attributes)
125
+ return nil unless attributes.is_a?(Hash)
126
+ self.class.openapi_types.each_pair do |key, type|
127
+ if type =~ /\AArray<(.*)>/i
128
+ # check to ensure the input is an array given that the attribute
129
+ # is documented as an array but the input is not
130
+ if attributes[self.class.attribute_map[key]].is_a?(Array)
131
+ self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
132
+ end
133
+ elsif !attributes[self.class.attribute_map[key]].nil?
134
+ self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
135
+ end # or else data not found in attributes(hash), not an issue as the data can be optional
136
+ end
137
+
138
+ self
139
+ end
140
+
141
+ # Deserializes the data based on type
142
+ # @param string type Data type
143
+ # @param string value Value to be deserialized
144
+ # @return [Object] Deserialized data
145
+ def _deserialize(type, value)
146
+ case type.to_sym
147
+ when :DateTime
148
+ DateTime.parse(value)
149
+ when :Date
150
+ Date.parse(value)
151
+ when :String
152
+ value.to_s
153
+ when :Integer
154
+ value.to_i
155
+ when :Float
156
+ value.to_f
157
+ when :Boolean
158
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
159
+ true
160
+ else
161
+ false
162
+ end
163
+ when :Object
164
+ # generic object (usually a Hash), return directly
165
+ value
166
+ when /\AArray<(?<inner_type>.+)>\z/
167
+ inner_type = Regexp.last_match[:inner_type]
168
+ value.map { |v| _deserialize(inner_type, v) }
169
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
170
+ k_type = Regexp.last_match[:k_type]
171
+ v_type = Regexp.last_match[:v_type]
172
+ {}.tap do |hash|
173
+ value.each do |k, v|
174
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
175
+ end
176
+ end
177
+ else # model
178
+ Shotstack.const_get(type).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
+ # Returns the object in the form of hash
195
+ # @return [Hash] Returns the object in the form of hash
196
+ def to_hash
197
+ hash = {}
198
+ self.class.attribute_map.each_pair do |attr, param|
199
+ value = self.send(attr)
200
+ if value.nil?
201
+ is_nullable = self.class.openapi_nullable.include?(attr)
202
+ next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
203
+ end
204
+
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
+ end
228
+ end