shotstack 0.2.2 → 0.2.6
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile +9 -0
- data/Rakefile +10 -0
- data/lib/shotstack/api/create_api.rb +158 -0
- data/lib/shotstack/api/edit_api.rb +20 -20
- data/lib/shotstack/api/ingest_api.rb +338 -0
- data/lib/shotstack/api/serve_api.rb +76 -8
- data/lib/shotstack/api_client.rb +28 -24
- data/lib/shotstack/api_error.rb +3 -2
- data/lib/shotstack/configuration.rb +55 -9
- data/lib/shotstack/models/asset.rb +3 -3
- data/lib/shotstack/models/asset_render_response.rb +18 -20
- data/lib/shotstack/models/asset_response.rb +18 -20
- data/lib/shotstack/models/asset_response_attributes.rb +23 -21
- data/lib/shotstack/models/asset_response_data.rb +20 -20
- data/lib/shotstack/models/audio_asset.rb +57 -21
- data/lib/shotstack/models/audio_enhancement.rb +43 -0
- data/lib/shotstack/models/clip.rb +27 -25
- data/lib/shotstack/models/crop.rb +40 -28
- data/lib/shotstack/models/destinations.rb +78 -243
- data/lib/shotstack/models/did_generated_asset.rb +273 -0
- data/lib/shotstack/models/did_generated_asset_options.rb +54 -0
- data/lib/shotstack/models/did_text_to_avatar_options.rb +313 -0
- data/lib/shotstack/models/dolby_enhancement.rb +239 -0
- data/lib/shotstack/models/dolby_enhancement_options.rb +257 -0
- data/lib/shotstack/models/edit.rb +22 -22
- data/lib/shotstack/models/eleven_labs_generated_asset.rb +273 -0
- data/lib/shotstack/models/eleven_labs_generated_asset_options.rb +54 -0
- data/lib/shotstack/models/eleven_labs_text_to_speech_options.rb +303 -0
- data/lib/shotstack/models/enhancements.rb +215 -0
- data/lib/shotstack/models/flip_transformation.rb +16 -20
- data/lib/shotstack/models/font.rb +18 -20
- data/lib/shotstack/models/generated_asset.rb +48 -0
- data/lib/shotstack/models/generated_asset_error_response.rb +225 -0
- data/lib/shotstack/models/generated_asset_error_response_data.rb +257 -0
- data/lib/shotstack/models/generated_asset_response.rb +222 -0
- data/lib/shotstack/models/generated_asset_response_attributes.rb +376 -0
- data/lib/shotstack/models/generated_asset_response_data.rb +256 -0
- data/lib/shotstack/models/google_cloud_storage_destination.rb +232 -0
- data/lib/shotstack/models/google_cloud_storage_destination_options.rb +243 -0
- data/lib/shotstack/models/google_drive_destination.rb +239 -0
- data/lib/shotstack/models/google_drive_destination_options.rb +233 -0
- data/lib/shotstack/models/hey_gen_generated_asset.rb +273 -0
- data/lib/shotstack/models/hey_gen_generated_asset_options.rb +54 -0
- data/lib/shotstack/models/hey_gen_text_to_avatar_options.rb +396 -0
- data/lib/shotstack/models/html_asset.rb +20 -22
- data/lib/shotstack/models/image_asset.rb +18 -20
- data/lib/shotstack/models/ingest_error_response.rb +225 -0
- data/lib/shotstack/models/ingest_error_response_data.rb +257 -0
- data/lib/shotstack/models/luma_asset.rb +18 -20
- data/lib/shotstack/models/merge_field.rb +20 -20
- data/lib/shotstack/models/mux_destination.rb +18 -22
- data/lib/shotstack/models/mux_destination_options.rb +50 -25
- data/lib/shotstack/models/offset.rb +28 -24
- data/lib/shotstack/models/open_ai_generated_asset.rb +273 -0
- data/lib/shotstack/models/open_ai_generated_asset_options.rb +54 -0
- data/lib/shotstack/models/open_ai_text_generator_options.rb +313 -0
- data/lib/shotstack/models/output.rb +27 -29
- data/lib/shotstack/models/outputs.rb +227 -0
- data/lib/shotstack/models/outputs_response.rb +218 -0
- data/lib/shotstack/models/poster.rb +18 -20
- data/lib/shotstack/models/probe_response.rb +22 -20
- data/lib/shotstack/models/queued_response.rb +22 -20
- data/lib/shotstack/models/queued_response_data.rb +20 -20
- data/lib/shotstack/models/queued_source_response.rb +222 -0
- data/lib/shotstack/models/queued_source_response_data.rb +240 -0
- data/lib/shotstack/models/range.rb +26 -22
- data/lib/shotstack/models/render_response.rb +22 -20
- data/lib/shotstack/models/render_response_data.rb +22 -20
- data/lib/shotstack/models/rendition.rb +429 -0
- data/lib/shotstack/models/rendition_response_attributes.rb +336 -0
- data/lib/shotstack/models/rotate_transformation.rb +16 -20
- data/lib/shotstack/models/s3_destination.rb +18 -22
- data/lib/shotstack/models/s3_destination_options.rb +21 -21
- data/lib/shotstack/models/shotstack_destination.rb +19 -23
- data/lib/shotstack/models/shotstack_generated_asset.rb +273 -0
- data/lib/shotstack/models/shotstack_generated_asset_options.rb +60 -0
- data/lib/shotstack/models/shotstack_image_to_video_options.rb +298 -0
- data/lib/shotstack/models/shotstack_text_generator_options.rb +274 -0
- data/lib/shotstack/models/shotstack_text_to_image_options.rb +308 -0
- data/lib/shotstack/models/shotstack_text_to_speech_options.rb +339 -0
- data/lib/shotstack/models/size.rb +36 -32
- data/lib/shotstack/models/skew_transformation.rb +16 -20
- data/lib/shotstack/models/soundtrack.rb +18 -20
- data/lib/shotstack/models/source.rb +244 -0
- data/lib/shotstack/models/source_list_response.rb +225 -0
- data/lib/shotstack/models/source_response.rb +222 -0
- data/lib/shotstack/models/source_response_attributes.rb +373 -0
- data/lib/shotstack/models/source_response_data.rb +256 -0
- data/lib/shotstack/models/speed.rb +254 -0
- data/lib/shotstack/models/stability_ai_generated_asset.rb +273 -0
- data/lib/shotstack/models/stability_ai_generated_asset_options.rb +54 -0
- data/lib/shotstack/models/stability_ai_text_to_image_options.rb +390 -0
- data/lib/shotstack/models/template.rb +18 -20
- data/lib/shotstack/models/template_data_response.rb +23 -21
- data/lib/shotstack/models/template_data_response_data.rb +24 -20
- data/lib/shotstack/models/template_list_response.rb +24 -22
- data/lib/shotstack/models/template_list_response_data.rb +20 -20
- data/lib/shotstack/models/template_list_response_item.rb +20 -20
- data/lib/shotstack/models/template_render.rb +18 -20
- data/lib/shotstack/models/template_response.rb +22 -20
- data/lib/shotstack/models/template_response_data.rb +20 -20
- data/lib/shotstack/models/thumbnail.rb +20 -20
- data/lib/shotstack/models/timeline.rb +19 -21
- data/lib/shotstack/models/title_asset.rb +18 -20
- data/lib/shotstack/models/track.rb +18 -20
- data/lib/shotstack/models/transcription.rb +250 -0
- data/lib/shotstack/models/transfer.rb +259 -0
- data/lib/shotstack/models/transfer_response.rb +222 -0
- data/lib/shotstack/models/transfer_response_attributes.rb +280 -0
- data/lib/shotstack/models/transfer_response_data.rb +225 -0
- data/lib/shotstack/models/transformation.rb +16 -20
- data/lib/shotstack/models/transition.rb +16 -20
- data/lib/shotstack/models/upload_response.rb +222 -0
- data/lib/shotstack/models/upload_response_attributes.rb +257 -0
- data/lib/shotstack/models/upload_response_data.rb +256 -0
- data/lib/shotstack/models/video_asset.rb +57 -21
- data/lib/shotstack/version.rb +3 -3
- data/lib/shotstack.rb +61 -2
- data/shotstack.gemspec +8 -8
- metadata +69 -16
@@ -0,0 +1,373 @@
|
|
1
|
+
=begin
|
2
|
+
#Shotstack
|
3
|
+
|
4
|
+
# Official Ruby SDK for the Shotstack Cloud Video Editing API
|
5
|
+
|
6
|
+
The version of the OpenAPI document: v1
|
7
|
+
|
8
|
+
Generated by: https://openapi-generator.tech
|
9
|
+
Generator version: 7.4.0
|
10
|
+
|
11
|
+
=end
|
12
|
+
|
13
|
+
require 'date'
|
14
|
+
require 'time'
|
15
|
+
|
16
|
+
module Shotstack
|
17
|
+
# The id and attributes of the source file.
|
18
|
+
class SourceResponseAttributes
|
19
|
+
# The source id.
|
20
|
+
attr_accessor :id
|
21
|
+
|
22
|
+
# The owner id of the source file.
|
23
|
+
attr_accessor :owner
|
24
|
+
|
25
|
+
# The original URL of an ingested source file, where it originated. Only displayed for files ingested using the [fetch source](#fetch-source) endpoint. Not displayed for direct uploads.
|
26
|
+
attr_accessor :input
|
27
|
+
|
28
|
+
# The URL of the source file hosted by Shotstack. The file at the URL can be used by the Edit API. Source file URL's consist of a base URL (AWS bucket), owner id, source id and a file named source. The extension varies depending on the type of file ingested.
|
29
|
+
attr_accessor :source
|
30
|
+
|
31
|
+
# The status of the source file ingestion task. <ul> <li>`queued` - ingestion task is queued waiting to be fetched</li> <li>`importing` - the source file is being downloaded</li> <li>`ready` - the source file has been ingested and stored</li> <li>`failed` - there was an error ingesting the source file</li> <li>`deleted` - the source file has been deleted</li> </ul>
|
32
|
+
attr_accessor :status
|
33
|
+
|
34
|
+
attr_accessor :outputs
|
35
|
+
|
36
|
+
# The width in pixels of the ingested source file, if a video or image.
|
37
|
+
attr_accessor :width
|
38
|
+
|
39
|
+
# The height in pixels of the ingested source file, if a video or image.
|
40
|
+
attr_accessor :height
|
41
|
+
|
42
|
+
# The duration in seconds of the ingested source file, if a video or audio file.
|
43
|
+
attr_accessor :duration
|
44
|
+
|
45
|
+
# The frame rate in frames per second of the source file, if a video file.
|
46
|
+
attr_accessor :fps
|
47
|
+
|
48
|
+
# The time the ingestion task was initially queued.
|
49
|
+
attr_accessor :created
|
50
|
+
|
51
|
+
# The time the ingestion status was last updated.
|
52
|
+
attr_accessor :updated
|
53
|
+
|
54
|
+
class EnumAttributeValidator
|
55
|
+
attr_reader :datatype
|
56
|
+
attr_reader :allowable_values
|
57
|
+
|
58
|
+
def initialize(datatype, allowable_values)
|
59
|
+
@allowable_values = allowable_values.map do |value|
|
60
|
+
case datatype.to_s
|
61
|
+
when /Integer/i
|
62
|
+
value.to_i
|
63
|
+
when /Float/i
|
64
|
+
value.to_f
|
65
|
+
else
|
66
|
+
value
|
67
|
+
end
|
68
|
+
end
|
69
|
+
end
|
70
|
+
|
71
|
+
def valid?(value)
|
72
|
+
!value || allowable_values.include?(value)
|
73
|
+
end
|
74
|
+
end
|
75
|
+
|
76
|
+
# Attribute mapping from ruby-style variable name to JSON key.
|
77
|
+
def self.attribute_map
|
78
|
+
{
|
79
|
+
:'id' => :'id',
|
80
|
+
:'owner' => :'owner',
|
81
|
+
:'input' => :'input',
|
82
|
+
:'source' => :'source',
|
83
|
+
:'status' => :'status',
|
84
|
+
:'outputs' => :'outputs',
|
85
|
+
:'width' => :'width',
|
86
|
+
:'height' => :'height',
|
87
|
+
:'duration' => :'duration',
|
88
|
+
:'fps' => :'fps',
|
89
|
+
:'created' => :'created',
|
90
|
+
:'updated' => :'updated'
|
91
|
+
}
|
92
|
+
end
|
93
|
+
|
94
|
+
# Returns all the JSON keys this model knows about
|
95
|
+
def self.acceptable_attributes
|
96
|
+
attribute_map.values
|
97
|
+
end
|
98
|
+
|
99
|
+
# Attribute type mapping.
|
100
|
+
def self.openapi_types
|
101
|
+
{
|
102
|
+
:'id' => :'String',
|
103
|
+
:'owner' => :'String',
|
104
|
+
:'input' => :'String',
|
105
|
+
:'source' => :'String',
|
106
|
+
:'status' => :'String',
|
107
|
+
:'outputs' => :'OutputsResponse',
|
108
|
+
:'width' => :'Integer',
|
109
|
+
:'height' => :'String',
|
110
|
+
:'duration' => :'Float',
|
111
|
+
:'fps' => :'Float',
|
112
|
+
:'created' => :'String',
|
113
|
+
:'updated' => :'String'
|
114
|
+
}
|
115
|
+
end
|
116
|
+
|
117
|
+
# List of attributes with nullable: true
|
118
|
+
def self.openapi_nullable
|
119
|
+
Set.new([
|
120
|
+
])
|
121
|
+
end
|
122
|
+
|
123
|
+
# Initializes the object
|
124
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
125
|
+
def initialize(attributes = {})
|
126
|
+
if (!attributes.is_a?(Hash))
|
127
|
+
fail ArgumentError, "The input argument (attributes) must be a hash in `Shotstack::SourceResponseAttributes` initialize method"
|
128
|
+
end
|
129
|
+
|
130
|
+
# check to see if the attribute exists and convert string to symbol for hash key
|
131
|
+
attributes = attributes.each_with_object({}) { |(k, v), h|
|
132
|
+
if (!self.class.attribute_map.key?(k.to_sym))
|
133
|
+
fail ArgumentError, "`#{k}` is not a valid attribute in `Shotstack::SourceResponseAttributes`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
|
134
|
+
end
|
135
|
+
h[k.to_sym] = v
|
136
|
+
}
|
137
|
+
|
138
|
+
if attributes.key?(:'id')
|
139
|
+
self.id = attributes[:'id']
|
140
|
+
else
|
141
|
+
self.id = nil
|
142
|
+
end
|
143
|
+
|
144
|
+
if attributes.key?(:'owner')
|
145
|
+
self.owner = attributes[:'owner']
|
146
|
+
else
|
147
|
+
self.owner = nil
|
148
|
+
end
|
149
|
+
|
150
|
+
if attributes.key?(:'input')
|
151
|
+
self.input = attributes[:'input']
|
152
|
+
end
|
153
|
+
|
154
|
+
if attributes.key?(:'source')
|
155
|
+
self.source = attributes[:'source']
|
156
|
+
end
|
157
|
+
|
158
|
+
if attributes.key?(:'status')
|
159
|
+
self.status = attributes[:'status']
|
160
|
+
end
|
161
|
+
|
162
|
+
if attributes.key?(:'outputs')
|
163
|
+
self.outputs = attributes[:'outputs']
|
164
|
+
end
|
165
|
+
|
166
|
+
if attributes.key?(:'width')
|
167
|
+
self.width = attributes[:'width']
|
168
|
+
end
|
169
|
+
|
170
|
+
if attributes.key?(:'height')
|
171
|
+
self.height = attributes[:'height']
|
172
|
+
end
|
173
|
+
|
174
|
+
if attributes.key?(:'duration')
|
175
|
+
self.duration = attributes[:'duration']
|
176
|
+
end
|
177
|
+
|
178
|
+
if attributes.key?(:'fps')
|
179
|
+
self.fps = attributes[:'fps']
|
180
|
+
end
|
181
|
+
|
182
|
+
if attributes.key?(:'created')
|
183
|
+
self.created = attributes[:'created']
|
184
|
+
end
|
185
|
+
|
186
|
+
if attributes.key?(:'updated')
|
187
|
+
self.updated = attributes[:'updated']
|
188
|
+
end
|
189
|
+
end
|
190
|
+
|
191
|
+
# Show invalid properties with the reasons. Usually used together with valid?
|
192
|
+
# @return Array for valid properties with the reasons
|
193
|
+
def list_invalid_properties
|
194
|
+
warn '[DEPRECATED] the `list_invalid_properties` method is obsolete'
|
195
|
+
invalid_properties = Array.new
|
196
|
+
if @id.nil?
|
197
|
+
invalid_properties.push('invalid value for "id", id cannot be nil.')
|
198
|
+
end
|
199
|
+
|
200
|
+
if @owner.nil?
|
201
|
+
invalid_properties.push('invalid value for "owner", owner cannot be nil.')
|
202
|
+
end
|
203
|
+
|
204
|
+
invalid_properties
|
205
|
+
end
|
206
|
+
|
207
|
+
# Check to see if the all the properties in the model are valid
|
208
|
+
# @return true if the model is valid
|
209
|
+
def valid?
|
210
|
+
warn '[DEPRECATED] the `valid?` method is obsolete'
|
211
|
+
return false if @id.nil?
|
212
|
+
return false if @owner.nil?
|
213
|
+
status_validator = EnumAttributeValidator.new('String', ["queued", "importing", "ready", "failed", "deleted", "overwritten"])
|
214
|
+
return false unless status_validator.valid?(@status)
|
215
|
+
true
|
216
|
+
end
|
217
|
+
|
218
|
+
# Custom attribute writer method checking allowed values (enum).
|
219
|
+
# @param [Object] status Object to be assigned
|
220
|
+
def status=(status)
|
221
|
+
validator = EnumAttributeValidator.new('String', ["queued", "importing", "ready", "failed", "deleted", "overwritten"])
|
222
|
+
unless validator.valid?(status)
|
223
|
+
fail ArgumentError, "invalid value for \"status\", must be one of #{validator.allowable_values}."
|
224
|
+
end
|
225
|
+
@status = status
|
226
|
+
end
|
227
|
+
|
228
|
+
# Checks equality by comparing each attribute.
|
229
|
+
# @param [Object] Object to be compared
|
230
|
+
def ==(o)
|
231
|
+
return true if self.equal?(o)
|
232
|
+
self.class == o.class &&
|
233
|
+
id == o.id &&
|
234
|
+
owner == o.owner &&
|
235
|
+
input == o.input &&
|
236
|
+
source == o.source &&
|
237
|
+
status == o.status &&
|
238
|
+
outputs == o.outputs &&
|
239
|
+
width == o.width &&
|
240
|
+
height == o.height &&
|
241
|
+
duration == o.duration &&
|
242
|
+
fps == o.fps &&
|
243
|
+
created == o.created &&
|
244
|
+
updated == o.updated
|
245
|
+
end
|
246
|
+
|
247
|
+
# @see the `==` method
|
248
|
+
# @param [Object] Object to be compared
|
249
|
+
def eql?(o)
|
250
|
+
self == o
|
251
|
+
end
|
252
|
+
|
253
|
+
# Calculates hash code according to all attributes.
|
254
|
+
# @return [Integer] Hash code
|
255
|
+
def hash
|
256
|
+
[id, owner, input, source, status, outputs, width, height, duration, fps, created, updated].hash
|
257
|
+
end
|
258
|
+
|
259
|
+
# Builds the object from hash
|
260
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
261
|
+
# @return [Object] Returns the model itself
|
262
|
+
def self.build_from_hash(attributes)
|
263
|
+
return nil unless attributes.is_a?(Hash)
|
264
|
+
attributes = attributes.transform_keys(&:to_sym)
|
265
|
+
transformed_hash = {}
|
266
|
+
openapi_types.each_pair do |key, type|
|
267
|
+
if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil?
|
268
|
+
transformed_hash["#{key}"] = nil
|
269
|
+
elsif type =~ /\AArray<(.*)>/i
|
270
|
+
# check to ensure the input is an array given that the attribute
|
271
|
+
# is documented as an array but the input is not
|
272
|
+
if attributes[attribute_map[key]].is_a?(Array)
|
273
|
+
transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) }
|
274
|
+
end
|
275
|
+
elsif !attributes[attribute_map[key]].nil?
|
276
|
+
transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]])
|
277
|
+
end
|
278
|
+
end
|
279
|
+
new(transformed_hash)
|
280
|
+
end
|
281
|
+
|
282
|
+
# Deserializes the data based on type
|
283
|
+
# @param string type Data type
|
284
|
+
# @param string value Value to be deserialized
|
285
|
+
# @return [Object] Deserialized data
|
286
|
+
def self._deserialize(type, value)
|
287
|
+
case type.to_sym
|
288
|
+
when :Time
|
289
|
+
Time.parse(value)
|
290
|
+
when :Date
|
291
|
+
Date.parse(value)
|
292
|
+
when :String
|
293
|
+
value.to_s
|
294
|
+
when :Integer
|
295
|
+
value.to_i
|
296
|
+
when :Float
|
297
|
+
value.to_f
|
298
|
+
when :Boolean
|
299
|
+
if value.to_s =~ /\A(true|t|yes|y|1)\z/i
|
300
|
+
true
|
301
|
+
else
|
302
|
+
false
|
303
|
+
end
|
304
|
+
when :Object
|
305
|
+
# generic object (usually a Hash), return directly
|
306
|
+
value
|
307
|
+
when /\AArray<(?<inner_type>.+)>\z/
|
308
|
+
inner_type = Regexp.last_match[:inner_type]
|
309
|
+
value.map { |v| _deserialize(inner_type, v) }
|
310
|
+
when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
|
311
|
+
k_type = Regexp.last_match[:k_type]
|
312
|
+
v_type = Regexp.last_match[:v_type]
|
313
|
+
{}.tap do |hash|
|
314
|
+
value.each do |k, v|
|
315
|
+
hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
|
316
|
+
end
|
317
|
+
end
|
318
|
+
else # model
|
319
|
+
# models (e.g. Pet) or oneOf
|
320
|
+
klass = Shotstack.const_get(type)
|
321
|
+
klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
|
322
|
+
end
|
323
|
+
end
|
324
|
+
|
325
|
+
# Returns the string representation of the object
|
326
|
+
# @return [String] String presentation of the object
|
327
|
+
def to_s
|
328
|
+
to_hash.to_s
|
329
|
+
end
|
330
|
+
|
331
|
+
# to_body is an alias to to_hash (backward compatibility)
|
332
|
+
# @return [Hash] Returns the object in the form of hash
|
333
|
+
def to_body
|
334
|
+
to_hash
|
335
|
+
end
|
336
|
+
|
337
|
+
# Returns the object in the form of hash
|
338
|
+
# @return [Hash] Returns the object in the form of hash
|
339
|
+
def to_hash
|
340
|
+
hash = {}
|
341
|
+
self.class.attribute_map.each_pair do |attr, param|
|
342
|
+
value = self.send(attr)
|
343
|
+
if value.nil?
|
344
|
+
is_nullable = self.class.openapi_nullable.include?(attr)
|
345
|
+
next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
|
346
|
+
end
|
347
|
+
|
348
|
+
hash[param] = _to_hash(value)
|
349
|
+
end
|
350
|
+
hash
|
351
|
+
end
|
352
|
+
|
353
|
+
# Outputs non-array value in the form of hash
|
354
|
+
# For object, use to_hash. Otherwise, just return the value
|
355
|
+
# @param [Object] value Any valid value
|
356
|
+
# @return [Hash] Returns the value in the form of hash
|
357
|
+
def _to_hash(value)
|
358
|
+
if value.is_a?(Array)
|
359
|
+
value.compact.map { |v| _to_hash(v) }
|
360
|
+
elsif value.is_a?(Hash)
|
361
|
+
{}.tap do |hash|
|
362
|
+
value.each { |k, v| hash[k] = _to_hash(v) }
|
363
|
+
end
|
364
|
+
elsif value.respond_to? :to_hash
|
365
|
+
value.to_hash
|
366
|
+
else
|
367
|
+
value
|
368
|
+
end
|
369
|
+
end
|
370
|
+
|
371
|
+
end
|
372
|
+
|
373
|
+
end
|
@@ -0,0 +1,256 @@
|
|
1
|
+
=begin
|
2
|
+
#Shotstack
|
3
|
+
|
4
|
+
# Official Ruby SDK for the Shotstack Cloud Video Editing API
|
5
|
+
|
6
|
+
The version of the OpenAPI document: v1
|
7
|
+
|
8
|
+
Generated by: https://openapi-generator.tech
|
9
|
+
Generator version: 7.4.0
|
10
|
+
|
11
|
+
=end
|
12
|
+
|
13
|
+
require 'date'
|
14
|
+
require 'time'
|
15
|
+
|
16
|
+
module Shotstack
|
17
|
+
# The type of resource (a source), it's id and attributes of the source file.
|
18
|
+
class SourceResponseData
|
19
|
+
# The type of resource, in this case it is a source.
|
20
|
+
attr_accessor :type
|
21
|
+
|
22
|
+
# The source file id.
|
23
|
+
attr_accessor :id
|
24
|
+
|
25
|
+
attr_accessor :attributes
|
26
|
+
|
27
|
+
# Attribute mapping from ruby-style variable name to JSON key.
|
28
|
+
def self.attribute_map
|
29
|
+
{
|
30
|
+
:'type' => :'type',
|
31
|
+
:'id' => :'id',
|
32
|
+
:'attributes' => :'attributes'
|
33
|
+
}
|
34
|
+
end
|
35
|
+
|
36
|
+
# Returns all the JSON keys this model knows about
|
37
|
+
def self.acceptable_attributes
|
38
|
+
attribute_map.values
|
39
|
+
end
|
40
|
+
|
41
|
+
# Attribute type mapping.
|
42
|
+
def self.openapi_types
|
43
|
+
{
|
44
|
+
:'type' => :'String',
|
45
|
+
:'id' => :'String',
|
46
|
+
:'attributes' => :'SourceResponseAttributes'
|
47
|
+
}
|
48
|
+
end
|
49
|
+
|
50
|
+
# List of attributes with nullable: true
|
51
|
+
def self.openapi_nullable
|
52
|
+
Set.new([
|
53
|
+
])
|
54
|
+
end
|
55
|
+
|
56
|
+
# Initializes the object
|
57
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
58
|
+
def initialize(attributes = {})
|
59
|
+
if (!attributes.is_a?(Hash))
|
60
|
+
fail ArgumentError, "The input argument (attributes) must be a hash in `Shotstack::SourceResponseData` initialize method"
|
61
|
+
end
|
62
|
+
|
63
|
+
# check to see if the attribute exists and convert string to symbol for hash key
|
64
|
+
attributes = attributes.each_with_object({}) { |(k, v), h|
|
65
|
+
if (!self.class.attribute_map.key?(k.to_sym))
|
66
|
+
fail ArgumentError, "`#{k}` is not a valid attribute in `Shotstack::SourceResponseData`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
|
67
|
+
end
|
68
|
+
h[k.to_sym] = v
|
69
|
+
}
|
70
|
+
|
71
|
+
if attributes.key?(:'type')
|
72
|
+
self.type = attributes[:'type']
|
73
|
+
else
|
74
|
+
self.type = nil
|
75
|
+
end
|
76
|
+
|
77
|
+
if attributes.key?(:'id')
|
78
|
+
self.id = attributes[:'id']
|
79
|
+
else
|
80
|
+
self.id = nil
|
81
|
+
end
|
82
|
+
|
83
|
+
if attributes.key?(:'attributes')
|
84
|
+
self.attributes = attributes[:'attributes']
|
85
|
+
else
|
86
|
+
self.attributes = nil
|
87
|
+
end
|
88
|
+
end
|
89
|
+
|
90
|
+
# Show invalid properties with the reasons. Usually used together with valid?
|
91
|
+
# @return Array for valid properties with the reasons
|
92
|
+
def list_invalid_properties
|
93
|
+
warn '[DEPRECATED] the `list_invalid_properties` method is obsolete'
|
94
|
+
invalid_properties = Array.new
|
95
|
+
if @type.nil?
|
96
|
+
invalid_properties.push('invalid value for "type", type cannot be nil.')
|
97
|
+
end
|
98
|
+
|
99
|
+
if @id.nil?
|
100
|
+
invalid_properties.push('invalid value for "id", id cannot be nil.')
|
101
|
+
end
|
102
|
+
|
103
|
+
if @attributes.nil?
|
104
|
+
invalid_properties.push('invalid value for "attributes", attributes cannot be nil.')
|
105
|
+
end
|
106
|
+
|
107
|
+
invalid_properties
|
108
|
+
end
|
109
|
+
|
110
|
+
# Check to see if the all the properties in the model are valid
|
111
|
+
# @return true if the model is valid
|
112
|
+
def valid?
|
113
|
+
warn '[DEPRECATED] the `valid?` method is obsolete'
|
114
|
+
return false if @type.nil?
|
115
|
+
return false if @id.nil?
|
116
|
+
return false if @attributes.nil?
|
117
|
+
true
|
118
|
+
end
|
119
|
+
|
120
|
+
# Checks equality by comparing each attribute.
|
121
|
+
# @param [Object] Object to be compared
|
122
|
+
def ==(o)
|
123
|
+
return true if self.equal?(o)
|
124
|
+
self.class == o.class &&
|
125
|
+
type == o.type &&
|
126
|
+
id == o.id &&
|
127
|
+
attributes == o.attributes
|
128
|
+
end
|
129
|
+
|
130
|
+
# @see the `==` method
|
131
|
+
# @param [Object] Object to be compared
|
132
|
+
def eql?(o)
|
133
|
+
self == o
|
134
|
+
end
|
135
|
+
|
136
|
+
# Calculates hash code according to all attributes.
|
137
|
+
# @return [Integer] Hash code
|
138
|
+
def hash
|
139
|
+
[type, id, attributes].hash
|
140
|
+
end
|
141
|
+
|
142
|
+
# Builds the object from hash
|
143
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
144
|
+
# @return [Object] Returns the model itself
|
145
|
+
def self.build_from_hash(attributes)
|
146
|
+
return nil unless attributes.is_a?(Hash)
|
147
|
+
attributes = attributes.transform_keys(&:to_sym)
|
148
|
+
transformed_hash = {}
|
149
|
+
openapi_types.each_pair do |key, type|
|
150
|
+
if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil?
|
151
|
+
transformed_hash["#{key}"] = nil
|
152
|
+
elsif type =~ /\AArray<(.*)>/i
|
153
|
+
# check to ensure the input is an array given that the attribute
|
154
|
+
# is documented as an array but the input is not
|
155
|
+
if attributes[attribute_map[key]].is_a?(Array)
|
156
|
+
transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) }
|
157
|
+
end
|
158
|
+
elsif !attributes[attribute_map[key]].nil?
|
159
|
+
transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]])
|
160
|
+
end
|
161
|
+
end
|
162
|
+
new(transformed_hash)
|
163
|
+
end
|
164
|
+
|
165
|
+
# Deserializes the data based on type
|
166
|
+
# @param string type Data type
|
167
|
+
# @param string value Value to be deserialized
|
168
|
+
# @return [Object] Deserialized data
|
169
|
+
def self._deserialize(type, value)
|
170
|
+
case type.to_sym
|
171
|
+
when :Time
|
172
|
+
Time.parse(value)
|
173
|
+
when :Date
|
174
|
+
Date.parse(value)
|
175
|
+
when :String
|
176
|
+
value.to_s
|
177
|
+
when :Integer
|
178
|
+
value.to_i
|
179
|
+
when :Float
|
180
|
+
value.to_f
|
181
|
+
when :Boolean
|
182
|
+
if value.to_s =~ /\A(true|t|yes|y|1)\z/i
|
183
|
+
true
|
184
|
+
else
|
185
|
+
false
|
186
|
+
end
|
187
|
+
when :Object
|
188
|
+
# generic object (usually a Hash), return directly
|
189
|
+
value
|
190
|
+
when /\AArray<(?<inner_type>.+)>\z/
|
191
|
+
inner_type = Regexp.last_match[:inner_type]
|
192
|
+
value.map { |v| _deserialize(inner_type, v) }
|
193
|
+
when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
|
194
|
+
k_type = Regexp.last_match[:k_type]
|
195
|
+
v_type = Regexp.last_match[:v_type]
|
196
|
+
{}.tap do |hash|
|
197
|
+
value.each do |k, v|
|
198
|
+
hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
|
199
|
+
end
|
200
|
+
end
|
201
|
+
else # model
|
202
|
+
# models (e.g. Pet) or oneOf
|
203
|
+
klass = Shotstack.const_get(type)
|
204
|
+
klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
|
205
|
+
end
|
206
|
+
end
|
207
|
+
|
208
|
+
# Returns the string representation of the object
|
209
|
+
# @return [String] String presentation of the object
|
210
|
+
def to_s
|
211
|
+
to_hash.to_s
|
212
|
+
end
|
213
|
+
|
214
|
+
# to_body is an alias to to_hash (backward compatibility)
|
215
|
+
# @return [Hash] Returns the object in the form of hash
|
216
|
+
def to_body
|
217
|
+
to_hash
|
218
|
+
end
|
219
|
+
|
220
|
+
# Returns the object in the form of hash
|
221
|
+
# @return [Hash] Returns the object in the form of hash
|
222
|
+
def to_hash
|
223
|
+
hash = {}
|
224
|
+
self.class.attribute_map.each_pair do |attr, param|
|
225
|
+
value = self.send(attr)
|
226
|
+
if value.nil?
|
227
|
+
is_nullable = self.class.openapi_nullable.include?(attr)
|
228
|
+
next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
|
229
|
+
end
|
230
|
+
|
231
|
+
hash[param] = _to_hash(value)
|
232
|
+
end
|
233
|
+
hash
|
234
|
+
end
|
235
|
+
|
236
|
+
# Outputs non-array value in the form of hash
|
237
|
+
# For object, use to_hash. Otherwise, just return the value
|
238
|
+
# @param [Object] value Any valid value
|
239
|
+
# @return [Hash] Returns the value in the form of hash
|
240
|
+
def _to_hash(value)
|
241
|
+
if value.is_a?(Array)
|
242
|
+
value.compact.map { |v| _to_hash(v) }
|
243
|
+
elsif value.is_a?(Hash)
|
244
|
+
{}.tap do |hash|
|
245
|
+
value.each { |k, v| hash[k] = _to_hash(v) }
|
246
|
+
end
|
247
|
+
elsif value.respond_to? :to_hash
|
248
|
+
value.to_hash
|
249
|
+
else
|
250
|
+
value
|
251
|
+
end
|
252
|
+
end
|
253
|
+
|
254
|
+
end
|
255
|
+
|
256
|
+
end
|