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,354 @@
|
|
|
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
|
+
require_relative 'asset'
|
|
15
|
+
|
|
16
|
+
module Shotstack
|
|
17
|
+
# The TitleAsset clip type lets you create video titles from a text string and apply styling and positioning.
|
|
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 styling to the title.
|
|
26
|
+
attr_accessor :style
|
|
27
|
+
|
|
28
|
+
# Set the text color using hexadecimal color notation. Transparency is supported by setting the first two characters of the hex string (opposite to HTML), i.e. #80ffffff will be white with 50% transparency.
|
|
29
|
+
attr_accessor :color
|
|
30
|
+
|
|
31
|
+
# Set the relative size of the text using predefined sizes from xx-small to xx-large.
|
|
32
|
+
attr_accessor :size
|
|
33
|
+
|
|
34
|
+
# Apply a background color behind the text. Set the text color using hexadecimal color notation. Transparency is supported by setting the first two characters of the hex string (opposite to HTML), i.e. #80ffffff will be white with 50% transparency.
|
|
35
|
+
attr_accessor :background
|
|
36
|
+
|
|
37
|
+
# Place the title in one of nine predefined positions of the viewport.
|
|
38
|
+
attr_accessor :position
|
|
39
|
+
|
|
40
|
+
attr_accessor :offset
|
|
41
|
+
|
|
42
|
+
class EnumAttributeValidator
|
|
43
|
+
attr_reader :datatype
|
|
44
|
+
attr_reader :allowable_values
|
|
45
|
+
|
|
46
|
+
def initialize(datatype, allowable_values)
|
|
47
|
+
@allowable_values = allowable_values.map do |value|
|
|
48
|
+
case datatype.to_s
|
|
49
|
+
when /Integer/i
|
|
50
|
+
value.to_i
|
|
51
|
+
when /Float/i
|
|
52
|
+
value.to_f
|
|
53
|
+
else
|
|
54
|
+
value
|
|
55
|
+
end
|
|
56
|
+
end
|
|
57
|
+
end
|
|
58
|
+
|
|
59
|
+
def valid?(value)
|
|
60
|
+
!value || allowable_values.include?(value)
|
|
61
|
+
end
|
|
62
|
+
end
|
|
63
|
+
|
|
64
|
+
# Attribute mapping from ruby-style variable name to JSON key.
|
|
65
|
+
def self.attribute_map
|
|
66
|
+
{
|
|
67
|
+
:'type' => :'type',
|
|
68
|
+
:'text' => :'text',
|
|
69
|
+
:'style' => :'style',
|
|
70
|
+
:'color' => :'color',
|
|
71
|
+
:'size' => :'size',
|
|
72
|
+
:'background' => :'background',
|
|
73
|
+
:'position' => :'position',
|
|
74
|
+
:'offset' => :'offset'
|
|
75
|
+
}
|
|
76
|
+
end
|
|
77
|
+
|
|
78
|
+
# Attribute type mapping.
|
|
79
|
+
def self.openapi_types
|
|
80
|
+
{
|
|
81
|
+
:'type' => :'String',
|
|
82
|
+
:'text' => :'String',
|
|
83
|
+
:'style' => :'String',
|
|
84
|
+
:'color' => :'String',
|
|
85
|
+
:'size' => :'String',
|
|
86
|
+
:'background' => :'String',
|
|
87
|
+
:'position' => :'String',
|
|
88
|
+
:'offset' => :'Offset'
|
|
89
|
+
}
|
|
90
|
+
end
|
|
91
|
+
|
|
92
|
+
# List of attributes with nullable: true
|
|
93
|
+
def self.openapi_nullable
|
|
94
|
+
Set.new([
|
|
95
|
+
])
|
|
96
|
+
end
|
|
97
|
+
|
|
98
|
+
# Initializes the object
|
|
99
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
|
100
|
+
def initialize(attributes = {})
|
|
101
|
+
if (!attributes.is_a?(Hash))
|
|
102
|
+
fail ArgumentError, "The input argument (attributes) must be a hash in `Shotstack::TitleAsset` initialize method"
|
|
103
|
+
end
|
|
104
|
+
|
|
105
|
+
# check to see if the attribute exists and convert string to symbol for hash key
|
|
106
|
+
attributes = attributes.each_with_object({}) { |(k, v), h|
|
|
107
|
+
if (!self.class.attribute_map.key?(k.to_sym))
|
|
108
|
+
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
|
|
109
|
+
end
|
|
110
|
+
h[k.to_sym] = v
|
|
111
|
+
}
|
|
112
|
+
|
|
113
|
+
if attributes.key?(:'type')
|
|
114
|
+
self.type = attributes[:'type']
|
|
115
|
+
else
|
|
116
|
+
self.type = 'title'
|
|
117
|
+
end
|
|
118
|
+
|
|
119
|
+
if attributes.key?(:'text')
|
|
120
|
+
self.text = attributes[:'text']
|
|
121
|
+
end
|
|
122
|
+
|
|
123
|
+
if attributes.key?(:'style')
|
|
124
|
+
self.style = attributes[:'style']
|
|
125
|
+
end
|
|
126
|
+
|
|
127
|
+
if attributes.key?(:'color')
|
|
128
|
+
self.color = attributes[:'color']
|
|
129
|
+
else
|
|
130
|
+
self.color = '#ffffff'
|
|
131
|
+
end
|
|
132
|
+
|
|
133
|
+
if attributes.key?(:'size')
|
|
134
|
+
self.size = attributes[:'size']
|
|
135
|
+
else
|
|
136
|
+
self.size = 'medium'
|
|
137
|
+
end
|
|
138
|
+
|
|
139
|
+
if attributes.key?(:'background')
|
|
140
|
+
self.background = attributes[:'background']
|
|
141
|
+
end
|
|
142
|
+
|
|
143
|
+
if attributes.key?(:'position')
|
|
144
|
+
self.position = attributes[:'position']
|
|
145
|
+
else
|
|
146
|
+
self.position = 'center'
|
|
147
|
+
end
|
|
148
|
+
|
|
149
|
+
if attributes.key?(:'offset')
|
|
150
|
+
self.offset = attributes[:'offset']
|
|
151
|
+
end
|
|
152
|
+
end
|
|
153
|
+
|
|
154
|
+
# Show invalid properties with the reasons. Usually used together with valid?
|
|
155
|
+
# @return Array for valid properties with the reasons
|
|
156
|
+
def list_invalid_properties
|
|
157
|
+
invalid_properties = Array.new
|
|
158
|
+
if @type.nil?
|
|
159
|
+
invalid_properties.push('invalid value for "type", type cannot be nil.')
|
|
160
|
+
end
|
|
161
|
+
|
|
162
|
+
if @text.nil?
|
|
163
|
+
invalid_properties.push('invalid value for "text", text cannot be nil.')
|
|
164
|
+
end
|
|
165
|
+
|
|
166
|
+
invalid_properties
|
|
167
|
+
end
|
|
168
|
+
|
|
169
|
+
# Check to see if the all the properties in the model are valid
|
|
170
|
+
# @return true if the model is valid
|
|
171
|
+
def valid?
|
|
172
|
+
return false if @type.nil?
|
|
173
|
+
return false if @text.nil?
|
|
174
|
+
style_validator = EnumAttributeValidator.new('String', ["minimal", "blockbuster", "vogue", "sketchy", "skinny", "chunk", "chunkLight", "marker", "future", "subtitle"])
|
|
175
|
+
return false unless style_validator.valid?(@style)
|
|
176
|
+
size_validator = EnumAttributeValidator.new('String', ["xx-small", "x-small", "small", "medium", "large", "x-large", "xx-large"])
|
|
177
|
+
return false unless size_validator.valid?(@size)
|
|
178
|
+
position_validator = EnumAttributeValidator.new('String', ["top", "topRight", "right", "bottomRight", "bottom", "bottomLeft", "left", "topLeft", "center"])
|
|
179
|
+
return false unless position_validator.valid?(@position)
|
|
180
|
+
true
|
|
181
|
+
end
|
|
182
|
+
|
|
183
|
+
# Custom attribute writer method checking allowed values (enum).
|
|
184
|
+
# @param [Object] style Object to be assigned
|
|
185
|
+
def style=(style)
|
|
186
|
+
validator = EnumAttributeValidator.new('String', ["minimal", "blockbuster", "vogue", "sketchy", "skinny", "chunk", "chunkLight", "marker", "future", "subtitle"])
|
|
187
|
+
unless validator.valid?(style)
|
|
188
|
+
fail ArgumentError, "invalid value for \"style\", must be one of #{validator.allowable_values}."
|
|
189
|
+
end
|
|
190
|
+
@style = style
|
|
191
|
+
end
|
|
192
|
+
|
|
193
|
+
# Custom attribute writer method checking allowed values (enum).
|
|
194
|
+
# @param [Object] size Object to be assigned
|
|
195
|
+
def size=(size)
|
|
196
|
+
validator = EnumAttributeValidator.new('String', ["xx-small", "x-small", "small", "medium", "large", "x-large", "xx-large"])
|
|
197
|
+
unless validator.valid?(size)
|
|
198
|
+
fail ArgumentError, "invalid value for \"size\", must be one of #{validator.allowable_values}."
|
|
199
|
+
end
|
|
200
|
+
@size = size
|
|
201
|
+
end
|
|
202
|
+
|
|
203
|
+
# Custom attribute writer method checking allowed values (enum).
|
|
204
|
+
# @param [Object] position Object to be assigned
|
|
205
|
+
def position=(position)
|
|
206
|
+
validator = EnumAttributeValidator.new('String', ["top", "topRight", "right", "bottomRight", "bottom", "bottomLeft", "left", "topLeft", "center"])
|
|
207
|
+
unless validator.valid?(position)
|
|
208
|
+
fail ArgumentError, "invalid value for \"position\", must be one of #{validator.allowable_values}."
|
|
209
|
+
end
|
|
210
|
+
@position = position
|
|
211
|
+
end
|
|
212
|
+
|
|
213
|
+
# Checks equality by comparing each attribute.
|
|
214
|
+
# @param [Object] Object to be compared
|
|
215
|
+
def ==(o)
|
|
216
|
+
return true if self.equal?(o)
|
|
217
|
+
self.class == o.class &&
|
|
218
|
+
type == o.type &&
|
|
219
|
+
text == o.text &&
|
|
220
|
+
style == o.style &&
|
|
221
|
+
color == o.color &&
|
|
222
|
+
size == o.size &&
|
|
223
|
+
background == o.background &&
|
|
224
|
+
position == o.position &&
|
|
225
|
+
offset == o.offset
|
|
226
|
+
end
|
|
227
|
+
|
|
228
|
+
# @see the `==` method
|
|
229
|
+
# @param [Object] Object to be compared
|
|
230
|
+
def eql?(o)
|
|
231
|
+
self == o
|
|
232
|
+
end
|
|
233
|
+
|
|
234
|
+
# Calculates hash code according to all attributes.
|
|
235
|
+
# @return [Integer] Hash code
|
|
236
|
+
def hash
|
|
237
|
+
[type, text, style, color, size, background, position, offset].hash
|
|
238
|
+
end
|
|
239
|
+
|
|
240
|
+
# Builds the object from hash
|
|
241
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
|
242
|
+
# @return [Object] Returns the model itself
|
|
243
|
+
def self.build_from_hash(attributes)
|
|
244
|
+
new.build_from_hash(attributes)
|
|
245
|
+
end
|
|
246
|
+
|
|
247
|
+
# Builds the object from hash
|
|
248
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
|
249
|
+
# @return [Object] Returns the model itself
|
|
250
|
+
def build_from_hash(attributes)
|
|
251
|
+
return nil unless attributes.is_a?(Hash)
|
|
252
|
+
self.class.openapi_types.each_pair do |key, type|
|
|
253
|
+
if type =~ /\AArray<(.*)>/i
|
|
254
|
+
# check to ensure the input is an array given that the attribute
|
|
255
|
+
# is documented as an array but the input is not
|
|
256
|
+
if attributes[self.class.attribute_map[key]].is_a?(Array)
|
|
257
|
+
self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
|
|
258
|
+
end
|
|
259
|
+
elsif !attributes[self.class.attribute_map[key]].nil?
|
|
260
|
+
self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
|
|
261
|
+
end # or else data not found in attributes(hash), not an issue as the data can be optional
|
|
262
|
+
end
|
|
263
|
+
|
|
264
|
+
self
|
|
265
|
+
end
|
|
266
|
+
|
|
267
|
+
# Deserializes the data based on type
|
|
268
|
+
# @param string type Data type
|
|
269
|
+
# @param string value Value to be deserialized
|
|
270
|
+
# @return [Object] Deserialized data
|
|
271
|
+
def _deserialize(type, value)
|
|
272
|
+
case type.to_sym
|
|
273
|
+
when :DateTime
|
|
274
|
+
DateTime.parse(value)
|
|
275
|
+
when :Date
|
|
276
|
+
Date.parse(value)
|
|
277
|
+
when :String
|
|
278
|
+
value.to_s
|
|
279
|
+
when :Integer
|
|
280
|
+
value.to_i
|
|
281
|
+
when :Float
|
|
282
|
+
value.to_f
|
|
283
|
+
when :Boolean
|
|
284
|
+
if value.to_s =~ /\A(true|t|yes|y|1)\z/i
|
|
285
|
+
true
|
|
286
|
+
else
|
|
287
|
+
false
|
|
288
|
+
end
|
|
289
|
+
when :Object
|
|
290
|
+
# generic object (usually a Hash), return directly
|
|
291
|
+
value
|
|
292
|
+
when /\AArray<(?<inner_type>.+)>\z/
|
|
293
|
+
inner_type = Regexp.last_match[:inner_type]
|
|
294
|
+
value.map { |v| _deserialize(inner_type, v) }
|
|
295
|
+
when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
|
|
296
|
+
k_type = Regexp.last_match[:k_type]
|
|
297
|
+
v_type = Regexp.last_match[:v_type]
|
|
298
|
+
{}.tap do |hash|
|
|
299
|
+
value.each do |k, v|
|
|
300
|
+
hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
|
|
301
|
+
end
|
|
302
|
+
end
|
|
303
|
+
else # model
|
|
304
|
+
Shotstack.const_get(type).build_from_hash(value)
|
|
305
|
+
end
|
|
306
|
+
end
|
|
307
|
+
|
|
308
|
+
# Returns the string representation of the object
|
|
309
|
+
# @return [String] String presentation of the object
|
|
310
|
+
def to_s
|
|
311
|
+
to_hash.to_s
|
|
312
|
+
end
|
|
313
|
+
|
|
314
|
+
# to_body is an alias to to_hash (backward compatibility)
|
|
315
|
+
# @return [Hash] Returns the object in the form of hash
|
|
316
|
+
def to_body
|
|
317
|
+
to_hash
|
|
318
|
+
end
|
|
319
|
+
|
|
320
|
+
# Returns the object in the form of hash
|
|
321
|
+
# @return [Hash] Returns the object in the form of hash
|
|
322
|
+
def to_hash
|
|
323
|
+
hash = {}
|
|
324
|
+
self.class.attribute_map.each_pair do |attr, param|
|
|
325
|
+
value = self.send(attr)
|
|
326
|
+
if value.nil?
|
|
327
|
+
is_nullable = self.class.openapi_nullable.include?(attr)
|
|
328
|
+
next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
|
|
329
|
+
end
|
|
330
|
+
|
|
331
|
+
hash[param] = _to_hash(value)
|
|
332
|
+
end
|
|
333
|
+
hash
|
|
334
|
+
end
|
|
335
|
+
|
|
336
|
+
# Outputs non-array value in the form of hash
|
|
337
|
+
# For object, use to_hash. Otherwise, just return the value
|
|
338
|
+
# @param [Object] value Any valid value
|
|
339
|
+
# @return [Hash] Returns the value in the form of hash
|
|
340
|
+
def _to_hash(value)
|
|
341
|
+
if value.is_a?(Array)
|
|
342
|
+
value.compact.map { |v| _to_hash(v) }
|
|
343
|
+
elsif value.is_a?(Hash)
|
|
344
|
+
{}.tap do |hash|
|
|
345
|
+
value.each { |k, v| hash[k] = _to_hash(v) }
|
|
346
|
+
end
|
|
347
|
+
elsif value.respond_to? :to_hash
|
|
348
|
+
value.to_hash
|
|
349
|
+
else
|
|
350
|
+
value
|
|
351
|
+
end
|
|
352
|
+
end
|
|
353
|
+
end
|
|
354
|
+
end
|
|
@@ -1,43 +1,85 @@
|
|
|
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
|
+
# A track contains an array of clips. Tracks are layered on top of each other in the order in the array. The top most track will render on top of those below it.
|
|
5
17
|
class Track
|
|
18
|
+
# An array of Clips comprising of TitleClip, ImageClip or VideoClip.
|
|
6
19
|
attr_accessor :clips
|
|
7
20
|
|
|
8
21
|
# Attribute mapping from ruby-style variable name to JSON key.
|
|
9
22
|
def self.attribute_map
|
|
10
23
|
{
|
|
11
|
-
|
|
12
24
|
:'clips' => :'clips'
|
|
13
|
-
|
|
14
25
|
}
|
|
15
26
|
end
|
|
16
27
|
|
|
17
28
|
# Attribute type mapping.
|
|
18
|
-
def self.
|
|
29
|
+
def self.openapi_types
|
|
19
30
|
{
|
|
20
|
-
:'clips' => :'Array<
|
|
21
|
-
|
|
31
|
+
:'clips' => :'Array<Clip>'
|
|
22
32
|
}
|
|
23
33
|
end
|
|
24
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
|
|
25
43
|
def initialize(attributes = {})
|
|
26
|
-
|
|
44
|
+
if (!attributes.is_a?(Hash))
|
|
45
|
+
fail ArgumentError, "The input argument (attributes) must be a hash in `Shotstack::Track` initialize method"
|
|
46
|
+
end
|
|
27
47
|
|
|
28
|
-
# convert string to symbol for hash key
|
|
29
|
-
attributes = attributes.
|
|
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::Track`. 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
|
+
}
|
|
30
55
|
|
|
31
|
-
|
|
32
|
-
if attributes[:'clips']
|
|
56
|
+
if attributes.key?(:'clips')
|
|
33
57
|
if (value = attributes[:'clips']).is_a?(Array)
|
|
34
58
|
self.clips = value
|
|
35
59
|
end
|
|
36
60
|
end
|
|
37
|
-
|
|
38
61
|
end
|
|
39
62
|
|
|
40
|
-
#
|
|
63
|
+
# Show invalid properties with the reasons. Usually used together with valid?
|
|
64
|
+
# @return Array for valid properties with the reasons
|
|
65
|
+
def list_invalid_properties
|
|
66
|
+
invalid_properties = Array.new
|
|
67
|
+
if @clips.nil?
|
|
68
|
+
invalid_properties.push('invalid value for "clips", clips cannot be nil.')
|
|
69
|
+
end
|
|
70
|
+
|
|
71
|
+
invalid_properties
|
|
72
|
+
end
|
|
73
|
+
|
|
74
|
+
# Check to see if the all the properties in the model are valid
|
|
75
|
+
# @return true if the model is valid
|
|
76
|
+
def valid?
|
|
77
|
+
return false if @clips.nil?
|
|
78
|
+
true
|
|
79
|
+
end
|
|
80
|
+
|
|
81
|
+
# Checks equality by comparing each attribute.
|
|
82
|
+
# @param [Object] Object to be compared
|
|
41
83
|
def ==(o)
|
|
42
84
|
return true if self.equal?(o)
|
|
43
85
|
self.class == o.class &&
|
|
@@ -45,35 +87,48 @@ module Shotstack
|
|
|
45
87
|
end
|
|
46
88
|
|
|
47
89
|
# @see the `==` method
|
|
90
|
+
# @param [Object] Object to be compared
|
|
48
91
|
def eql?(o)
|
|
49
92
|
self == o
|
|
50
93
|
end
|
|
51
94
|
|
|
52
|
-
#
|
|
95
|
+
# Calculates hash code according to all attributes.
|
|
96
|
+
# @return [Integer] Hash code
|
|
53
97
|
def hash
|
|
54
98
|
[clips].hash
|
|
55
99
|
end
|
|
56
100
|
|
|
57
|
-
#
|
|
101
|
+
# Builds the object from hash
|
|
102
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
|
103
|
+
# @return [Object] Returns the model itself
|
|
104
|
+
def self.build_from_hash(attributes)
|
|
105
|
+
new.build_from_hash(attributes)
|
|
106
|
+
end
|
|
107
|
+
|
|
108
|
+
# Builds the object from hash
|
|
109
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
|
110
|
+
# @return [Object] Returns the model itself
|
|
58
111
|
def build_from_hash(attributes)
|
|
59
112
|
return nil unless attributes.is_a?(Hash)
|
|
60
|
-
self.class.
|
|
61
|
-
if type =~
|
|
113
|
+
self.class.openapi_types.each_pair do |key, type|
|
|
114
|
+
if type =~ /\AArray<(.*)>/i
|
|
115
|
+
# check to ensure the input is an array given that the attribute
|
|
116
|
+
# is documented as an array but the input is not
|
|
62
117
|
if attributes[self.class.attribute_map[key]].is_a?(Array)
|
|
63
|
-
self.send("#{key}=", attributes[self.class.attribute_map[key]].map{ |v| _deserialize($1, v) }
|
|
64
|
-
else
|
|
65
|
-
#TODO show warning in debug mode
|
|
118
|
+
self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
|
|
66
119
|
end
|
|
67
120
|
elsif !attributes[self.class.attribute_map[key]].nil?
|
|
68
121
|
self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
|
|
69
|
-
else
|
|
70
|
-
# data not found in attributes(hash), not an issue as the data can be optional
|
|
71
|
-
end
|
|
122
|
+
end # or else data not found in attributes(hash), not an issue as the data can be optional
|
|
72
123
|
end
|
|
73
124
|
|
|
74
125
|
self
|
|
75
126
|
end
|
|
76
127
|
|
|
128
|
+
# Deserializes the data based on type
|
|
129
|
+
# @param string type Data type
|
|
130
|
+
# @param string value Value to be deserialized
|
|
131
|
+
# @return [Object] Deserialized data
|
|
77
132
|
def _deserialize(type, value)
|
|
78
133
|
case type.to_sym
|
|
79
134
|
when :DateTime
|
|
@@ -86,16 +141,19 @@ module Shotstack
|
|
|
86
141
|
value.to_i
|
|
87
142
|
when :Float
|
|
88
143
|
value.to_f
|
|
89
|
-
when :
|
|
90
|
-
if value =~
|
|
144
|
+
when :Boolean
|
|
145
|
+
if value.to_s =~ /\A(true|t|yes|y|1)\z/i
|
|
91
146
|
true
|
|
92
147
|
else
|
|
93
148
|
false
|
|
94
149
|
end
|
|
150
|
+
when :Object
|
|
151
|
+
# generic object (usually a Hash), return directly
|
|
152
|
+
value
|
|
95
153
|
when /\AArray<(?<inner_type>.+)>\z/
|
|
96
154
|
inner_type = Regexp.last_match[:inner_type]
|
|
97
155
|
value.map { |v| _deserialize(inner_type, v) }
|
|
98
|
-
when /\AHash<(?<k_type
|
|
156
|
+
when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
|
|
99
157
|
k_type = Regexp.last_match[:k_type]
|
|
100
158
|
v_type = Regexp.last_match[:v_type]
|
|
101
159
|
{}.tap do |hash|
|
|
@@ -104,36 +162,45 @@ module Shotstack
|
|
|
104
162
|
end
|
|
105
163
|
end
|
|
106
164
|
else # model
|
|
107
|
-
|
|
108
|
-
_model.build_from_hash(value)
|
|
165
|
+
Shotstack.const_get(type).build_from_hash(value)
|
|
109
166
|
end
|
|
110
167
|
end
|
|
111
168
|
|
|
169
|
+
# Returns the string representation of the object
|
|
170
|
+
# @return [String] String presentation of the object
|
|
112
171
|
def to_s
|
|
113
172
|
to_hash.to_s
|
|
114
173
|
end
|
|
115
174
|
|
|
116
|
-
# to_body is an alias to
|
|
175
|
+
# to_body is an alias to to_hash (backward compatibility)
|
|
176
|
+
# @return [Hash] Returns the object in the form of hash
|
|
117
177
|
def to_body
|
|
118
178
|
to_hash
|
|
119
179
|
end
|
|
120
180
|
|
|
121
|
-
#
|
|
181
|
+
# Returns the object in the form of hash
|
|
182
|
+
# @return [Hash] Returns the object in the form of hash
|
|
122
183
|
def to_hash
|
|
123
184
|
hash = {}
|
|
124
185
|
self.class.attribute_map.each_pair do |attr, param|
|
|
125
186
|
value = self.send(attr)
|
|
126
|
-
|
|
187
|
+
if value.nil?
|
|
188
|
+
is_nullable = self.class.openapi_nullable.include?(attr)
|
|
189
|
+
next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
|
|
190
|
+
end
|
|
191
|
+
|
|
127
192
|
hash[param] = _to_hash(value)
|
|
128
193
|
end
|
|
129
194
|
hash
|
|
130
195
|
end
|
|
131
196
|
|
|
132
|
-
#
|
|
197
|
+
# Outputs non-array value in the form of hash
|
|
133
198
|
# For object, use to_hash. Otherwise, just return the value
|
|
199
|
+
# @param [Object] value Any valid value
|
|
200
|
+
# @return [Hash] Returns the value in the form of hash
|
|
134
201
|
def _to_hash(value)
|
|
135
202
|
if value.is_a?(Array)
|
|
136
|
-
value.compact.map{ |v| _to_hash(v) }
|
|
203
|
+
value.compact.map { |v| _to_hash(v) }
|
|
137
204
|
elsif value.is_a?(Hash)
|
|
138
205
|
{}.tap do |hash|
|
|
139
206
|
value.each { |k, v| hash[k] = _to_hash(v) }
|
|
@@ -144,6 +211,5 @@ module Shotstack
|
|
|
144
211
|
value
|
|
145
212
|
end
|
|
146
213
|
end
|
|
147
|
-
|
|
148
214
|
end
|
|
149
215
|
end
|