shotstack 0.0.11 → 0.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/shotstack.rb +12 -5
- data/lib/shotstack/api/{default_api.rb → endpoints_api.rb} +17 -17
- data/lib/shotstack/api_client.rb +33 -34
- data/lib/shotstack/api_error.rb +4 -4
- data/lib/shotstack/configuration.rb +11 -10
- data/lib/shotstack/models/audio_asset.rb +251 -0
- data/lib/shotstack/models/clip.rb +98 -11
- data/lib/shotstack/models/edit.rb +29 -9
- data/lib/shotstack/models/font.rb +213 -0
- data/lib/shotstack/models/html_asset.rb +319 -0
- data/lib/shotstack/models/image_asset.rb +15 -5
- data/lib/shotstack/models/luma_asset.rb +241 -0
- data/lib/shotstack/models/offset.rb +266 -0
- data/lib/shotstack/models/output.rb +85 -11
- data/lib/shotstack/models/poster.rb +213 -0
- data/lib/shotstack/models/queued_response.rb +14 -4
- data/lib/shotstack/models/queued_response_data.rb +14 -4
- data/lib/shotstack/models/render_response.rb +14 -4
- data/lib/shotstack/models/render_response_data.rb +14 -4
- data/lib/shotstack/models/soundtrack.rb +30 -10
- data/lib/shotstack/models/thumbnail.rb +228 -0
- data/lib/shotstack/models/timeline.rb +32 -8
- data/lib/shotstack/models/title_asset.rb +78 -13
- data/lib/shotstack/models/track.rb +15 -5
- data/lib/shotstack/models/transition.rb +18 -8
- data/lib/shotstack/models/video_asset.rb +18 -8
- data/lib/shotstack/version.rb +4 -4
- data/shotstack-0.0.11.gem +0 -0
- data/shotstack.gemspec +6 -12
- metadata +16 -126
@@ -1,21 +1,21 @@
|
|
1
1
|
=begin
|
2
|
-
#
|
2
|
+
#Shotstack
|
3
3
|
|
4
|
-
#The Shotstack API is a video editing service that allows for the
|
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.
|
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 clip is a container for a specific type of asset, i.e. a title,
|
16
|
+
# A clip is a container for a specific type of asset, i.e. a title, image, video, audio or html. You use a Clip to define when an asset will display on the timeline, how long it will play for and transitions, filters and effects to apply to it.
|
17
17
|
class Clip
|
18
|
-
# The type of asset to display for the duration of this Clip. Value must be one of <b>TitleAsset</b>, <b>ImageAsset</b> or <b>
|
18
|
+
# The type of asset to display for the duration of this Clip. Value must be one of <b>TitleAsset</b>, <b>ImageAsset</b>, <b>VideoAsset</b>, <b>HtmlAsset</b>, <b>AudioAsset</b> or <b>LumaAsset</b>
|
19
19
|
attr_accessor :asset
|
20
20
|
|
21
21
|
# The start position of the Clip on the timeline, in seconds.
|
@@ -24,6 +24,17 @@ module Shotstack
|
|
24
24
|
# The length, in seconds, the Clip should play for.
|
25
25
|
attr_accessor :length
|
26
26
|
|
27
|
+
# Set how the asset should be scaled to fit the viewport using one of the following options: <ul> <li>`cover` - stretch the asset to fill the viewport without maintaining the aspect ratio.</li> <li>`contain` - fit the entire asset within the viewport while maintaining the original aspect ratio.</li> <li>`crop` - scale the asset to fill the viewport while maintaining the aspect ratio. The asset will be cropped if it exceeds the bounds of the viewport.</li> <li>`none` - preserves the original asset dimensions and does not apply any scaling.</li> </ul>
|
28
|
+
attr_accessor :fit
|
29
|
+
|
30
|
+
# Scale the asset to a fraction of the viewport size - i.e. setting the scale to 0.5 will scale asset to half the size of the viewport. This is useful for picture-in-picture video and scaling images such as logos and watermarks.
|
31
|
+
attr_accessor :scale
|
32
|
+
|
33
|
+
# Place the asset in one of nine predefined positions of the viewport. This is most effective for when the asset is scaled and you want to position the element to a specific position.
|
34
|
+
attr_accessor :position
|
35
|
+
|
36
|
+
attr_accessor :offset
|
37
|
+
|
27
38
|
attr_accessor :transition
|
28
39
|
|
29
40
|
# A motion effect to apply to the Clip.
|
@@ -32,6 +43,9 @@ module Shotstack
|
|
32
43
|
# A filter effect to apply to the Clip.
|
33
44
|
attr_accessor :filter
|
34
45
|
|
46
|
+
# Sets the opacity of the Clip where 1 is opaque and 0 is transparent.
|
47
|
+
attr_accessor :opacity
|
48
|
+
|
35
49
|
class EnumAttributeValidator
|
36
50
|
attr_reader :datatype
|
37
51
|
attr_reader :allowable_values
|
@@ -60,24 +74,40 @@ module Shotstack
|
|
60
74
|
:'asset' => :'asset',
|
61
75
|
:'start' => :'start',
|
62
76
|
:'length' => :'length',
|
77
|
+
:'fit' => :'fit',
|
78
|
+
:'scale' => :'scale',
|
79
|
+
:'position' => :'position',
|
80
|
+
:'offset' => :'offset',
|
63
81
|
:'transition' => :'transition',
|
64
82
|
:'effect' => :'effect',
|
65
|
-
:'filter' => :'filter'
|
83
|
+
:'filter' => :'filter',
|
84
|
+
:'opacity' => :'opacity'
|
66
85
|
}
|
67
86
|
end
|
68
87
|
|
69
88
|
# Attribute type mapping.
|
70
89
|
def self.openapi_types
|
71
90
|
{
|
72
|
-
:'asset' => :'
|
91
|
+
:'asset' => :'OneOfTitleAssetImageAssetVideoAssetHtmlAssetAudioAssetLumaAsset',
|
73
92
|
:'start' => :'Float',
|
74
93
|
:'length' => :'Float',
|
94
|
+
:'fit' => :'String',
|
95
|
+
:'scale' => :'Float',
|
96
|
+
:'position' => :'String',
|
97
|
+
:'offset' => :'Offset',
|
75
98
|
:'transition' => :'Transition',
|
76
99
|
:'effect' => :'String',
|
77
|
-
:'filter' => :'String'
|
100
|
+
:'filter' => :'String',
|
101
|
+
:'opacity' => :'Float'
|
78
102
|
}
|
79
103
|
end
|
80
104
|
|
105
|
+
# List of attributes with nullable: true
|
106
|
+
def self.openapi_nullable
|
107
|
+
Set.new([
|
108
|
+
])
|
109
|
+
end
|
110
|
+
|
81
111
|
# Initializes the object
|
82
112
|
# @param [Hash] attributes Model attributes in the form of hash
|
83
113
|
def initialize(attributes = {})
|
@@ -105,6 +135,26 @@ module Shotstack
|
|
105
135
|
self.length = attributes[:'length']
|
106
136
|
end
|
107
137
|
|
138
|
+
if attributes.key?(:'fit')
|
139
|
+
self.fit = attributes[:'fit']
|
140
|
+
else
|
141
|
+
self.fit = 'crop'
|
142
|
+
end
|
143
|
+
|
144
|
+
if attributes.key?(:'scale')
|
145
|
+
self.scale = attributes[:'scale']
|
146
|
+
end
|
147
|
+
|
148
|
+
if attributes.key?(:'position')
|
149
|
+
self.position = attributes[:'position']
|
150
|
+
else
|
151
|
+
self.position = 'center'
|
152
|
+
end
|
153
|
+
|
154
|
+
if attributes.key?(:'offset')
|
155
|
+
self.offset = attributes[:'offset']
|
156
|
+
end
|
157
|
+
|
108
158
|
if attributes.key?(:'transition')
|
109
159
|
self.transition = attributes[:'transition']
|
110
160
|
end
|
@@ -116,6 +166,10 @@ module Shotstack
|
|
116
166
|
if attributes.key?(:'filter')
|
117
167
|
self.filter = attributes[:'filter']
|
118
168
|
end
|
169
|
+
|
170
|
+
if attributes.key?(:'opacity')
|
171
|
+
self.opacity = attributes[:'opacity']
|
172
|
+
end
|
119
173
|
end
|
120
174
|
|
121
175
|
# Show invalid properties with the reasons. Usually used together with valid?
|
@@ -143,6 +197,10 @@ module Shotstack
|
|
143
197
|
return false if @asset.nil?
|
144
198
|
return false if @start.nil?
|
145
199
|
return false if @length.nil?
|
200
|
+
fit_validator = EnumAttributeValidator.new('String', ["cover", "contain", "crop", "none"])
|
201
|
+
return false unless fit_validator.valid?(@fit)
|
202
|
+
position_validator = EnumAttributeValidator.new('String', ["top", "topRight", "right", "bottomRight", "bottom", "bottomLeft", "left", "topLeft", "center"])
|
203
|
+
return false unless position_validator.valid?(@position)
|
146
204
|
effect_validator = EnumAttributeValidator.new('String', ["zoomIn", "zoomOut", "slideLeft", "slideRight", "slideUp", "slideDown"])
|
147
205
|
return false unless effect_validator.valid?(@effect)
|
148
206
|
filter_validator = EnumAttributeValidator.new('String', ["boost", "contrast", "darken", "greyscale", "lighten", "muted", "negative"])
|
@@ -150,6 +208,26 @@ module Shotstack
|
|
150
208
|
true
|
151
209
|
end
|
152
210
|
|
211
|
+
# Custom attribute writer method checking allowed values (enum).
|
212
|
+
# @param [Object] fit Object to be assigned
|
213
|
+
def fit=(fit)
|
214
|
+
validator = EnumAttributeValidator.new('String', ["cover", "contain", "crop", "none"])
|
215
|
+
unless validator.valid?(fit)
|
216
|
+
fail ArgumentError, "invalid value for \"fit\", must be one of #{validator.allowable_values}."
|
217
|
+
end
|
218
|
+
@fit = fit
|
219
|
+
end
|
220
|
+
|
221
|
+
# Custom attribute writer method checking allowed values (enum).
|
222
|
+
# @param [Object] position Object to be assigned
|
223
|
+
def position=(position)
|
224
|
+
validator = EnumAttributeValidator.new('String', ["top", "topRight", "right", "bottomRight", "bottom", "bottomLeft", "left", "topLeft", "center"])
|
225
|
+
unless validator.valid?(position)
|
226
|
+
fail ArgumentError, "invalid value for \"position\", must be one of #{validator.allowable_values}."
|
227
|
+
end
|
228
|
+
@position = position
|
229
|
+
end
|
230
|
+
|
153
231
|
# Custom attribute writer method checking allowed values (enum).
|
154
232
|
# @param [Object] effect Object to be assigned
|
155
233
|
def effect=(effect)
|
@@ -178,9 +256,14 @@ module Shotstack
|
|
178
256
|
asset == o.asset &&
|
179
257
|
start == o.start &&
|
180
258
|
length == o.length &&
|
259
|
+
fit == o.fit &&
|
260
|
+
scale == o.scale &&
|
261
|
+
position == o.position &&
|
262
|
+
offset == o.offset &&
|
181
263
|
transition == o.transition &&
|
182
264
|
effect == o.effect &&
|
183
|
-
filter == o.filter
|
265
|
+
filter == o.filter &&
|
266
|
+
opacity == o.opacity
|
184
267
|
end
|
185
268
|
|
186
269
|
# @see the `==` method
|
@@ -192,7 +275,7 @@ module Shotstack
|
|
192
275
|
# Calculates hash code according to all attributes.
|
193
276
|
# @return [Integer] Hash code
|
194
277
|
def hash
|
195
|
-
[asset, start, length, transition, effect, filter].hash
|
278
|
+
[asset, start, length, fit, scale, position, offset, transition, effect, filter, opacity].hash
|
196
279
|
end
|
197
280
|
|
198
281
|
# Builds the object from hash
|
@@ -281,7 +364,11 @@ module Shotstack
|
|
281
364
|
hash = {}
|
282
365
|
self.class.attribute_map.each_pair do |attr, param|
|
283
366
|
value = self.send(attr)
|
284
|
-
|
367
|
+
if value.nil?
|
368
|
+
is_nullable = self.class.openapi_nullable.include?(attr)
|
369
|
+
next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
|
370
|
+
end
|
371
|
+
|
285
372
|
hash[param] = _to_hash(value)
|
286
373
|
end
|
287
374
|
hash
|
@@ -1,29 +1,33 @@
|
|
1
1
|
=begin
|
2
|
-
#
|
2
|
+
#Shotstack
|
3
3
|
|
4
|
-
#The Shotstack API is a video editing service that allows for the
|
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.
|
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
|
-
# An edit defines the content of the video in a timeline and the output format.
|
16
|
+
# An edit defines the content of the video in a timeline and the output format.
|
17
17
|
class Edit
|
18
18
|
attr_accessor :timeline
|
19
19
|
|
20
20
|
attr_accessor :output
|
21
21
|
|
22
|
+
# An optional webhook callback URL used to receive status notifications when a render completes or fails.
|
23
|
+
attr_accessor :callback
|
24
|
+
|
22
25
|
# Attribute mapping from ruby-style variable name to JSON key.
|
23
26
|
def self.attribute_map
|
24
27
|
{
|
25
28
|
:'timeline' => :'timeline',
|
26
|
-
:'output' => :'output'
|
29
|
+
:'output' => :'output',
|
30
|
+
:'callback' => :'callback'
|
27
31
|
}
|
28
32
|
end
|
29
33
|
|
@@ -31,10 +35,17 @@ module Shotstack
|
|
31
35
|
def self.openapi_types
|
32
36
|
{
|
33
37
|
:'timeline' => :'Timeline',
|
34
|
-
:'output' => :'Output'
|
38
|
+
:'output' => :'Output',
|
39
|
+
:'callback' => :'String'
|
35
40
|
}
|
36
41
|
end
|
37
42
|
|
43
|
+
# List of attributes with nullable: true
|
44
|
+
def self.openapi_nullable
|
45
|
+
Set.new([
|
46
|
+
])
|
47
|
+
end
|
48
|
+
|
38
49
|
# Initializes the object
|
39
50
|
# @param [Hash] attributes Model attributes in the form of hash
|
40
51
|
def initialize(attributes = {})
|
@@ -57,6 +68,10 @@ module Shotstack
|
|
57
68
|
if attributes.key?(:'output')
|
58
69
|
self.output = attributes[:'output']
|
59
70
|
end
|
71
|
+
|
72
|
+
if attributes.key?(:'callback')
|
73
|
+
self.callback = attributes[:'callback']
|
74
|
+
end
|
60
75
|
end
|
61
76
|
|
62
77
|
# Show invalid properties with the reasons. Usually used together with valid?
|
@@ -88,7 +103,8 @@ module Shotstack
|
|
88
103
|
return true if self.equal?(o)
|
89
104
|
self.class == o.class &&
|
90
105
|
timeline == o.timeline &&
|
91
|
-
output == o.output
|
106
|
+
output == o.output &&
|
107
|
+
callback == o.callback
|
92
108
|
end
|
93
109
|
|
94
110
|
# @see the `==` method
|
@@ -100,7 +116,7 @@ module Shotstack
|
|
100
116
|
# Calculates hash code according to all attributes.
|
101
117
|
# @return [Integer] Hash code
|
102
118
|
def hash
|
103
|
-
[timeline, output].hash
|
119
|
+
[timeline, output, callback].hash
|
104
120
|
end
|
105
121
|
|
106
122
|
# Builds the object from hash
|
@@ -189,7 +205,11 @@ module Shotstack
|
|
189
205
|
hash = {}
|
190
206
|
self.class.attribute_map.each_pair do |attr, param|
|
191
207
|
value = self.send(attr)
|
192
|
-
|
208
|
+
if value.nil?
|
209
|
+
is_nullable = self.class.openapi_nullable.include?(attr)
|
210
|
+
next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
|
211
|
+
end
|
212
|
+
|
193
213
|
hash[param] = _to_hash(value)
|
194
214
|
end
|
195
215
|
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
|
+
# Download a custom font to use with the HTML asset type, using the font name in the CSS or font tag.
|
17
|
+
class Font
|
18
|
+
# The URL of the font file. The URL must be publicly accessible or include credentials.
|
19
|
+
attr_accessor :src
|
20
|
+
|
21
|
+
# Attribute mapping from ruby-style variable name to JSON key.
|
22
|
+
def self.attribute_map
|
23
|
+
{
|
24
|
+
:'src' => :'src'
|
25
|
+
}
|
26
|
+
end
|
27
|
+
|
28
|
+
# Attribute type mapping.
|
29
|
+
def self.openapi_types
|
30
|
+
{
|
31
|
+
:'src' => :'String'
|
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::Font` 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::Font`. 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?(:'src')
|
57
|
+
self.src = attributes[:'src']
|
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 @src.nil?
|
66
|
+
invalid_properties.push('invalid value for "src", src 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 @src.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
|
+
src == o.src
|
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
|
+
[src].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
|