shotstack 0.0.9 → 0.1.2
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.
- checksums.yaml +5 -5
- data/README.md +17 -0
- data/lib/shotstack.rb +31 -15
- data/lib/shotstack/api/endpoints_api.rb +149 -0
- data/lib/shotstack/api_client.rb +142 -74
- data/lib/shotstack/api_error.rb +38 -5
- data/lib/shotstack/configuration.rb +93 -5
- data/lib/shotstack/models/asset.rb +17 -0
- data/lib/shotstack/models/audio_asset.rb +251 -0
- data/lib/shotstack/models/clip.rb +395 -0
- data/lib/shotstack/models/edit.rb +121 -42
- data/lib/shotstack/models/font.rb +213 -0
- data/lib/shotstack/models/html_asset.rb +319 -0
- data/lib/shotstack/models/image_asset.rb +231 -0
- data/lib/shotstack/models/luma_asset.rb +241 -0
- data/lib/shotstack/models/offset.rb +266 -0
- data/lib/shotstack/models/output.rb +207 -46
- data/lib/shotstack/models/poster.rb +213 -0
- data/lib/shotstack/models/queued_response.rb +121 -49
- data/lib/shotstack/models/queued_response_data.rb +116 -46
- data/lib/shotstack/models/render_response.rb +121 -49
- data/lib/shotstack/models/render_response_data.rb +193 -69
- data/lib/shotstack/models/soundtrack.rb +152 -42
- data/lib/shotstack/models/thumbnail.rb +228 -0
- data/lib/shotstack/models/timeline.rb +124 -45
- data/lib/shotstack/models/title_asset.rb +354 -0
- data/lib/shotstack/models/track.rb +100 -34
- data/lib/shotstack/models/transition.rb +132 -43
- data/lib/shotstack/models/video_asset.rb +251 -0
- data/lib/shotstack/version.rb +13 -1
- data/shotstack.gemspec +23 -16
- metadata +37 -150
- 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
|
@@ -0,0 +1,395 @@
|
|
|
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
|
+
# 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
|
+
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>, <b>VideoAsset</b>, <b>HtmlAsset</b>, <b>AudioAsset</b> or <b>LumaAsset</b>
|
|
19
|
+
attr_accessor :asset
|
|
20
|
+
|
|
21
|
+
# The start position of the Clip on the timeline, in seconds.
|
|
22
|
+
attr_accessor :start
|
|
23
|
+
|
|
24
|
+
# The length, in seconds, the Clip should play for.
|
|
25
|
+
attr_accessor :length
|
|
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
|
+
|
|
38
|
+
attr_accessor :transition
|
|
39
|
+
|
|
40
|
+
# A motion effect to apply to the Clip.
|
|
41
|
+
attr_accessor :effect
|
|
42
|
+
|
|
43
|
+
# A filter effect to apply to the Clip.
|
|
44
|
+
attr_accessor :filter
|
|
45
|
+
|
|
46
|
+
# Sets the opacity of the Clip where 1 is opaque and 0 is transparent.
|
|
47
|
+
attr_accessor :opacity
|
|
48
|
+
|
|
49
|
+
class EnumAttributeValidator
|
|
50
|
+
attr_reader :datatype
|
|
51
|
+
attr_reader :allowable_values
|
|
52
|
+
|
|
53
|
+
def initialize(datatype, allowable_values)
|
|
54
|
+
@allowable_values = allowable_values.map do |value|
|
|
55
|
+
case datatype.to_s
|
|
56
|
+
when /Integer/i
|
|
57
|
+
value.to_i
|
|
58
|
+
when /Float/i
|
|
59
|
+
value.to_f
|
|
60
|
+
else
|
|
61
|
+
value
|
|
62
|
+
end
|
|
63
|
+
end
|
|
64
|
+
end
|
|
65
|
+
|
|
66
|
+
def valid?(value)
|
|
67
|
+
!value || allowable_values.include?(value)
|
|
68
|
+
end
|
|
69
|
+
end
|
|
70
|
+
|
|
71
|
+
# Attribute mapping from ruby-style variable name to JSON key.
|
|
72
|
+
def self.attribute_map
|
|
73
|
+
{
|
|
74
|
+
:'asset' => :'asset',
|
|
75
|
+
:'start' => :'start',
|
|
76
|
+
:'length' => :'length',
|
|
77
|
+
:'fit' => :'fit',
|
|
78
|
+
:'scale' => :'scale',
|
|
79
|
+
:'position' => :'position',
|
|
80
|
+
:'offset' => :'offset',
|
|
81
|
+
:'transition' => :'transition',
|
|
82
|
+
:'effect' => :'effect',
|
|
83
|
+
:'filter' => :'filter',
|
|
84
|
+
:'opacity' => :'opacity'
|
|
85
|
+
}
|
|
86
|
+
end
|
|
87
|
+
|
|
88
|
+
# Attribute type mapping.
|
|
89
|
+
def self.openapi_types
|
|
90
|
+
{
|
|
91
|
+
:'asset' => :'Asset',
|
|
92
|
+
:'start' => :'Float',
|
|
93
|
+
:'length' => :'Float',
|
|
94
|
+
:'fit' => :'String',
|
|
95
|
+
:'scale' => :'Float',
|
|
96
|
+
:'position' => :'String',
|
|
97
|
+
:'offset' => :'Offset',
|
|
98
|
+
:'transition' => :'Transition',
|
|
99
|
+
:'effect' => :'String',
|
|
100
|
+
:'filter' => :'String',
|
|
101
|
+
:'opacity' => :'Float'
|
|
102
|
+
}
|
|
103
|
+
end
|
|
104
|
+
|
|
105
|
+
# List of attributes with nullable: true
|
|
106
|
+
def self.openapi_nullable
|
|
107
|
+
Set.new([
|
|
108
|
+
])
|
|
109
|
+
end
|
|
110
|
+
|
|
111
|
+
# Initializes the object
|
|
112
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
|
113
|
+
def initialize(attributes = {})
|
|
114
|
+
if (!attributes.is_a?(Hash))
|
|
115
|
+
fail ArgumentError, "The input argument (attributes) must be a hash in `Shotstack::Clip` initialize method"
|
|
116
|
+
end
|
|
117
|
+
|
|
118
|
+
# check to see if the attribute exists and convert string to symbol for hash key
|
|
119
|
+
attributes = attributes.each_with_object({}) { |(k, v), h|
|
|
120
|
+
if (!self.class.attribute_map.key?(k.to_sym))
|
|
121
|
+
fail ArgumentError, "`#{k}` is not a valid attribute in `Shotstack::Clip`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
|
|
122
|
+
end
|
|
123
|
+
h[k.to_sym] = v
|
|
124
|
+
}
|
|
125
|
+
|
|
126
|
+
if attributes.key?(:'asset')
|
|
127
|
+
self.asset = attributes[:'asset']
|
|
128
|
+
end
|
|
129
|
+
|
|
130
|
+
if attributes.key?(:'start')
|
|
131
|
+
self.start = attributes[:'start']
|
|
132
|
+
end
|
|
133
|
+
|
|
134
|
+
if attributes.key?(:'length')
|
|
135
|
+
self.length = attributes[:'length']
|
|
136
|
+
end
|
|
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
|
+
|
|
158
|
+
if attributes.key?(:'transition')
|
|
159
|
+
self.transition = attributes[:'transition']
|
|
160
|
+
end
|
|
161
|
+
|
|
162
|
+
if attributes.key?(:'effect')
|
|
163
|
+
self.effect = attributes[:'effect']
|
|
164
|
+
end
|
|
165
|
+
|
|
166
|
+
if attributes.key?(:'filter')
|
|
167
|
+
self.filter = attributes[:'filter']
|
|
168
|
+
end
|
|
169
|
+
|
|
170
|
+
if attributes.key?(:'opacity')
|
|
171
|
+
self.opacity = attributes[:'opacity']
|
|
172
|
+
end
|
|
173
|
+
end
|
|
174
|
+
|
|
175
|
+
# Show invalid properties with the reasons. Usually used together with valid?
|
|
176
|
+
# @return Array for valid properties with the reasons
|
|
177
|
+
def list_invalid_properties
|
|
178
|
+
invalid_properties = Array.new
|
|
179
|
+
if @asset.nil?
|
|
180
|
+
invalid_properties.push('invalid value for "asset", asset cannot be nil.')
|
|
181
|
+
end
|
|
182
|
+
|
|
183
|
+
if @start.nil?
|
|
184
|
+
invalid_properties.push('invalid value for "start", start cannot be nil.')
|
|
185
|
+
end
|
|
186
|
+
|
|
187
|
+
if @length.nil?
|
|
188
|
+
invalid_properties.push('invalid value for "length", length cannot be nil.')
|
|
189
|
+
end
|
|
190
|
+
|
|
191
|
+
invalid_properties
|
|
192
|
+
end
|
|
193
|
+
|
|
194
|
+
# Check to see if the all the properties in the model are valid
|
|
195
|
+
# @return true if the model is valid
|
|
196
|
+
def valid?
|
|
197
|
+
return false if @asset.nil?
|
|
198
|
+
return false if @start.nil?
|
|
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)
|
|
204
|
+
effect_validator = EnumAttributeValidator.new('String', ["zoomIn", "zoomOut", "slideLeft", "slideRight", "slideUp", "slideDown"])
|
|
205
|
+
return false unless effect_validator.valid?(@effect)
|
|
206
|
+
filter_validator = EnumAttributeValidator.new('String', ["boost", "contrast", "darken", "greyscale", "lighten", "muted", "negative"])
|
|
207
|
+
return false unless filter_validator.valid?(@filter)
|
|
208
|
+
true
|
|
209
|
+
end
|
|
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
|
+
|
|
231
|
+
# Custom attribute writer method checking allowed values (enum).
|
|
232
|
+
# @param [Object] effect Object to be assigned
|
|
233
|
+
def effect=(effect)
|
|
234
|
+
validator = EnumAttributeValidator.new('String', ["zoomIn", "zoomOut", "slideLeft", "slideRight", "slideUp", "slideDown"])
|
|
235
|
+
unless validator.valid?(effect)
|
|
236
|
+
fail ArgumentError, "invalid value for \"effect\", must be one of #{validator.allowable_values}."
|
|
237
|
+
end
|
|
238
|
+
@effect = effect
|
|
239
|
+
end
|
|
240
|
+
|
|
241
|
+
# Custom attribute writer method checking allowed values (enum).
|
|
242
|
+
# @param [Object] filter Object to be assigned
|
|
243
|
+
def filter=(filter)
|
|
244
|
+
validator = EnumAttributeValidator.new('String', ["boost", "contrast", "darken", "greyscale", "lighten", "muted", "negative"])
|
|
245
|
+
unless validator.valid?(filter)
|
|
246
|
+
fail ArgumentError, "invalid value for \"filter\", must be one of #{validator.allowable_values}."
|
|
247
|
+
end
|
|
248
|
+
@filter = filter
|
|
249
|
+
end
|
|
250
|
+
|
|
251
|
+
# Checks equality by comparing each attribute.
|
|
252
|
+
# @param [Object] Object to be compared
|
|
253
|
+
def ==(o)
|
|
254
|
+
return true if self.equal?(o)
|
|
255
|
+
self.class == o.class &&
|
|
256
|
+
asset == o.asset &&
|
|
257
|
+
start == o.start &&
|
|
258
|
+
length == o.length &&
|
|
259
|
+
fit == o.fit &&
|
|
260
|
+
scale == o.scale &&
|
|
261
|
+
position == o.position &&
|
|
262
|
+
offset == o.offset &&
|
|
263
|
+
transition == o.transition &&
|
|
264
|
+
effect == o.effect &&
|
|
265
|
+
filter == o.filter &&
|
|
266
|
+
opacity == o.opacity
|
|
267
|
+
end
|
|
268
|
+
|
|
269
|
+
# @see the `==` method
|
|
270
|
+
# @param [Object] Object to be compared
|
|
271
|
+
def eql?(o)
|
|
272
|
+
self == o
|
|
273
|
+
end
|
|
274
|
+
|
|
275
|
+
# Calculates hash code according to all attributes.
|
|
276
|
+
# @return [Integer] Hash code
|
|
277
|
+
def hash
|
|
278
|
+
[asset, start, length, fit, scale, position, offset, transition, effect, filter, opacity].hash
|
|
279
|
+
end
|
|
280
|
+
|
|
281
|
+
# Builds the object from hash
|
|
282
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
|
283
|
+
# @return [Object] Returns the model itself
|
|
284
|
+
def self.build_from_hash(attributes)
|
|
285
|
+
new.build_from_hash(attributes)
|
|
286
|
+
end
|
|
287
|
+
|
|
288
|
+
# Builds the object from hash
|
|
289
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
|
290
|
+
# @return [Object] Returns the model itself
|
|
291
|
+
def build_from_hash(attributes)
|
|
292
|
+
return nil unless attributes.is_a?(Hash)
|
|
293
|
+
self.class.openapi_types.each_pair do |key, type|
|
|
294
|
+
if type =~ /\AArray<(.*)>/i
|
|
295
|
+
# check to ensure the input is an array given that the attribute
|
|
296
|
+
# is documented as an array but the input is not
|
|
297
|
+
if attributes[self.class.attribute_map[key]].is_a?(Array)
|
|
298
|
+
self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
|
|
299
|
+
end
|
|
300
|
+
elsif !attributes[self.class.attribute_map[key]].nil?
|
|
301
|
+
self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
|
|
302
|
+
end # or else data not found in attributes(hash), not an issue as the data can be optional
|
|
303
|
+
end
|
|
304
|
+
|
|
305
|
+
self
|
|
306
|
+
end
|
|
307
|
+
|
|
308
|
+
# Deserializes the data based on type
|
|
309
|
+
# @param string type Data type
|
|
310
|
+
# @param string value Value to be deserialized
|
|
311
|
+
# @return [Object] Deserialized data
|
|
312
|
+
def _deserialize(type, value)
|
|
313
|
+
case type.to_sym
|
|
314
|
+
when :DateTime
|
|
315
|
+
DateTime.parse(value)
|
|
316
|
+
when :Date
|
|
317
|
+
Date.parse(value)
|
|
318
|
+
when :String
|
|
319
|
+
value.to_s
|
|
320
|
+
when :Integer
|
|
321
|
+
value.to_i
|
|
322
|
+
when :Float
|
|
323
|
+
value.to_f
|
|
324
|
+
when :Boolean
|
|
325
|
+
if value.to_s =~ /\A(true|t|yes|y|1)\z/i
|
|
326
|
+
true
|
|
327
|
+
else
|
|
328
|
+
false
|
|
329
|
+
end
|
|
330
|
+
when :Object
|
|
331
|
+
# generic object (usually a Hash), return directly
|
|
332
|
+
value
|
|
333
|
+
when /\AArray<(?<inner_type>.+)>\z/
|
|
334
|
+
inner_type = Regexp.last_match[:inner_type]
|
|
335
|
+
value.map { |v| _deserialize(inner_type, v) }
|
|
336
|
+
when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
|
|
337
|
+
k_type = Regexp.last_match[:k_type]
|
|
338
|
+
v_type = Regexp.last_match[:v_type]
|
|
339
|
+
{}.tap do |hash|
|
|
340
|
+
value.each do |k, v|
|
|
341
|
+
hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
|
|
342
|
+
end
|
|
343
|
+
end
|
|
344
|
+
else # model
|
|
345
|
+
Shotstack.const_get(type).build_from_hash(value)
|
|
346
|
+
end
|
|
347
|
+
end
|
|
348
|
+
|
|
349
|
+
# Returns the string representation of the object
|
|
350
|
+
# @return [String] String presentation of the object
|
|
351
|
+
def to_s
|
|
352
|
+
to_hash.to_s
|
|
353
|
+
end
|
|
354
|
+
|
|
355
|
+
# to_body is an alias to to_hash (backward compatibility)
|
|
356
|
+
# @return [Hash] Returns the object in the form of hash
|
|
357
|
+
def to_body
|
|
358
|
+
to_hash
|
|
359
|
+
end
|
|
360
|
+
|
|
361
|
+
# Returns the object in the form of hash
|
|
362
|
+
# @return [Hash] Returns the object in the form of hash
|
|
363
|
+
def to_hash
|
|
364
|
+
hash = {}
|
|
365
|
+
self.class.attribute_map.each_pair do |attr, param|
|
|
366
|
+
value = self.send(attr)
|
|
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
|
+
|
|
372
|
+
hash[param] = _to_hash(value)
|
|
373
|
+
end
|
|
374
|
+
hash
|
|
375
|
+
end
|
|
376
|
+
|
|
377
|
+
# Outputs non-array value in the form of hash
|
|
378
|
+
# For object, use to_hash. Otherwise, just return the value
|
|
379
|
+
# @param [Object] value Any valid value
|
|
380
|
+
# @return [Hash] Returns the value in the form of hash
|
|
381
|
+
def _to_hash(value)
|
|
382
|
+
if value.is_a?(Array)
|
|
383
|
+
value.compact.map { |v| _to_hash(v) }
|
|
384
|
+
elsif value.is_a?(Hash)
|
|
385
|
+
{}.tap do |hash|
|
|
386
|
+
value.each { |k, v| hash[k] = _to_hash(v) }
|
|
387
|
+
end
|
|
388
|
+
elsif value.respond_to? :to_hash
|
|
389
|
+
value.to_hash
|
|
390
|
+
else
|
|
391
|
+
value
|
|
392
|
+
end
|
|
393
|
+
end
|
|
394
|
+
end
|
|
395
|
+
end
|
|
@@ -1,87 +1,155 @@
|
|
|
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
|
+
|
|
1
13
|
require 'date'
|
|
2
14
|
|
|
3
15
|
module Shotstack
|
|
4
|
-
#
|
|
16
|
+
# An edit defines the content of the video in a timeline and the output format.
|
|
5
17
|
class Edit
|
|
18
|
+
attr_accessor :timeline
|
|
19
|
+
|
|
6
20
|
attr_accessor :output
|
|
7
21
|
|
|
8
|
-
|
|
22
|
+
# An optional webhook callback URL used to receive status notifications when a render completes or fails.
|
|
23
|
+
attr_accessor :callback
|
|
9
24
|
|
|
10
25
|
# Attribute mapping from ruby-style variable name to JSON key.
|
|
11
26
|
def self.attribute_map
|
|
12
27
|
{
|
|
13
|
-
|
|
28
|
+
:'timeline' => :'timeline',
|
|
14
29
|
:'output' => :'output',
|
|
15
|
-
|
|
16
|
-
:'timeline' => :'timeline'
|
|
17
|
-
|
|
30
|
+
:'callback' => :'callback'
|
|
18
31
|
}
|
|
19
32
|
end
|
|
20
33
|
|
|
21
34
|
# Attribute type mapping.
|
|
22
|
-
def self.
|
|
35
|
+
def self.openapi_types
|
|
23
36
|
{
|
|
37
|
+
:'timeline' => :'Timeline',
|
|
24
38
|
:'output' => :'Output',
|
|
25
|
-
:'
|
|
26
|
-
|
|
39
|
+
:'callback' => :'String'
|
|
27
40
|
}
|
|
28
41
|
end
|
|
29
42
|
|
|
43
|
+
# List of attributes with nullable: true
|
|
44
|
+
def self.openapi_nullable
|
|
45
|
+
Set.new([
|
|
46
|
+
])
|
|
47
|
+
end
|
|
48
|
+
|
|
49
|
+
# Initializes the object
|
|
50
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
|
30
51
|
def initialize(attributes = {})
|
|
31
|
-
|
|
52
|
+
if (!attributes.is_a?(Hash))
|
|
53
|
+
fail ArgumentError, "The input argument (attributes) must be a hash in `Shotstack::Edit` initialize method"
|
|
54
|
+
end
|
|
32
55
|
|
|
33
|
-
# convert string to symbol for hash key
|
|
34
|
-
attributes = attributes.
|
|
56
|
+
# check to see if the attribute exists and convert string to symbol for hash key
|
|
57
|
+
attributes = attributes.each_with_object({}) { |(k, v), h|
|
|
58
|
+
if (!self.class.attribute_map.key?(k.to_sym))
|
|
59
|
+
fail ArgumentError, "`#{k}` is not a valid attribute in `Shotstack::Edit`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
|
|
60
|
+
end
|
|
61
|
+
h[k.to_sym] = v
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
if attributes.key?(:'timeline')
|
|
65
|
+
self.timeline = attributes[:'timeline']
|
|
66
|
+
end
|
|
35
67
|
|
|
36
|
-
|
|
37
|
-
if attributes[:'output']
|
|
68
|
+
if attributes.key?(:'output')
|
|
38
69
|
self.output = attributes[:'output']
|
|
39
70
|
end
|
|
40
|
-
|
|
41
|
-
if attributes
|
|
42
|
-
self.
|
|
71
|
+
|
|
72
|
+
if attributes.key?(:'callback')
|
|
73
|
+
self.callback = attributes[:'callback']
|
|
74
|
+
end
|
|
75
|
+
end
|
|
76
|
+
|
|
77
|
+
# Show invalid properties with the reasons. Usually used together with valid?
|
|
78
|
+
# @return Array for valid properties with the reasons
|
|
79
|
+
def list_invalid_properties
|
|
80
|
+
invalid_properties = Array.new
|
|
81
|
+
if @timeline.nil?
|
|
82
|
+
invalid_properties.push('invalid value for "timeline", timeline cannot be nil.')
|
|
83
|
+
end
|
|
84
|
+
|
|
85
|
+
if @output.nil?
|
|
86
|
+
invalid_properties.push('invalid value for "output", output cannot be nil.')
|
|
43
87
|
end
|
|
44
|
-
|
|
88
|
+
|
|
89
|
+
invalid_properties
|
|
45
90
|
end
|
|
46
91
|
|
|
47
|
-
# Check
|
|
92
|
+
# Check to see if the all the properties in the model are valid
|
|
93
|
+
# @return true if the model is valid
|
|
94
|
+
def valid?
|
|
95
|
+
return false if @timeline.nil?
|
|
96
|
+
return false if @output.nil?
|
|
97
|
+
true
|
|
98
|
+
end
|
|
99
|
+
|
|
100
|
+
# Checks equality by comparing each attribute.
|
|
101
|
+
# @param [Object] Object to be compared
|
|
48
102
|
def ==(o)
|
|
49
103
|
return true if self.equal?(o)
|
|
50
104
|
self.class == o.class &&
|
|
105
|
+
timeline == o.timeline &&
|
|
51
106
|
output == o.output &&
|
|
52
|
-
|
|
107
|
+
callback == o.callback
|
|
53
108
|
end
|
|
54
109
|
|
|
55
110
|
# @see the `==` method
|
|
111
|
+
# @param [Object] Object to be compared
|
|
56
112
|
def eql?(o)
|
|
57
113
|
self == o
|
|
58
114
|
end
|
|
59
115
|
|
|
60
|
-
#
|
|
116
|
+
# Calculates hash code according to all attributes.
|
|
117
|
+
# @return [Integer] Hash code
|
|
61
118
|
def hash
|
|
62
|
-
[output,
|
|
119
|
+
[timeline, output, callback].hash
|
|
120
|
+
end
|
|
121
|
+
|
|
122
|
+
# Builds the object from hash
|
|
123
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
|
124
|
+
# @return [Object] Returns the model itself
|
|
125
|
+
def self.build_from_hash(attributes)
|
|
126
|
+
new.build_from_hash(attributes)
|
|
63
127
|
end
|
|
64
128
|
|
|
65
|
-
#
|
|
129
|
+
# Builds the object from hash
|
|
130
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
|
131
|
+
# @return [Object] Returns the model itself
|
|
66
132
|
def build_from_hash(attributes)
|
|
67
133
|
return nil unless attributes.is_a?(Hash)
|
|
68
|
-
self.class.
|
|
69
|
-
if type =~
|
|
134
|
+
self.class.openapi_types.each_pair do |key, type|
|
|
135
|
+
if type =~ /\AArray<(.*)>/i
|
|
136
|
+
# check to ensure the input is an array given that the attribute
|
|
137
|
+
# is documented as an array but the input is not
|
|
70
138
|
if attributes[self.class.attribute_map[key]].is_a?(Array)
|
|
71
|
-
self.send("#{key}=", attributes[self.class.attribute_map[key]].map{ |v| _deserialize($1, v) }
|
|
72
|
-
else
|
|
73
|
-
#TODO show warning in debug mode
|
|
139
|
+
self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
|
|
74
140
|
end
|
|
75
141
|
elsif !attributes[self.class.attribute_map[key]].nil?
|
|
76
142
|
self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
|
|
77
|
-
else
|
|
78
|
-
# data not found in attributes(hash), not an issue as the data can be optional
|
|
79
|
-
end
|
|
143
|
+
end # or else data not found in attributes(hash), not an issue as the data can be optional
|
|
80
144
|
end
|
|
81
145
|
|
|
82
146
|
self
|
|
83
147
|
end
|
|
84
148
|
|
|
149
|
+
# Deserializes the data based on type
|
|
150
|
+
# @param string type Data type
|
|
151
|
+
# @param string value Value to be deserialized
|
|
152
|
+
# @return [Object] Deserialized data
|
|
85
153
|
def _deserialize(type, value)
|
|
86
154
|
case type.to_sym
|
|
87
155
|
when :DateTime
|
|
@@ -94,16 +162,19 @@ module Shotstack
|
|
|
94
162
|
value.to_i
|
|
95
163
|
when :Float
|
|
96
164
|
value.to_f
|
|
97
|
-
when :
|
|
98
|
-
if value =~
|
|
165
|
+
when :Boolean
|
|
166
|
+
if value.to_s =~ /\A(true|t|yes|y|1)\z/i
|
|
99
167
|
true
|
|
100
168
|
else
|
|
101
169
|
false
|
|
102
170
|
end
|
|
171
|
+
when :Object
|
|
172
|
+
# generic object (usually a Hash), return directly
|
|
173
|
+
value
|
|
103
174
|
when /\AArray<(?<inner_type>.+)>\z/
|
|
104
175
|
inner_type = Regexp.last_match[:inner_type]
|
|
105
176
|
value.map { |v| _deserialize(inner_type, v) }
|
|
106
|
-
when /\AHash<(?<k_type
|
|
177
|
+
when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
|
|
107
178
|
k_type = Regexp.last_match[:k_type]
|
|
108
179
|
v_type = Regexp.last_match[:v_type]
|
|
109
180
|
{}.tap do |hash|
|
|
@@ -112,36 +183,45 @@ module Shotstack
|
|
|
112
183
|
end
|
|
113
184
|
end
|
|
114
185
|
else # model
|
|
115
|
-
|
|
116
|
-
_model.build_from_hash(value)
|
|
186
|
+
Shotstack.const_get(type).build_from_hash(value)
|
|
117
187
|
end
|
|
118
188
|
end
|
|
119
189
|
|
|
190
|
+
# Returns the string representation of the object
|
|
191
|
+
# @return [String] String presentation of the object
|
|
120
192
|
def to_s
|
|
121
193
|
to_hash.to_s
|
|
122
194
|
end
|
|
123
195
|
|
|
124
|
-
# to_body is an alias to
|
|
196
|
+
# to_body is an alias to to_hash (backward compatibility)
|
|
197
|
+
# @return [Hash] Returns the object in the form of hash
|
|
125
198
|
def to_body
|
|
126
199
|
to_hash
|
|
127
200
|
end
|
|
128
201
|
|
|
129
|
-
#
|
|
202
|
+
# Returns the object in the form of hash
|
|
203
|
+
# @return [Hash] Returns the object in the form of hash
|
|
130
204
|
def to_hash
|
|
131
205
|
hash = {}
|
|
132
206
|
self.class.attribute_map.each_pair do |attr, param|
|
|
133
207
|
value = self.send(attr)
|
|
134
|
-
|
|
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
|
+
|
|
135
213
|
hash[param] = _to_hash(value)
|
|
136
214
|
end
|
|
137
215
|
hash
|
|
138
216
|
end
|
|
139
217
|
|
|
140
|
-
#
|
|
218
|
+
# Outputs non-array value in the form of hash
|
|
141
219
|
# For object, use to_hash. Otherwise, just return the value
|
|
220
|
+
# @param [Object] value Any valid value
|
|
221
|
+
# @return [Hash] Returns the value in the form of hash
|
|
142
222
|
def _to_hash(value)
|
|
143
223
|
if value.is_a?(Array)
|
|
144
|
-
value.compact.map{ |v| _to_hash(v) }
|
|
224
|
+
value.compact.map { |v| _to_hash(v) }
|
|
145
225
|
elsif value.is_a?(Hash)
|
|
146
226
|
{}.tap do |hash|
|
|
147
227
|
value.each { |k, v| hash[k] = _to_hash(v) }
|
|
@@ -152,6 +232,5 @@ module Shotstack
|
|
|
152
232
|
value
|
|
153
233
|
end
|
|
154
234
|
end
|
|
155
|
-
|
|
156
235
|
end
|
|
157
236
|
end
|