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
|
@@ -1,136 +1,249 @@
|
|
|
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
|
-
# Model for RenderResponseData
|
|
5
16
|
class RenderResponseData
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
attr_accessor :data
|
|
17
|
+
# The status of the render task
|
|
18
|
+
attr_accessor :status
|
|
9
19
|
|
|
20
|
+
# The id of the render task in UUID format
|
|
10
21
|
attr_accessor :id
|
|
11
22
|
|
|
23
|
+
# The owner id of the render task
|
|
12
24
|
attr_accessor :owner
|
|
13
25
|
|
|
14
|
-
|
|
26
|
+
# The URL of the final video. This will only be available if status is done.
|
|
27
|
+
attr_accessor :url
|
|
28
|
+
|
|
29
|
+
attr_accessor :data
|
|
15
30
|
|
|
31
|
+
# The time the render task was initially queued
|
|
32
|
+
attr_accessor :created
|
|
33
|
+
|
|
34
|
+
# The time the render status was last updated
|
|
16
35
|
attr_accessor :updated
|
|
17
36
|
|
|
37
|
+
class EnumAttributeValidator
|
|
38
|
+
attr_reader :datatype
|
|
39
|
+
attr_reader :allowable_values
|
|
40
|
+
|
|
41
|
+
def initialize(datatype, allowable_values)
|
|
42
|
+
@allowable_values = allowable_values.map do |value|
|
|
43
|
+
case datatype.to_s
|
|
44
|
+
when /Integer/i
|
|
45
|
+
value.to_i
|
|
46
|
+
when /Float/i
|
|
47
|
+
value.to_f
|
|
48
|
+
else
|
|
49
|
+
value
|
|
50
|
+
end
|
|
51
|
+
end
|
|
52
|
+
end
|
|
53
|
+
|
|
54
|
+
def valid?(value)
|
|
55
|
+
!value || allowable_values.include?(value)
|
|
56
|
+
end
|
|
57
|
+
end
|
|
58
|
+
|
|
18
59
|
# Attribute mapping from ruby-style variable name to JSON key.
|
|
19
60
|
def self.attribute_map
|
|
20
61
|
{
|
|
21
|
-
|
|
22
|
-
:'created' => :'created',
|
|
23
|
-
|
|
24
|
-
:'data' => :'data',
|
|
25
|
-
|
|
62
|
+
:'status' => :'status',
|
|
26
63
|
:'id' => :'id',
|
|
27
|
-
|
|
28
64
|
:'owner' => :'owner',
|
|
29
|
-
|
|
30
|
-
:'
|
|
31
|
-
|
|
65
|
+
:'url' => :'url',
|
|
66
|
+
:'data' => :'data',
|
|
67
|
+
:'created' => :'created',
|
|
32
68
|
:'updated' => :'updated'
|
|
33
|
-
|
|
34
69
|
}
|
|
35
70
|
end
|
|
36
71
|
|
|
37
72
|
# Attribute type mapping.
|
|
38
|
-
def self.
|
|
73
|
+
def self.openapi_types
|
|
39
74
|
{
|
|
40
|
-
:'
|
|
41
|
-
:'data' => :'Edit',
|
|
75
|
+
:'status' => :'String',
|
|
42
76
|
:'id' => :'String',
|
|
43
77
|
:'owner' => :'String',
|
|
44
|
-
:'
|
|
78
|
+
:'url' => :'String',
|
|
79
|
+
:'data' => :'Edit',
|
|
80
|
+
:'created' => :'String',
|
|
45
81
|
:'updated' => :'String'
|
|
46
|
-
|
|
47
82
|
}
|
|
48
83
|
end
|
|
49
84
|
|
|
85
|
+
# List of attributes with nullable: true
|
|
86
|
+
def self.openapi_nullable
|
|
87
|
+
Set.new([
|
|
88
|
+
])
|
|
89
|
+
end
|
|
90
|
+
|
|
91
|
+
# Initializes the object
|
|
92
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
|
50
93
|
def initialize(attributes = {})
|
|
51
|
-
|
|
94
|
+
if (!attributes.is_a?(Hash))
|
|
95
|
+
fail ArgumentError, "The input argument (attributes) must be a hash in `Shotstack::RenderResponseData` initialize method"
|
|
96
|
+
end
|
|
52
97
|
|
|
53
|
-
# convert string to symbol for hash key
|
|
54
|
-
attributes = attributes.
|
|
98
|
+
# check to see if the attribute exists and convert string to symbol for hash key
|
|
99
|
+
attributes = attributes.each_with_object({}) { |(k, v), h|
|
|
100
|
+
if (!self.class.attribute_map.key?(k.to_sym))
|
|
101
|
+
fail ArgumentError, "`#{k}` is not a valid attribute in `Shotstack::RenderResponseData`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
|
|
102
|
+
end
|
|
103
|
+
h[k.to_sym] = v
|
|
104
|
+
}
|
|
55
105
|
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
self.created = attributes[:'created']
|
|
59
|
-
end
|
|
60
|
-
|
|
61
|
-
if attributes[:'data']
|
|
62
|
-
self.data = attributes[:'data']
|
|
106
|
+
if attributes.key?(:'status')
|
|
107
|
+
self.status = attributes[:'status']
|
|
63
108
|
end
|
|
64
|
-
|
|
65
|
-
if attributes
|
|
109
|
+
|
|
110
|
+
if attributes.key?(:'id')
|
|
66
111
|
self.id = attributes[:'id']
|
|
67
112
|
end
|
|
68
|
-
|
|
69
|
-
if attributes
|
|
113
|
+
|
|
114
|
+
if attributes.key?(:'owner')
|
|
70
115
|
self.owner = attributes[:'owner']
|
|
71
116
|
end
|
|
72
|
-
|
|
73
|
-
if attributes
|
|
74
|
-
self.
|
|
117
|
+
|
|
118
|
+
if attributes.key?(:'url')
|
|
119
|
+
self.url = attributes[:'url']
|
|
120
|
+
end
|
|
121
|
+
|
|
122
|
+
if attributes.key?(:'data')
|
|
123
|
+
self.data = attributes[:'data']
|
|
75
124
|
end
|
|
76
|
-
|
|
77
|
-
if attributes
|
|
125
|
+
|
|
126
|
+
if attributes.key?(:'created')
|
|
127
|
+
self.created = attributes[:'created']
|
|
128
|
+
end
|
|
129
|
+
|
|
130
|
+
if attributes.key?(:'updated')
|
|
78
131
|
self.updated = attributes[:'updated']
|
|
79
132
|
end
|
|
80
|
-
|
|
133
|
+
end
|
|
134
|
+
|
|
135
|
+
# Show invalid properties with the reasons. Usually used together with valid?
|
|
136
|
+
# @return Array for valid properties with the reasons
|
|
137
|
+
def list_invalid_properties
|
|
138
|
+
invalid_properties = Array.new
|
|
139
|
+
if @status.nil?
|
|
140
|
+
invalid_properties.push('invalid value for "status", status cannot be nil.')
|
|
141
|
+
end
|
|
142
|
+
|
|
143
|
+
if @id.nil?
|
|
144
|
+
invalid_properties.push('invalid value for "id", id cannot be nil.')
|
|
145
|
+
end
|
|
146
|
+
|
|
147
|
+
if @owner.nil?
|
|
148
|
+
invalid_properties.push('invalid value for "owner", owner cannot be nil.')
|
|
149
|
+
end
|
|
150
|
+
|
|
151
|
+
if @data.nil?
|
|
152
|
+
invalid_properties.push('invalid value for "data", data cannot be nil.')
|
|
153
|
+
end
|
|
154
|
+
|
|
155
|
+
if @created.nil?
|
|
156
|
+
invalid_properties.push('invalid value for "created", created cannot be nil.')
|
|
157
|
+
end
|
|
158
|
+
|
|
159
|
+
if @updated.nil?
|
|
160
|
+
invalid_properties.push('invalid value for "updated", updated cannot be nil.')
|
|
161
|
+
end
|
|
162
|
+
|
|
163
|
+
invalid_properties
|
|
164
|
+
end
|
|
165
|
+
|
|
166
|
+
# Check to see if the all the properties in the model are valid
|
|
167
|
+
# @return true if the model is valid
|
|
168
|
+
def valid?
|
|
169
|
+
return false if @status.nil?
|
|
170
|
+
status_validator = EnumAttributeValidator.new('String', ["queued", "fetching", "rendering", "saving", "done", "failed"])
|
|
171
|
+
return false unless status_validator.valid?(@status)
|
|
172
|
+
return false if @id.nil?
|
|
173
|
+
return false if @owner.nil?
|
|
174
|
+
return false if @data.nil?
|
|
175
|
+
return false if @created.nil?
|
|
176
|
+
return false if @updated.nil?
|
|
177
|
+
true
|
|
81
178
|
end
|
|
82
179
|
|
|
83
180
|
# Custom attribute writer method checking allowed values (enum).
|
|
181
|
+
# @param [Object] status Object to be assigned
|
|
84
182
|
def status=(status)
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
fail "invalid value for
|
|
183
|
+
validator = EnumAttributeValidator.new('String', ["queued", "fetching", "rendering", "saving", "done", "failed"])
|
|
184
|
+
unless validator.valid?(status)
|
|
185
|
+
fail ArgumentError, "invalid value for \"status\", must be one of #{validator.allowable_values}."
|
|
88
186
|
end
|
|
89
187
|
@status = status
|
|
90
188
|
end
|
|
91
189
|
|
|
92
|
-
#
|
|
190
|
+
# Checks equality by comparing each attribute.
|
|
191
|
+
# @param [Object] Object to be compared
|
|
93
192
|
def ==(o)
|
|
94
193
|
return true if self.equal?(o)
|
|
95
194
|
self.class == o.class &&
|
|
96
|
-
|
|
97
|
-
data == o.data &&
|
|
195
|
+
status == o.status &&
|
|
98
196
|
id == o.id &&
|
|
99
197
|
owner == o.owner &&
|
|
100
|
-
|
|
198
|
+
url == o.url &&
|
|
199
|
+
data == o.data &&
|
|
200
|
+
created == o.created &&
|
|
101
201
|
updated == o.updated
|
|
102
202
|
end
|
|
103
203
|
|
|
104
204
|
# @see the `==` method
|
|
205
|
+
# @param [Object] Object to be compared
|
|
105
206
|
def eql?(o)
|
|
106
207
|
self == o
|
|
107
208
|
end
|
|
108
209
|
|
|
109
|
-
#
|
|
210
|
+
# Calculates hash code according to all attributes.
|
|
211
|
+
# @return [Integer] Hash code
|
|
110
212
|
def hash
|
|
111
|
-
[
|
|
213
|
+
[status, id, owner, url, data, created, updated].hash
|
|
214
|
+
end
|
|
215
|
+
|
|
216
|
+
# Builds the object from hash
|
|
217
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
|
218
|
+
# @return [Object] Returns the model itself
|
|
219
|
+
def self.build_from_hash(attributes)
|
|
220
|
+
new.build_from_hash(attributes)
|
|
112
221
|
end
|
|
113
222
|
|
|
114
|
-
#
|
|
223
|
+
# Builds the object from hash
|
|
224
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
|
225
|
+
# @return [Object] Returns the model itself
|
|
115
226
|
def build_from_hash(attributes)
|
|
116
227
|
return nil unless attributes.is_a?(Hash)
|
|
117
|
-
self.class.
|
|
118
|
-
if type =~
|
|
228
|
+
self.class.openapi_types.each_pair do |key, type|
|
|
229
|
+
if type =~ /\AArray<(.*)>/i
|
|
230
|
+
# check to ensure the input is an array given that the attribute
|
|
231
|
+
# is documented as an array but the input is not
|
|
119
232
|
if attributes[self.class.attribute_map[key]].is_a?(Array)
|
|
120
|
-
self.send("#{key}=", attributes[self.class.attribute_map[key]].map{ |v| _deserialize($1, v) }
|
|
121
|
-
else
|
|
122
|
-
#TODO show warning in debug mode
|
|
233
|
+
self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
|
|
123
234
|
end
|
|
124
235
|
elsif !attributes[self.class.attribute_map[key]].nil?
|
|
125
236
|
self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
|
|
126
|
-
else
|
|
127
|
-
# data not found in attributes(hash), not an issue as the data can be optional
|
|
128
|
-
end
|
|
237
|
+
end # or else data not found in attributes(hash), not an issue as the data can be optional
|
|
129
238
|
end
|
|
130
239
|
|
|
131
240
|
self
|
|
132
241
|
end
|
|
133
242
|
|
|
243
|
+
# Deserializes the data based on type
|
|
244
|
+
# @param string type Data type
|
|
245
|
+
# @param string value Value to be deserialized
|
|
246
|
+
# @return [Object] Deserialized data
|
|
134
247
|
def _deserialize(type, value)
|
|
135
248
|
case type.to_sym
|
|
136
249
|
when :DateTime
|
|
@@ -143,16 +256,19 @@ module Shotstack
|
|
|
143
256
|
value.to_i
|
|
144
257
|
when :Float
|
|
145
258
|
value.to_f
|
|
146
|
-
when :
|
|
147
|
-
if value =~
|
|
259
|
+
when :Boolean
|
|
260
|
+
if value.to_s =~ /\A(true|t|yes|y|1)\z/i
|
|
148
261
|
true
|
|
149
262
|
else
|
|
150
263
|
false
|
|
151
264
|
end
|
|
265
|
+
when :Object
|
|
266
|
+
# generic object (usually a Hash), return directly
|
|
267
|
+
value
|
|
152
268
|
when /\AArray<(?<inner_type>.+)>\z/
|
|
153
269
|
inner_type = Regexp.last_match[:inner_type]
|
|
154
270
|
value.map { |v| _deserialize(inner_type, v) }
|
|
155
|
-
when /\AHash<(?<k_type
|
|
271
|
+
when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
|
|
156
272
|
k_type = Regexp.last_match[:k_type]
|
|
157
273
|
v_type = Regexp.last_match[:v_type]
|
|
158
274
|
{}.tap do |hash|
|
|
@@ -161,36 +277,45 @@ module Shotstack
|
|
|
161
277
|
end
|
|
162
278
|
end
|
|
163
279
|
else # model
|
|
164
|
-
|
|
165
|
-
_model.build_from_hash(value)
|
|
280
|
+
Shotstack.const_get(type).build_from_hash(value)
|
|
166
281
|
end
|
|
167
282
|
end
|
|
168
283
|
|
|
284
|
+
# Returns the string representation of the object
|
|
285
|
+
# @return [String] String presentation of the object
|
|
169
286
|
def to_s
|
|
170
287
|
to_hash.to_s
|
|
171
288
|
end
|
|
172
289
|
|
|
173
|
-
# to_body is an alias to
|
|
290
|
+
# to_body is an alias to to_hash (backward compatibility)
|
|
291
|
+
# @return [Hash] Returns the object in the form of hash
|
|
174
292
|
def to_body
|
|
175
293
|
to_hash
|
|
176
294
|
end
|
|
177
295
|
|
|
178
|
-
#
|
|
296
|
+
# Returns the object in the form of hash
|
|
297
|
+
# @return [Hash] Returns the object in the form of hash
|
|
179
298
|
def to_hash
|
|
180
299
|
hash = {}
|
|
181
300
|
self.class.attribute_map.each_pair do |attr, param|
|
|
182
301
|
value = self.send(attr)
|
|
183
|
-
|
|
302
|
+
if value.nil?
|
|
303
|
+
is_nullable = self.class.openapi_nullable.include?(attr)
|
|
304
|
+
next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
|
|
305
|
+
end
|
|
306
|
+
|
|
184
307
|
hash[param] = _to_hash(value)
|
|
185
308
|
end
|
|
186
309
|
hash
|
|
187
310
|
end
|
|
188
311
|
|
|
189
|
-
#
|
|
312
|
+
# Outputs non-array value in the form of hash
|
|
190
313
|
# For object, use to_hash. Otherwise, just return the value
|
|
314
|
+
# @param [Object] value Any valid value
|
|
315
|
+
# @return [Hash] Returns the value in the form of hash
|
|
191
316
|
def _to_hash(value)
|
|
192
317
|
if value.is_a?(Array)
|
|
193
|
-
value.compact.map{ |v| _to_hash(v) }
|
|
318
|
+
value.compact.map { |v| _to_hash(v) }
|
|
194
319
|
elsif value.is_a?(Hash)
|
|
195
320
|
{}.tap do |hash|
|
|
196
321
|
value.each { |k, v| hash[k] = _to_hash(v) }
|
|
@@ -201,6 +326,5 @@ module Shotstack
|
|
|
201
326
|
value
|
|
202
327
|
end
|
|
203
328
|
end
|
|
204
|
-
|
|
205
329
|
end
|
|
206
330
|
end
|
|
@@ -1,87 +1,186 @@
|
|
|
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 music or audio file in mp3 format that plays for the duration of the rendered video or the length of the audio file, which ever is shortest.
|
|
5
17
|
class Soundtrack
|
|
18
|
+
# The URL of the mp3 audio file. The URL must be publicly accessible or include credentials.
|
|
19
|
+
attr_accessor :src
|
|
20
|
+
|
|
21
|
+
# The effect to apply to the audio file
|
|
6
22
|
attr_accessor :effect
|
|
7
23
|
|
|
8
|
-
|
|
24
|
+
# Set the volume for the soundtrack between 0 and 1 where 0 is muted and 1 is full volume (defaults to 1).
|
|
25
|
+
attr_accessor :volume
|
|
26
|
+
|
|
27
|
+
class EnumAttributeValidator
|
|
28
|
+
attr_reader :datatype
|
|
29
|
+
attr_reader :allowable_values
|
|
30
|
+
|
|
31
|
+
def initialize(datatype, allowable_values)
|
|
32
|
+
@allowable_values = allowable_values.map do |value|
|
|
33
|
+
case datatype.to_s
|
|
34
|
+
when /Integer/i
|
|
35
|
+
value.to_i
|
|
36
|
+
when /Float/i
|
|
37
|
+
value.to_f
|
|
38
|
+
else
|
|
39
|
+
value
|
|
40
|
+
end
|
|
41
|
+
end
|
|
42
|
+
end
|
|
43
|
+
|
|
44
|
+
def valid?(value)
|
|
45
|
+
!value || allowable_values.include?(value)
|
|
46
|
+
end
|
|
47
|
+
end
|
|
9
48
|
|
|
10
49
|
# Attribute mapping from ruby-style variable name to JSON key.
|
|
11
50
|
def self.attribute_map
|
|
12
51
|
{
|
|
13
|
-
|
|
52
|
+
:'src' => :'src',
|
|
14
53
|
:'effect' => :'effect',
|
|
15
|
-
|
|
16
|
-
:'src' => :'src'
|
|
17
|
-
|
|
54
|
+
:'volume' => :'volume'
|
|
18
55
|
}
|
|
19
56
|
end
|
|
20
57
|
|
|
21
58
|
# Attribute type mapping.
|
|
22
|
-
def self.
|
|
59
|
+
def self.openapi_types
|
|
23
60
|
{
|
|
61
|
+
:'src' => :'String',
|
|
24
62
|
:'effect' => :'String',
|
|
25
|
-
:'
|
|
26
|
-
|
|
63
|
+
:'volume' => :'Float'
|
|
27
64
|
}
|
|
28
65
|
end
|
|
29
66
|
|
|
67
|
+
# List of attributes with nullable: true
|
|
68
|
+
def self.openapi_nullable
|
|
69
|
+
Set.new([
|
|
70
|
+
])
|
|
71
|
+
end
|
|
72
|
+
|
|
73
|
+
# Initializes the object
|
|
74
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
|
30
75
|
def initialize(attributes = {})
|
|
31
|
-
|
|
76
|
+
if (!attributes.is_a?(Hash))
|
|
77
|
+
fail ArgumentError, "The input argument (attributes) must be a hash in `Shotstack::Soundtrack` initialize method"
|
|
78
|
+
end
|
|
32
79
|
|
|
33
|
-
# convert string to symbol for hash key
|
|
34
|
-
attributes = attributes.
|
|
80
|
+
# check to see if the attribute exists and convert string to symbol for hash key
|
|
81
|
+
attributes = attributes.each_with_object({}) { |(k, v), h|
|
|
82
|
+
if (!self.class.attribute_map.key?(k.to_sym))
|
|
83
|
+
fail ArgumentError, "`#{k}` is not a valid attribute in `Shotstack::Soundtrack`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
|
|
84
|
+
end
|
|
85
|
+
h[k.to_sym] = v
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
if attributes.key?(:'src')
|
|
89
|
+
self.src = attributes[:'src']
|
|
90
|
+
end
|
|
35
91
|
|
|
36
|
-
|
|
37
|
-
if attributes[:'effect']
|
|
92
|
+
if attributes.key?(:'effect')
|
|
38
93
|
self.effect = attributes[:'effect']
|
|
39
94
|
end
|
|
40
|
-
|
|
41
|
-
if attributes
|
|
42
|
-
self.
|
|
95
|
+
|
|
96
|
+
if attributes.key?(:'volume')
|
|
97
|
+
self.volume = attributes[:'volume']
|
|
98
|
+
end
|
|
99
|
+
end
|
|
100
|
+
|
|
101
|
+
# Show invalid properties with the reasons. Usually used together with valid?
|
|
102
|
+
# @return Array for valid properties with the reasons
|
|
103
|
+
def list_invalid_properties
|
|
104
|
+
invalid_properties = Array.new
|
|
105
|
+
if @src.nil?
|
|
106
|
+
invalid_properties.push('invalid value for "src", src cannot be nil.')
|
|
107
|
+
end
|
|
108
|
+
|
|
109
|
+
invalid_properties
|
|
110
|
+
end
|
|
111
|
+
|
|
112
|
+
# Check to see if the all the properties in the model are valid
|
|
113
|
+
# @return true if the model is valid
|
|
114
|
+
def valid?
|
|
115
|
+
return false if @src.nil?
|
|
116
|
+
effect_validator = EnumAttributeValidator.new('String', ["fadeIn", "fadeOut", "fadeInFadeOut"])
|
|
117
|
+
return false unless effect_validator.valid?(@effect)
|
|
118
|
+
true
|
|
119
|
+
end
|
|
120
|
+
|
|
121
|
+
# Custom attribute writer method checking allowed values (enum).
|
|
122
|
+
# @param [Object] effect Object to be assigned
|
|
123
|
+
def effect=(effect)
|
|
124
|
+
validator = EnumAttributeValidator.new('String', ["fadeIn", "fadeOut", "fadeInFadeOut"])
|
|
125
|
+
unless validator.valid?(effect)
|
|
126
|
+
fail ArgumentError, "invalid value for \"effect\", must be one of #{validator.allowable_values}."
|
|
43
127
|
end
|
|
44
|
-
|
|
128
|
+
@effect = effect
|
|
45
129
|
end
|
|
46
130
|
|
|
47
|
-
#
|
|
131
|
+
# Checks equality by comparing each attribute.
|
|
132
|
+
# @param [Object] Object to be compared
|
|
48
133
|
def ==(o)
|
|
49
134
|
return true if self.equal?(o)
|
|
50
135
|
self.class == o.class &&
|
|
136
|
+
src == o.src &&
|
|
51
137
|
effect == o.effect &&
|
|
52
|
-
|
|
138
|
+
volume == o.volume
|
|
53
139
|
end
|
|
54
140
|
|
|
55
141
|
# @see the `==` method
|
|
142
|
+
# @param [Object] Object to be compared
|
|
56
143
|
def eql?(o)
|
|
57
144
|
self == o
|
|
58
145
|
end
|
|
59
146
|
|
|
60
|
-
#
|
|
147
|
+
# Calculates hash code according to all attributes.
|
|
148
|
+
# @return [Integer] Hash code
|
|
61
149
|
def hash
|
|
62
|
-
[effect,
|
|
150
|
+
[src, effect, volume].hash
|
|
63
151
|
end
|
|
64
152
|
|
|
65
|
-
#
|
|
153
|
+
# Builds the object from hash
|
|
154
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
|
155
|
+
# @return [Object] Returns the model itself
|
|
156
|
+
def self.build_from_hash(attributes)
|
|
157
|
+
new.build_from_hash(attributes)
|
|
158
|
+
end
|
|
159
|
+
|
|
160
|
+
# Builds the object from hash
|
|
161
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
|
162
|
+
# @return [Object] Returns the model itself
|
|
66
163
|
def build_from_hash(attributes)
|
|
67
164
|
return nil unless attributes.is_a?(Hash)
|
|
68
|
-
self.class.
|
|
69
|
-
if type =~
|
|
165
|
+
self.class.openapi_types.each_pair do |key, type|
|
|
166
|
+
if type =~ /\AArray<(.*)>/i
|
|
167
|
+
# check to ensure the input is an array given that the attribute
|
|
168
|
+
# is documented as an array but the input is not
|
|
70
169
|
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
|
|
170
|
+
self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
|
|
74
171
|
end
|
|
75
172
|
elsif !attributes[self.class.attribute_map[key]].nil?
|
|
76
173
|
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
|
|
174
|
+
end # or else data not found in attributes(hash), not an issue as the data can be optional
|
|
80
175
|
end
|
|
81
176
|
|
|
82
177
|
self
|
|
83
178
|
end
|
|
84
179
|
|
|
180
|
+
# Deserializes the data based on type
|
|
181
|
+
# @param string type Data type
|
|
182
|
+
# @param string value Value to be deserialized
|
|
183
|
+
# @return [Object] Deserialized data
|
|
85
184
|
def _deserialize(type, value)
|
|
86
185
|
case type.to_sym
|
|
87
186
|
when :DateTime
|
|
@@ -94,16 +193,19 @@ module Shotstack
|
|
|
94
193
|
value.to_i
|
|
95
194
|
when :Float
|
|
96
195
|
value.to_f
|
|
97
|
-
when :
|
|
98
|
-
if value =~
|
|
196
|
+
when :Boolean
|
|
197
|
+
if value.to_s =~ /\A(true|t|yes|y|1)\z/i
|
|
99
198
|
true
|
|
100
199
|
else
|
|
101
200
|
false
|
|
102
201
|
end
|
|
202
|
+
when :Object
|
|
203
|
+
# generic object (usually a Hash), return directly
|
|
204
|
+
value
|
|
103
205
|
when /\AArray<(?<inner_type>.+)>\z/
|
|
104
206
|
inner_type = Regexp.last_match[:inner_type]
|
|
105
207
|
value.map { |v| _deserialize(inner_type, v) }
|
|
106
|
-
when /\AHash<(?<k_type
|
|
208
|
+
when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
|
|
107
209
|
k_type = Regexp.last_match[:k_type]
|
|
108
210
|
v_type = Regexp.last_match[:v_type]
|
|
109
211
|
{}.tap do |hash|
|
|
@@ -112,36 +214,45 @@ module Shotstack
|
|
|
112
214
|
end
|
|
113
215
|
end
|
|
114
216
|
else # model
|
|
115
|
-
|
|
116
|
-
_model.build_from_hash(value)
|
|
217
|
+
Shotstack.const_get(type).build_from_hash(value)
|
|
117
218
|
end
|
|
118
219
|
end
|
|
119
220
|
|
|
221
|
+
# Returns the string representation of the object
|
|
222
|
+
# @return [String] String presentation of the object
|
|
120
223
|
def to_s
|
|
121
224
|
to_hash.to_s
|
|
122
225
|
end
|
|
123
226
|
|
|
124
|
-
# to_body is an alias to
|
|
227
|
+
# to_body is an alias to to_hash (backward compatibility)
|
|
228
|
+
# @return [Hash] Returns the object in the form of hash
|
|
125
229
|
def to_body
|
|
126
230
|
to_hash
|
|
127
231
|
end
|
|
128
232
|
|
|
129
|
-
#
|
|
233
|
+
# Returns the object in the form of hash
|
|
234
|
+
# @return [Hash] Returns the object in the form of hash
|
|
130
235
|
def to_hash
|
|
131
236
|
hash = {}
|
|
132
237
|
self.class.attribute_map.each_pair do |attr, param|
|
|
133
238
|
value = self.send(attr)
|
|
134
|
-
|
|
239
|
+
if value.nil?
|
|
240
|
+
is_nullable = self.class.openapi_nullable.include?(attr)
|
|
241
|
+
next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
|
|
242
|
+
end
|
|
243
|
+
|
|
135
244
|
hash[param] = _to_hash(value)
|
|
136
245
|
end
|
|
137
246
|
hash
|
|
138
247
|
end
|
|
139
248
|
|
|
140
|
-
#
|
|
249
|
+
# Outputs non-array value in the form of hash
|
|
141
250
|
# For object, use to_hash. Otherwise, just return the value
|
|
251
|
+
# @param [Object] value Any valid value
|
|
252
|
+
# @return [Hash] Returns the value in the form of hash
|
|
142
253
|
def _to_hash(value)
|
|
143
254
|
if value.is_a?(Array)
|
|
144
|
-
value.compact.map{ |v| _to_hash(v) }
|
|
255
|
+
value.compact.map { |v| _to_hash(v) }
|
|
145
256
|
elsif value.is_a?(Hash)
|
|
146
257
|
{}.tap do |hash|
|
|
147
258
|
value.each { |k, v| hash[k] = _to_hash(v) }
|
|
@@ -152,6 +263,5 @@ module Shotstack
|
|
|
152
263
|
value
|
|
153
264
|
end
|
|
154
265
|
end
|
|
155
|
-
|
|
156
266
|
end
|
|
157
267
|
end
|