shotstack 0.0.11 → 0.1.4

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.
@@ -0,0 +1,270 @@
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
+ # Offsets the position of an asset horizontally or vertically by a relative distance.
17
+ class Offset
18
+ # Offset an asset on the horizontal axis (left or right), range varies from -1 to 1. Positive numbers move the asset right, negative left. For all assets except titles the distance moved is relative to the width of the viewport - i.e. an X offset of 0.5 will move the asset half the screen width to the right.
19
+ attr_accessor :x
20
+
21
+ # Offset an asset on the vertical axis (up or down), range varies from -1 to 1. Positive numbers move the asset up, negative down. For all assets except titles the distance moved is relative to the height of the viewport - i.e. an Y offset of 0.5 will move the asset up half the screen height.
22
+ attr_accessor :y
23
+
24
+ # Attribute mapping from ruby-style variable name to JSON key.
25
+ def self.attribute_map
26
+ {
27
+ :'x' => :'x',
28
+ :'y' => :'y'
29
+ }
30
+ end
31
+
32
+ # Attribute type mapping.
33
+ def self.openapi_types
34
+ {
35
+ :'x' => :'Float',
36
+ :'y' => :'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::Offset` 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::Offset`. 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?(:'x')
62
+ self.x = attributes[:'x']
63
+ else
64
+ self.x = 0
65
+ end
66
+
67
+ if attributes.key?(:'y')
68
+ self.y = attributes[:'y']
69
+ else
70
+ self.y = 0
71
+ end
72
+ end
73
+
74
+ # Show invalid properties with the reasons. Usually used together with valid?
75
+ # @return Array for valid properties with the reasons
76
+ def list_invalid_properties
77
+ invalid_properties = Array.new
78
+ if !@x.nil? && @x > 1
79
+ invalid_properties.push('invalid value for "x", must be smaller than or equal to 1.')
80
+ end
81
+
82
+ if !@x.nil? && @x < -1
83
+ invalid_properties.push('invalid value for "x", must be greater than or equal to -1.')
84
+ end
85
+
86
+ if !@y.nil? && @y > 1
87
+ invalid_properties.push('invalid value for "y", must be smaller than or equal to 1.')
88
+ end
89
+
90
+ if !@y.nil? && @y < -1
91
+ invalid_properties.push('invalid value for "y", must be greater than or equal to -1.')
92
+ end
93
+
94
+ invalid_properties
95
+ end
96
+
97
+ # Check to see if the all the properties in the model are valid
98
+ # @return true if the model is valid
99
+ def valid?
100
+ return false if !@x.nil? && @x > 1
101
+ return false if !@x.nil? && @x < -1
102
+ return false if !@y.nil? && @y > 1
103
+ return false if !@y.nil? && @y < -1
104
+ true
105
+ end
106
+
107
+ # Custom attribute writer method with validation
108
+ # @param [Object] x Value to be assigned
109
+ def x=(x)
110
+ if !x.nil? && x > 1
111
+ fail ArgumentError, 'invalid value for "x", must be smaller than or equal to 1.'
112
+ end
113
+
114
+ if !x.nil? && x < -1
115
+ fail ArgumentError, 'invalid value for "x", must be greater than or equal to -1.'
116
+ end
117
+
118
+ @x = x
119
+ end
120
+
121
+ # Custom attribute writer method with validation
122
+ # @param [Object] y Value to be assigned
123
+ def y=(y)
124
+ if !y.nil? && y > 1
125
+ fail ArgumentError, 'invalid value for "y", must be smaller than or equal to 1.'
126
+ end
127
+
128
+ if !y.nil? && y < -1
129
+ fail ArgumentError, 'invalid value for "y", must be greater than or equal to -1.'
130
+ end
131
+
132
+ @y = y
133
+ end
134
+
135
+ # Checks equality by comparing each attribute.
136
+ # @param [Object] Object to be compared
137
+ def ==(o)
138
+ return true if self.equal?(o)
139
+ self.class == o.class &&
140
+ x == o.x &&
141
+ y == o.y
142
+ end
143
+
144
+ # @see the `==` method
145
+ # @param [Object] Object to be compared
146
+ def eql?(o)
147
+ self == o
148
+ end
149
+
150
+ # Calculates hash code according to all attributes.
151
+ # @return [Integer] Hash code
152
+ def hash
153
+ [x, y].hash
154
+ end
155
+
156
+ # Builds the object from hash
157
+ # @param [Hash] attributes Model attributes in the form of hash
158
+ # @return [Object] Returns the model itself
159
+ def self.build_from_hash(attributes)
160
+ new.build_from_hash(attributes)
161
+ end
162
+
163
+ # Builds the object from hash
164
+ # @param [Hash] attributes Model attributes in the form of hash
165
+ # @return [Object] Returns the model itself
166
+ def build_from_hash(attributes)
167
+ return nil unless attributes.is_a?(Hash)
168
+ self.class.openapi_types.each_pair do |key, type|
169
+ if type =~ /\AArray<(.*)>/i
170
+ # check to ensure the input is an array given that the attribute
171
+ # is documented as an array but the input is not
172
+ if attributes[self.class.attribute_map[key]].is_a?(Array)
173
+ self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
174
+ end
175
+ elsif !attributes[self.class.attribute_map[key]].nil?
176
+ self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
177
+ end # or else data not found in attributes(hash), not an issue as the data can be optional
178
+ end
179
+
180
+ self
181
+ end
182
+
183
+ # Deserializes the data based on type
184
+ # @param string type Data type
185
+ # @param string value Value to be deserialized
186
+ # @return [Object] Deserialized data
187
+ def _deserialize(type, value)
188
+ case type.to_sym
189
+ when :DateTime
190
+ DateTime.parse(value)
191
+ when :Date
192
+ Date.parse(value)
193
+ when :String
194
+ value.to_s
195
+ when :Integer
196
+ value.to_i
197
+ when :Float
198
+ value.to_f
199
+ when :Boolean
200
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
201
+ true
202
+ else
203
+ false
204
+ end
205
+ when :Object
206
+ # generic object (usually a Hash), return directly
207
+ value
208
+ when /\AArray<(?<inner_type>.+)>\z/
209
+ inner_type = Regexp.last_match[:inner_type]
210
+ value.map { |v| _deserialize(inner_type, v) }
211
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
212
+ k_type = Regexp.last_match[:k_type]
213
+ v_type = Regexp.last_match[:v_type]
214
+ {}.tap do |hash|
215
+ value.each do |k, v|
216
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
217
+ end
218
+ end
219
+ else # model
220
+ Shotstack.const_get(type).build_from_hash(value)
221
+ end
222
+ end
223
+
224
+ # Returns the string representation of the object
225
+ # @return [String] String presentation of the object
226
+ def to_s
227
+ to_hash.to_s
228
+ end
229
+
230
+ # to_body is an alias to to_hash (backward compatibility)
231
+ # @return [Hash] Returns the object in the form of hash
232
+ def to_body
233
+ to_hash
234
+ end
235
+
236
+ # Returns the object in the form of hash
237
+ # @return [Hash] Returns the object in the form of hash
238
+ def to_hash
239
+ hash = {}
240
+ self.class.attribute_map.each_pair do |attr, param|
241
+ value = self.send(attr)
242
+ if value.nil?
243
+ is_nullable = self.class.openapi_nullable.include?(attr)
244
+ next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
245
+ end
246
+
247
+ hash[param] = _to_hash(value)
248
+ end
249
+ hash
250
+ end
251
+
252
+ # Outputs non-array value in the form of hash
253
+ # For object, use to_hash. Otherwise, just return the value
254
+ # @param [Object] value Any valid value
255
+ # @return [Hash] Returns the value in the form of hash
256
+ def _to_hash(value)
257
+ if value.is_a?(Array)
258
+ value.compact.map { |v| _to_hash(v) }
259
+ elsif value.is_a?(Hash)
260
+ {}.tap do |hash|
261
+ value.each { |k, v| hash[k] = _to_hash(v) }
262
+ end
263
+ elsif value.respond_to? :to_hash
264
+ value.to_hash
265
+ else
266
+ value
267
+ end
268
+ end
269
+ end
270
+ end
@@ -1,24 +1,36 @@
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
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
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
- # The video output format
16
+ # The video output format.
17
17
  class Output
18
+ # `mp4` video or animated `gif`
18
19
  attr_accessor :format
19
20
 
21
+ # The output resolution of the video. <ul> <li>`preview` - 512px x 288px @ 15fps</li> <li>`mobile` - 640px x 360px @ 25fps</li> <li>`sd` - 1024px x 576px @ 25fps</li> <li>`hd` - 1280px x 720px @ 25fps</li> <li>`1080` - 1920px x 1080px @ 25fps</li> </ul>
20
22
  attr_accessor :resolution
21
23
 
24
+ # The aspect ratio (shape) of the video. Useful for social media sites. Options are: <ul> <li>`16:9` - regular landscape/horizontal aspect ratio (default)</li> <li>`9:16` - vertical/portrait aspect ratio.</li> <li>`1:1` - square aspect ratio.</li> </ul>
25
+ attr_accessor :aspect_ratio
26
+
27
+ # Override the resolution and scale the video to render at a different size. When using scaleTo the video should be edited at the resolution dimensions, i.e. use font sizes that look best at HD, then use scaleTo to output the video at SD and the text will be scaled to the correct size. This is useful if you want to create multiple video sizes. <ul> <li>`preview` - 512px x 288px @ 15fps</li> <li>`mobile` - 640px x 360px @ 25fps</li> <li>`sd` - 1024px x 576px @25fps</li> <li>`hd` - 1280px x 720px @25fps</li> <li>`1080` - 1920px x 1080px @25fps</li> </ul>
28
+ attr_accessor :scale_to
29
+
30
+ attr_accessor :poster
31
+
32
+ attr_accessor :thumbnail
33
+
22
34
  class EnumAttributeValidator
23
35
  attr_reader :datatype
24
36
  attr_reader :allowable_values
@@ -45,7 +57,11 @@ module Shotstack
45
57
  def self.attribute_map
46
58
  {
47
59
  :'format' => :'format',
48
- :'resolution' => :'resolution'
60
+ :'resolution' => :'resolution',
61
+ :'aspect_ratio' => :'aspectRatio',
62
+ :'scale_to' => :'scaleTo',
63
+ :'poster' => :'poster',
64
+ :'thumbnail' => :'thumbnail'
49
65
  }
50
66
  end
51
67
 
@@ -53,10 +69,20 @@ module Shotstack
53
69
  def self.openapi_types
54
70
  {
55
71
  :'format' => :'String',
56
- :'resolution' => :'String'
72
+ :'resolution' => :'String',
73
+ :'aspect_ratio' => :'String',
74
+ :'scale_to' => :'String',
75
+ :'poster' => :'Poster',
76
+ :'thumbnail' => :'Thumbnail'
57
77
  }
58
78
  end
59
79
 
80
+ # List of attributes with nullable: true
81
+ def self.openapi_nullable
82
+ Set.new([
83
+ ])
84
+ end
85
+
60
86
  # Initializes the object
61
87
  # @param [Hash] attributes Model attributes in the form of hash
62
88
  def initialize(attributes = {})
@@ -79,6 +105,22 @@ module Shotstack
79
105
  if attributes.key?(:'resolution')
80
106
  self.resolution = attributes[:'resolution']
81
107
  end
108
+
109
+ if attributes.key?(:'aspect_ratio')
110
+ self.aspect_ratio = attributes[:'aspect_ratio']
111
+ end
112
+
113
+ if attributes.key?(:'scale_to')
114
+ self.scale_to = attributes[:'scale_to']
115
+ end
116
+
117
+ if attributes.key?(:'poster')
118
+ self.poster = attributes[:'poster']
119
+ end
120
+
121
+ if attributes.key?(:'thumbnail')
122
+ self.thumbnail = attributes[:'thumbnail']
123
+ end
82
124
  end
83
125
 
84
126
  # Show invalid properties with the reasons. Usually used together with valid?
@@ -105,6 +147,10 @@ module Shotstack
105
147
  return false if @resolution.nil?
106
148
  resolution_validator = EnumAttributeValidator.new('String', ["preview", "mobile", "sd", "hd", "1080"])
107
149
  return false unless resolution_validator.valid?(@resolution)
150
+ aspect_ratio_validator = EnumAttributeValidator.new('String', ["16:9", "9:16", "1:1"])
151
+ return false unless aspect_ratio_validator.valid?(@aspect_ratio)
152
+ scale_to_validator = EnumAttributeValidator.new('String', ["preview", "mobile", "sd", "hd", "1080"])
153
+ return false unless scale_to_validator.valid?(@scale_to)
108
154
  true
109
155
  end
110
156
 
@@ -128,13 +174,37 @@ module Shotstack
128
174
  @resolution = resolution
129
175
  end
130
176
 
177
+ # Custom attribute writer method checking allowed values (enum).
178
+ # @param [Object] aspect_ratio Object to be assigned
179
+ def aspect_ratio=(aspect_ratio)
180
+ validator = EnumAttributeValidator.new('String', ["16:9", "9:16", "1:1"])
181
+ unless validator.valid?(aspect_ratio)
182
+ fail ArgumentError, "invalid value for \"aspect_ratio\", must be one of #{validator.allowable_values}."
183
+ end
184
+ @aspect_ratio = aspect_ratio
185
+ end
186
+
187
+ # Custom attribute writer method checking allowed values (enum).
188
+ # @param [Object] scale_to Object to be assigned
189
+ def scale_to=(scale_to)
190
+ validator = EnumAttributeValidator.new('String', ["preview", "mobile", "sd", "hd", "1080"])
191
+ unless validator.valid?(scale_to)
192
+ fail ArgumentError, "invalid value for \"scale_to\", must be one of #{validator.allowable_values}."
193
+ end
194
+ @scale_to = scale_to
195
+ end
196
+
131
197
  # Checks equality by comparing each attribute.
132
198
  # @param [Object] Object to be compared
133
199
  def ==(o)
134
200
  return true if self.equal?(o)
135
201
  self.class == o.class &&
136
202
  format == o.format &&
137
- resolution == o.resolution
203
+ resolution == o.resolution &&
204
+ aspect_ratio == o.aspect_ratio &&
205
+ scale_to == o.scale_to &&
206
+ poster == o.poster &&
207
+ thumbnail == o.thumbnail
138
208
  end
139
209
 
140
210
  # @see the `==` method
@@ -146,7 +216,7 @@ module Shotstack
146
216
  # Calculates hash code according to all attributes.
147
217
  # @return [Integer] Hash code
148
218
  def hash
149
- [format, resolution].hash
219
+ [format, resolution, aspect_ratio, scale_to, poster, thumbnail].hash
150
220
  end
151
221
 
152
222
  # Builds the object from hash
@@ -235,7 +305,11 @@ module Shotstack
235
305
  hash = {}
236
306
  self.class.attribute_map.each_pair do |attr, param|
237
307
  value = self.send(attr)
238
- next if value.nil?
308
+ if value.nil?
309
+ is_nullable = self.class.openapi_nullable.include?(attr)
310
+ next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
311
+ end
312
+
239
313
  hash[param] = _to_hash(value)
240
314
  end
241
315
  hash
@@ -0,0 +1,213 @@
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 poster image for the video at a specific point from the timeline. The poster image size will match the size of the output video.
17
+ class Poster
18
+ # The point on the timeline in seconds to capture a single frame to use as the poster image.
19
+ attr_accessor :capture
20
+
21
+ # Attribute mapping from ruby-style variable name to JSON key.
22
+ def self.attribute_map
23
+ {
24
+ :'capture' => :'capture'
25
+ }
26
+ end
27
+
28
+ # Attribute type mapping.
29
+ def self.openapi_types
30
+ {
31
+ :'capture' => :'Float'
32
+ }
33
+ end
34
+
35
+ # List of attributes with nullable: true
36
+ def self.openapi_nullable
37
+ Set.new([
38
+ ])
39
+ end
40
+
41
+ # Initializes the object
42
+ # @param [Hash] attributes Model attributes in the form of hash
43
+ def initialize(attributes = {})
44
+ if (!attributes.is_a?(Hash))
45
+ fail ArgumentError, "The input argument (attributes) must be a hash in `Shotstack::Poster` initialize method"
46
+ end
47
+
48
+ # check to see if the attribute exists and convert string to symbol for hash key
49
+ attributes = attributes.each_with_object({}) { |(k, v), h|
50
+ if (!self.class.attribute_map.key?(k.to_sym))
51
+ fail ArgumentError, "`#{k}` is not a valid attribute in `Shotstack::Poster`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
52
+ end
53
+ h[k.to_sym] = v
54
+ }
55
+
56
+ if attributes.key?(:'capture')
57
+ self.capture = attributes[:'capture']
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 @capture.nil?
66
+ invalid_properties.push('invalid value for "capture", capture cannot be nil.')
67
+ end
68
+
69
+ invalid_properties
70
+ end
71
+
72
+ # Check to see if the all the properties in the model are valid
73
+ # @return true if the model is valid
74
+ def valid?
75
+ return false if @capture.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
+ capture == o.capture
85
+ end
86
+
87
+ # @see the `==` method
88
+ # @param [Object] Object to be compared
89
+ def eql?(o)
90
+ self == o
91
+ end
92
+
93
+ # Calculates hash code according to all attributes.
94
+ # @return [Integer] Hash code
95
+ def hash
96
+ [capture].hash
97
+ end
98
+
99
+ # Builds the object from hash
100
+ # @param [Hash] attributes Model attributes in the form of hash
101
+ # @return [Object] Returns the model itself
102
+ def self.build_from_hash(attributes)
103
+ new.build_from_hash(attributes)
104
+ end
105
+
106
+ # Builds the object from hash
107
+ # @param [Hash] attributes Model attributes in the form of hash
108
+ # @return [Object] Returns the model itself
109
+ def build_from_hash(attributes)
110
+ return nil unless attributes.is_a?(Hash)
111
+ self.class.openapi_types.each_pair do |key, type|
112
+ if type =~ /\AArray<(.*)>/i
113
+ # check to ensure the input is an array given that the attribute
114
+ # is documented as an array but the input is not
115
+ if attributes[self.class.attribute_map[key]].is_a?(Array)
116
+ self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
117
+ end
118
+ elsif !attributes[self.class.attribute_map[key]].nil?
119
+ self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
120
+ end # or else data not found in attributes(hash), not an issue as the data can be optional
121
+ end
122
+
123
+ self
124
+ end
125
+
126
+ # Deserializes the data based on type
127
+ # @param string type Data type
128
+ # @param string value Value to be deserialized
129
+ # @return [Object] Deserialized data
130
+ def _deserialize(type, value)
131
+ case type.to_sym
132
+ when :DateTime
133
+ DateTime.parse(value)
134
+ when :Date
135
+ Date.parse(value)
136
+ when :String
137
+ value.to_s
138
+ when :Integer
139
+ value.to_i
140
+ when :Float
141
+ value.to_f
142
+ when :Boolean
143
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
144
+ true
145
+ else
146
+ false
147
+ end
148
+ when :Object
149
+ # generic object (usually a Hash), return directly
150
+ value
151
+ when /\AArray<(?<inner_type>.+)>\z/
152
+ inner_type = Regexp.last_match[:inner_type]
153
+ value.map { |v| _deserialize(inner_type, v) }
154
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
155
+ k_type = Regexp.last_match[:k_type]
156
+ v_type = Regexp.last_match[:v_type]
157
+ {}.tap do |hash|
158
+ value.each do |k, v|
159
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
160
+ end
161
+ end
162
+ else # model
163
+ Shotstack.const_get(type).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
+ if value.nil?
186
+ is_nullable = self.class.openapi_nullable.include?(attr)
187
+ next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
188
+ end
189
+
190
+ hash[param] = _to_hash(value)
191
+ end
192
+ hash
193
+ end
194
+
195
+ # Outputs non-array value in the form of hash
196
+ # For object, use to_hash. Otherwise, just return the value
197
+ # @param [Object] value Any valid value
198
+ # @return [Hash] Returns the value in the form of hash
199
+ def _to_hash(value)
200
+ if value.is_a?(Array)
201
+ value.compact.map { |v| _to_hash(v) }
202
+ elsif value.is_a?(Hash)
203
+ {}.tap do |hash|
204
+ value.each { |k, v| hash[k] = _to_hash(v) }
205
+ end
206
+ elsif value.respond_to? :to_hash
207
+ value.to_hash
208
+ else
209
+ value
210
+ end
211
+ end
212
+ end
213
+ end