shotstack 0.0.9 → 0.0.10
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +5 -5
- data/README.md +17 -0
- data/lib/shotstack.rb +24 -15
- data/lib/shotstack/api/default_api.rb +131 -0
- data/lib/shotstack/api_client.rb +120 -51
- data/lib/shotstack/api_error.rb +38 -5
- data/lib/shotstack/configuration.rb +90 -3
- data/lib/shotstack/models/asset.rb +17 -0
- data/lib/shotstack/models/clip.rb +308 -0
- data/lib/shotstack/models/edit.rb +104 -45
- data/lib/shotstack/models/image_asset.rb +221 -0
- data/lib/shotstack/models/output.rb +128 -41
- data/lib/shotstack/models/queued_response.rb +110 -48
- data/lib/shotstack/models/queued_response_data.rb +105 -45
- data/lib/shotstack/models/render_response.rb +110 -48
- data/lib/shotstack/models/render_response_data.rb +172 -68
- data/lib/shotstack/models/soundtrack.rb +106 -45
- data/lib/shotstack/models/timeline.rb +101 -46
- data/lib/shotstack/models/title_asset.rb +265 -0
- data/lib/shotstack/models/track.rb +89 -33
- data/lib/shotstack/models/transition.rb +121 -42
- data/lib/shotstack/models/video_asset.rb +241 -0
- data/lib/shotstack/version.rb +13 -1
- data/shotstack.gemspec +26 -13
- metadata +38 -40
- data/lib/shotstack/api/render_api.rb +0 -137
- data/lib/shotstack/models/clips.rb +0 -147
- data/lib/shotstack/models/image_clip.rb +0 -216
- data/lib/shotstack/models/image_clip_options.rb +0 -175
- data/lib/shotstack/models/title_clip.rb +0 -216
- data/lib/shotstack/models/title_clip_options.rb +0 -194
- data/lib/shotstack/models/video_clip.rb +0 -216
- data/lib/shotstack/models/video_clip_options.rb +0 -185
- data/tags +0 -306
@@ -1,99 +1,147 @@
|
|
1
|
+
=begin
|
2
|
+
#shotstack
|
3
|
+
|
4
|
+
#The Shotstack API is a video editing service that allows for the programatic creation of videos using JSON.
|
5
|
+
|
6
|
+
OpenAPI spec version: v1
|
7
|
+
|
8
|
+
Generated by: https://openapi-generator.tech
|
9
|
+
OpenAPI Generator version: 4.0.0-beta3
|
10
|
+
|
11
|
+
=end
|
12
|
+
|
1
13
|
require 'date'
|
2
14
|
|
3
15
|
module Shotstack
|
4
|
-
#
|
16
|
+
# A timeline represents the contents of a video edit over time, in seconds. A timeline consists of layers called tracks. Tracks are composed of titles, images or video segments referred to as clips which are placed along the track at specific starting point and lasting for a specific amount of time.
|
5
17
|
class Timeline
|
6
|
-
attr_accessor :background
|
7
|
-
|
8
18
|
attr_accessor :soundtrack
|
9
19
|
|
20
|
+
# A hexidecimal value for the timeline background colour. Defaults to black (#000000).
|
21
|
+
attr_accessor :background
|
22
|
+
|
23
|
+
# A timeline consists of an array of tracks, each track containing clips. Tracks are layered on top of each other in the same order they are added to the array with the top most track layered over the top of those below it. Ensure that a track containing titles is the top most track so that it is displayed above videos and images.
|
10
24
|
attr_accessor :tracks
|
11
25
|
|
12
26
|
# Attribute mapping from ruby-style variable name to JSON key.
|
13
27
|
def self.attribute_map
|
14
28
|
{
|
15
|
-
|
16
|
-
:'background' => :'background',
|
17
|
-
|
18
29
|
:'soundtrack' => :'soundtrack',
|
19
|
-
|
30
|
+
:'background' => :'background',
|
20
31
|
:'tracks' => :'tracks'
|
21
|
-
|
22
32
|
}
|
23
33
|
end
|
24
34
|
|
25
35
|
# Attribute type mapping.
|
26
|
-
def self.
|
36
|
+
def self.openapi_types
|
27
37
|
{
|
28
|
-
:'background' => :'String',
|
29
38
|
:'soundtrack' => :'Soundtrack',
|
39
|
+
:'background' => :'String',
|
30
40
|
:'tracks' => :'Array<Track>'
|
31
|
-
|
32
41
|
}
|
33
42
|
end
|
34
43
|
|
44
|
+
# Initializes the object
|
45
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
35
46
|
def initialize(attributes = {})
|
36
|
-
|
47
|
+
if (!attributes.is_a?(Hash))
|
48
|
+
fail ArgumentError, "The input argument (attributes) must be a hash in `Shotstack::Timeline` initialize method"
|
49
|
+
end
|
37
50
|
|
38
|
-
# convert string to symbol for hash key
|
39
|
-
attributes = attributes.
|
51
|
+
# check to see if the attribute exists and convert string to symbol for hash key
|
52
|
+
attributes = attributes.each_with_object({}) { |(k, v), h|
|
53
|
+
if (!self.class.attribute_map.key?(k.to_sym))
|
54
|
+
fail ArgumentError, "`#{k}` is not a valid attribute in `Shotstack::Timeline`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
|
55
|
+
end
|
56
|
+
h[k.to_sym] = v
|
57
|
+
}
|
40
58
|
|
41
|
-
|
42
|
-
if attributes[:'background']
|
43
|
-
self.background = attributes[:'background']
|
44
|
-
end
|
45
|
-
|
46
|
-
if attributes[:'soundtrack']
|
59
|
+
if attributes.key?(:'soundtrack')
|
47
60
|
self.soundtrack = attributes[:'soundtrack']
|
48
61
|
end
|
49
|
-
|
50
|
-
if attributes
|
62
|
+
|
63
|
+
if attributes.key?(:'background')
|
64
|
+
self.background = attributes[:'background']
|
65
|
+
end
|
66
|
+
|
67
|
+
if attributes.key?(:'tracks')
|
51
68
|
if (value = attributes[:'tracks']).is_a?(Array)
|
52
69
|
self.tracks = value
|
53
70
|
end
|
54
71
|
end
|
55
|
-
|
56
72
|
end
|
57
73
|
|
58
|
-
#
|
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 @tracks.nil?
|
79
|
+
invalid_properties.push('invalid value for "tracks", tracks 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 @tracks.nil?
|
89
|
+
true
|
90
|
+
end
|
91
|
+
|
92
|
+
# Checks equality by comparing each attribute.
|
93
|
+
# @param [Object] Object to be compared
|
59
94
|
def ==(o)
|
60
95
|
return true if self.equal?(o)
|
61
96
|
self.class == o.class &&
|
62
|
-
background == o.background &&
|
63
97
|
soundtrack == o.soundtrack &&
|
98
|
+
background == o.background &&
|
64
99
|
tracks == o.tracks
|
65
100
|
end
|
66
101
|
|
67
102
|
# @see the `==` method
|
103
|
+
# @param [Object] Object to be compared
|
68
104
|
def eql?(o)
|
69
105
|
self == o
|
70
106
|
end
|
71
107
|
|
72
|
-
#
|
108
|
+
# Calculates hash code according to all attributes.
|
109
|
+
# @return [Integer] Hash code
|
73
110
|
def hash
|
74
|
-
[
|
111
|
+
[soundtrack, background, tracks].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)
|
75
119
|
end
|
76
120
|
|
77
|
-
#
|
121
|
+
# Builds the object from hash
|
122
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
123
|
+
# @return [Object] Returns the model itself
|
78
124
|
def build_from_hash(attributes)
|
79
125
|
return nil unless attributes.is_a?(Hash)
|
80
|
-
self.class.
|
81
|
-
if type =~
|
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
|
82
130
|
if attributes[self.class.attribute_map[key]].is_a?(Array)
|
83
|
-
self.send("#{key}=", attributes[self.class.attribute_map[key]].map{ |v| _deserialize($1, v) }
|
84
|
-
else
|
85
|
-
#TODO show warning in debug mode
|
131
|
+
self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
|
86
132
|
end
|
87
133
|
elsif !attributes[self.class.attribute_map[key]].nil?
|
88
134
|
self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
|
89
|
-
else
|
90
|
-
# data not found in attributes(hash), not an issue as the data can be optional
|
91
|
-
end
|
135
|
+
end # or else data not found in attributes(hash), not an issue as the data can be optional
|
92
136
|
end
|
93
137
|
|
94
138
|
self
|
95
139
|
end
|
96
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
|
97
145
|
def _deserialize(type, value)
|
98
146
|
case type.to_sym
|
99
147
|
when :DateTime
|
@@ -106,16 +154,19 @@ module Shotstack
|
|
106
154
|
value.to_i
|
107
155
|
when :Float
|
108
156
|
value.to_f
|
109
|
-
when :
|
110
|
-
if value =~
|
157
|
+
when :Boolean
|
158
|
+
if value.to_s =~ /\A(true|t|yes|y|1)\z/i
|
111
159
|
true
|
112
160
|
else
|
113
161
|
false
|
114
162
|
end
|
163
|
+
when :Object
|
164
|
+
# generic object (usually a Hash), return directly
|
165
|
+
value
|
115
166
|
when /\AArray<(?<inner_type>.+)>\z/
|
116
167
|
inner_type = Regexp.last_match[:inner_type]
|
117
168
|
value.map { |v| _deserialize(inner_type, v) }
|
118
|
-
when /\AHash<(?<k_type
|
169
|
+
when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
|
119
170
|
k_type = Regexp.last_match[:k_type]
|
120
171
|
v_type = Regexp.last_match[:v_type]
|
121
172
|
{}.tap do |hash|
|
@@ -124,21 +175,24 @@ module Shotstack
|
|
124
175
|
end
|
125
176
|
end
|
126
177
|
else # model
|
127
|
-
|
128
|
-
_model.build_from_hash(value)
|
178
|
+
Shotstack.const_get(type).build_from_hash(value)
|
129
179
|
end
|
130
180
|
end
|
131
181
|
|
182
|
+
# Returns the string representation of the object
|
183
|
+
# @return [String] String presentation of the object
|
132
184
|
def to_s
|
133
185
|
to_hash.to_s
|
134
186
|
end
|
135
187
|
|
136
|
-
# to_body is an alias to
|
188
|
+
# to_body is an alias to to_hash (backward compatibility)
|
189
|
+
# @return [Hash] Returns the object in the form of hash
|
137
190
|
def to_body
|
138
191
|
to_hash
|
139
192
|
end
|
140
193
|
|
141
|
-
#
|
194
|
+
# Returns the object in the form of hash
|
195
|
+
# @return [Hash] Returns the object in the form of hash
|
142
196
|
def to_hash
|
143
197
|
hash = {}
|
144
198
|
self.class.attribute_map.each_pair do |attr, param|
|
@@ -149,11 +203,13 @@ module Shotstack
|
|
149
203
|
hash
|
150
204
|
end
|
151
205
|
|
152
|
-
#
|
206
|
+
# Outputs non-array value in the form of hash
|
153
207
|
# For object, use to_hash. Otherwise, just return the value
|
208
|
+
# @param [Object] value Any valid value
|
209
|
+
# @return [Hash] Returns the value in the form of hash
|
154
210
|
def _to_hash(value)
|
155
211
|
if value.is_a?(Array)
|
156
|
-
value.compact.map{ |v| _to_hash(v) }
|
212
|
+
value.compact.map { |v| _to_hash(v) }
|
157
213
|
elsif value.is_a?(Hash)
|
158
214
|
{}.tap do |hash|
|
159
215
|
value.each { |k, v| hash[k] = _to_hash(v) }
|
@@ -164,6 +220,5 @@ module Shotstack
|
|
164
220
|
value
|
165
221
|
end
|
166
222
|
end
|
167
|
-
|
168
223
|
end
|
169
224
|
end
|
@@ -0,0 +1,265 @@
|
|
1
|
+
=begin
|
2
|
+
#shotstack
|
3
|
+
|
4
|
+
#The Shotstack API is a video editing service that allows for the programatic creation of videos using JSON.
|
5
|
+
|
6
|
+
OpenAPI spec version: v1
|
7
|
+
|
8
|
+
Generated by: https://openapi-generator.tech
|
9
|
+
OpenAPI Generator version: 4.0.0-beta3
|
10
|
+
|
11
|
+
=end
|
12
|
+
|
13
|
+
require 'date'
|
14
|
+
require_relative 'asset'
|
15
|
+
|
16
|
+
module Shotstack
|
17
|
+
# The TitleAsset clip type lets you create video titles from a text string and apply styling.
|
18
|
+
class TitleAsset < Asset
|
19
|
+
# The type of asset - set to <b>title</b> for titles.
|
20
|
+
attr_accessor :type
|
21
|
+
|
22
|
+
# The title text string - i.e. \"My Title\".
|
23
|
+
attr_accessor :text
|
24
|
+
|
25
|
+
# Uses a preset to apply font properties and stylng to the title.
|
26
|
+
attr_accessor :style
|
27
|
+
|
28
|
+
class EnumAttributeValidator
|
29
|
+
attr_reader :datatype
|
30
|
+
attr_reader :allowable_values
|
31
|
+
|
32
|
+
def initialize(datatype, allowable_values)
|
33
|
+
@allowable_values = allowable_values.map do |value|
|
34
|
+
case datatype.to_s
|
35
|
+
when /Integer/i
|
36
|
+
value.to_i
|
37
|
+
when /Float/i
|
38
|
+
value.to_f
|
39
|
+
else
|
40
|
+
value
|
41
|
+
end
|
42
|
+
end
|
43
|
+
end
|
44
|
+
|
45
|
+
def valid?(value)
|
46
|
+
!value || allowable_values.include?(value)
|
47
|
+
end
|
48
|
+
end
|
49
|
+
|
50
|
+
# Attribute mapping from ruby-style variable name to JSON key.
|
51
|
+
def self.attribute_map
|
52
|
+
{
|
53
|
+
:'type' => :'type',
|
54
|
+
:'text' => :'text',
|
55
|
+
:'style' => :'style'
|
56
|
+
}
|
57
|
+
end
|
58
|
+
|
59
|
+
# Attribute type mapping.
|
60
|
+
def self.openapi_types
|
61
|
+
{
|
62
|
+
:'type' => :'String',
|
63
|
+
:'text' => :'String',
|
64
|
+
:'style' => :'String'
|
65
|
+
}
|
66
|
+
end
|
67
|
+
|
68
|
+
# Initializes the object
|
69
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
70
|
+
def initialize(attributes = {})
|
71
|
+
if (!attributes.is_a?(Hash))
|
72
|
+
fail ArgumentError, "The input argument (attributes) must be a hash in `Shotstack::TitleAsset` initialize method"
|
73
|
+
end
|
74
|
+
|
75
|
+
# check to see if the attribute exists and convert string to symbol for hash key
|
76
|
+
attributes = attributes.each_with_object({}) { |(k, v), h|
|
77
|
+
if (!self.class.attribute_map.key?(k.to_sym))
|
78
|
+
fail ArgumentError, "`#{k}` is not a valid attribute in `Shotstack::TitleAsset`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
|
79
|
+
end
|
80
|
+
h[k.to_sym] = v
|
81
|
+
}
|
82
|
+
|
83
|
+
if attributes.key?(:'type')
|
84
|
+
self.type = attributes[:'type']
|
85
|
+
else
|
86
|
+
self.type = 'title'
|
87
|
+
end
|
88
|
+
|
89
|
+
if attributes.key?(:'text')
|
90
|
+
self.text = attributes[:'text']
|
91
|
+
end
|
92
|
+
|
93
|
+
if attributes.key?(:'style')
|
94
|
+
self.style = attributes[:'style']
|
95
|
+
end
|
96
|
+
end
|
97
|
+
|
98
|
+
# Show invalid properties with the reasons. Usually used together with valid?
|
99
|
+
# @return Array for valid properties with the reasons
|
100
|
+
def list_invalid_properties
|
101
|
+
invalid_properties = Array.new
|
102
|
+
if @type.nil?
|
103
|
+
invalid_properties.push('invalid value for "type", type cannot be nil.')
|
104
|
+
end
|
105
|
+
|
106
|
+
if @text.nil?
|
107
|
+
invalid_properties.push('invalid value for "text", text cannot be nil.')
|
108
|
+
end
|
109
|
+
|
110
|
+
invalid_properties
|
111
|
+
end
|
112
|
+
|
113
|
+
# Check to see if the all the properties in the model are valid
|
114
|
+
# @return true if the model is valid
|
115
|
+
def valid?
|
116
|
+
return false if @type.nil?
|
117
|
+
return false if @text.nil?
|
118
|
+
style_validator = EnumAttributeValidator.new('String', ["minimal", "blockbuster", "vogue", "sketchy", "skinny"])
|
119
|
+
return false unless style_validator.valid?(@style)
|
120
|
+
true
|
121
|
+
end
|
122
|
+
|
123
|
+
# Custom attribute writer method checking allowed values (enum).
|
124
|
+
# @param [Object] style Object to be assigned
|
125
|
+
def style=(style)
|
126
|
+
validator = EnumAttributeValidator.new('String', ["minimal", "blockbuster", "vogue", "sketchy", "skinny"])
|
127
|
+
unless validator.valid?(style)
|
128
|
+
fail ArgumentError, "invalid value for \"style\", must be one of #{validator.allowable_values}."
|
129
|
+
end
|
130
|
+
@style = style
|
131
|
+
end
|
132
|
+
|
133
|
+
# Checks equality by comparing each attribute.
|
134
|
+
# @param [Object] Object to be compared
|
135
|
+
def ==(o)
|
136
|
+
return true if self.equal?(o)
|
137
|
+
self.class == o.class &&
|
138
|
+
type == o.type &&
|
139
|
+
text == o.text &&
|
140
|
+
style == o.style
|
141
|
+
end
|
142
|
+
|
143
|
+
# @see the `==` method
|
144
|
+
# @param [Object] Object to be compared
|
145
|
+
def eql?(o)
|
146
|
+
self == o
|
147
|
+
end
|
148
|
+
|
149
|
+
# Calculates hash code according to all attributes.
|
150
|
+
# @return [Integer] Hash code
|
151
|
+
def hash
|
152
|
+
[type, text, style].hash
|
153
|
+
end
|
154
|
+
|
155
|
+
# Builds the object from hash
|
156
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
157
|
+
# @return [Object] Returns the model itself
|
158
|
+
def self.build_from_hash(attributes)
|
159
|
+
new.build_from_hash(attributes)
|
160
|
+
end
|
161
|
+
|
162
|
+
# Builds the object from hash
|
163
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
164
|
+
# @return [Object] Returns the model itself
|
165
|
+
def build_from_hash(attributes)
|
166
|
+
return nil unless attributes.is_a?(Hash)
|
167
|
+
self.class.openapi_types.each_pair do |key, type|
|
168
|
+
if type =~ /\AArray<(.*)>/i
|
169
|
+
# check to ensure the input is an array given that the attribute
|
170
|
+
# is documented as an array but the input is not
|
171
|
+
if attributes[self.class.attribute_map[key]].is_a?(Array)
|
172
|
+
self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
|
173
|
+
end
|
174
|
+
elsif !attributes[self.class.attribute_map[key]].nil?
|
175
|
+
self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
|
176
|
+
end # or else data not found in attributes(hash), not an issue as the data can be optional
|
177
|
+
end
|
178
|
+
|
179
|
+
self
|
180
|
+
end
|
181
|
+
|
182
|
+
# Deserializes the data based on type
|
183
|
+
# @param string type Data type
|
184
|
+
# @param string value Value to be deserialized
|
185
|
+
# @return [Object] Deserialized data
|
186
|
+
def _deserialize(type, value)
|
187
|
+
case type.to_sym
|
188
|
+
when :DateTime
|
189
|
+
DateTime.parse(value)
|
190
|
+
when :Date
|
191
|
+
Date.parse(value)
|
192
|
+
when :String
|
193
|
+
value.to_s
|
194
|
+
when :Integer
|
195
|
+
value.to_i
|
196
|
+
when :Float
|
197
|
+
value.to_f
|
198
|
+
when :Boolean
|
199
|
+
if value.to_s =~ /\A(true|t|yes|y|1)\z/i
|
200
|
+
true
|
201
|
+
else
|
202
|
+
false
|
203
|
+
end
|
204
|
+
when :Object
|
205
|
+
# generic object (usually a Hash), return directly
|
206
|
+
value
|
207
|
+
when /\AArray<(?<inner_type>.+)>\z/
|
208
|
+
inner_type = Regexp.last_match[:inner_type]
|
209
|
+
value.map { |v| _deserialize(inner_type, v) }
|
210
|
+
when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
|
211
|
+
k_type = Regexp.last_match[:k_type]
|
212
|
+
v_type = Regexp.last_match[:v_type]
|
213
|
+
{}.tap do |hash|
|
214
|
+
value.each do |k, v|
|
215
|
+
hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
|
216
|
+
end
|
217
|
+
end
|
218
|
+
else # model
|
219
|
+
Shotstack.const_get(type).build_from_hash(value)
|
220
|
+
end
|
221
|
+
end
|
222
|
+
|
223
|
+
# Returns the string representation of the object
|
224
|
+
# @return [String] String presentation of the object
|
225
|
+
def to_s
|
226
|
+
to_hash.to_s
|
227
|
+
end
|
228
|
+
|
229
|
+
# to_body is an alias to to_hash (backward compatibility)
|
230
|
+
# @return [Hash] Returns the object in the form of hash
|
231
|
+
def to_body
|
232
|
+
to_hash
|
233
|
+
end
|
234
|
+
|
235
|
+
# Returns the object in the form of hash
|
236
|
+
# @return [Hash] Returns the object in the form of hash
|
237
|
+
def to_hash
|
238
|
+
hash = {}
|
239
|
+
self.class.attribute_map.each_pair do |attr, param|
|
240
|
+
value = self.send(attr)
|
241
|
+
next if value.nil?
|
242
|
+
hash[param] = _to_hash(value)
|
243
|
+
end
|
244
|
+
hash
|
245
|
+
end
|
246
|
+
|
247
|
+
# Outputs non-array value in the form of hash
|
248
|
+
# For object, use to_hash. Otherwise, just return the value
|
249
|
+
# @param [Object] value Any valid value
|
250
|
+
# @return [Hash] Returns the value in the form of hash
|
251
|
+
def _to_hash(value)
|
252
|
+
if value.is_a?(Array)
|
253
|
+
value.compact.map { |v| _to_hash(v) }
|
254
|
+
elsif value.is_a?(Hash)
|
255
|
+
{}.tap do |hash|
|
256
|
+
value.each { |k, v| hash[k] = _to_hash(v) }
|
257
|
+
end
|
258
|
+
elsif value.respond_to? :to_hash
|
259
|
+
value.to_hash
|
260
|
+
else
|
261
|
+
value
|
262
|
+
end
|
263
|
+
end
|
264
|
+
end
|
265
|
+
end
|