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,257 @@
|
|
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 upload file including the signed URL to send the binary file data to.
|
18
|
+
class UploadResponseAttributes
|
19
|
+
# The source id.
|
20
|
+
attr_accessor :id
|
21
|
+
|
22
|
+
# The signed URL to use in a PUT request to send the binary file to.
|
23
|
+
attr_accessor :url
|
24
|
+
|
25
|
+
# The time the upload request will expire. The signed URL will expire after one hour. Upload must complete within one hour.
|
26
|
+
attr_accessor :expires
|
27
|
+
|
28
|
+
# Attribute mapping from ruby-style variable name to JSON key.
|
29
|
+
def self.attribute_map
|
30
|
+
{
|
31
|
+
:'id' => :'id',
|
32
|
+
:'url' => :'url',
|
33
|
+
:'expires' => :'expires'
|
34
|
+
}
|
35
|
+
end
|
36
|
+
|
37
|
+
# Returns all the JSON keys this model knows about
|
38
|
+
def self.acceptable_attributes
|
39
|
+
attribute_map.values
|
40
|
+
end
|
41
|
+
|
42
|
+
# Attribute type mapping.
|
43
|
+
def self.openapi_types
|
44
|
+
{
|
45
|
+
:'id' => :'String',
|
46
|
+
:'url' => :'String',
|
47
|
+
:'expires' => :'String'
|
48
|
+
}
|
49
|
+
end
|
50
|
+
|
51
|
+
# List of attributes with nullable: true
|
52
|
+
def self.openapi_nullable
|
53
|
+
Set.new([
|
54
|
+
])
|
55
|
+
end
|
56
|
+
|
57
|
+
# Initializes the object
|
58
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
59
|
+
def initialize(attributes = {})
|
60
|
+
if (!attributes.is_a?(Hash))
|
61
|
+
fail ArgumentError, "The input argument (attributes) must be a hash in `Shotstack::UploadResponseAttributes` initialize method"
|
62
|
+
end
|
63
|
+
|
64
|
+
# check to see if the attribute exists and convert string to symbol for hash key
|
65
|
+
attributes = attributes.each_with_object({}) { |(k, v), h|
|
66
|
+
if (!self.class.attribute_map.key?(k.to_sym))
|
67
|
+
fail ArgumentError, "`#{k}` is not a valid attribute in `Shotstack::UploadResponseAttributes`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
|
68
|
+
end
|
69
|
+
h[k.to_sym] = v
|
70
|
+
}
|
71
|
+
|
72
|
+
if attributes.key?(:'id')
|
73
|
+
self.id = attributes[:'id']
|
74
|
+
else
|
75
|
+
self.id = nil
|
76
|
+
end
|
77
|
+
|
78
|
+
if attributes.key?(:'url')
|
79
|
+
self.url = attributes[:'url']
|
80
|
+
else
|
81
|
+
self.url = nil
|
82
|
+
end
|
83
|
+
|
84
|
+
if attributes.key?(:'expires')
|
85
|
+
self.expires = attributes[:'expires']
|
86
|
+
else
|
87
|
+
self.expires = nil
|
88
|
+
end
|
89
|
+
end
|
90
|
+
|
91
|
+
# Show invalid properties with the reasons. Usually used together with valid?
|
92
|
+
# @return Array for valid properties with the reasons
|
93
|
+
def list_invalid_properties
|
94
|
+
warn '[DEPRECATED] the `list_invalid_properties` method is obsolete'
|
95
|
+
invalid_properties = Array.new
|
96
|
+
if @id.nil?
|
97
|
+
invalid_properties.push('invalid value for "id", id cannot be nil.')
|
98
|
+
end
|
99
|
+
|
100
|
+
if @url.nil?
|
101
|
+
invalid_properties.push('invalid value for "url", url cannot be nil.')
|
102
|
+
end
|
103
|
+
|
104
|
+
if @expires.nil?
|
105
|
+
invalid_properties.push('invalid value for "expires", expires cannot be nil.')
|
106
|
+
end
|
107
|
+
|
108
|
+
invalid_properties
|
109
|
+
end
|
110
|
+
|
111
|
+
# Check to see if the all the properties in the model are valid
|
112
|
+
# @return true if the model is valid
|
113
|
+
def valid?
|
114
|
+
warn '[DEPRECATED] the `valid?` method is obsolete'
|
115
|
+
return false if @id.nil?
|
116
|
+
return false if @url.nil?
|
117
|
+
return false if @expires.nil?
|
118
|
+
true
|
119
|
+
end
|
120
|
+
|
121
|
+
# Checks equality by comparing each attribute.
|
122
|
+
# @param [Object] Object to be compared
|
123
|
+
def ==(o)
|
124
|
+
return true if self.equal?(o)
|
125
|
+
self.class == o.class &&
|
126
|
+
id == o.id &&
|
127
|
+
url == o.url &&
|
128
|
+
expires == o.expires
|
129
|
+
end
|
130
|
+
|
131
|
+
# @see the `==` method
|
132
|
+
# @param [Object] Object to be compared
|
133
|
+
def eql?(o)
|
134
|
+
self == o
|
135
|
+
end
|
136
|
+
|
137
|
+
# Calculates hash code according to all attributes.
|
138
|
+
# @return [Integer] Hash code
|
139
|
+
def hash
|
140
|
+
[id, url, expires].hash
|
141
|
+
end
|
142
|
+
|
143
|
+
# Builds the object from hash
|
144
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
145
|
+
# @return [Object] Returns the model itself
|
146
|
+
def self.build_from_hash(attributes)
|
147
|
+
return nil unless attributes.is_a?(Hash)
|
148
|
+
attributes = attributes.transform_keys(&:to_sym)
|
149
|
+
transformed_hash = {}
|
150
|
+
openapi_types.each_pair do |key, type|
|
151
|
+
if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil?
|
152
|
+
transformed_hash["#{key}"] = nil
|
153
|
+
elsif type =~ /\AArray<(.*)>/i
|
154
|
+
# check to ensure the input is an array given that the attribute
|
155
|
+
# is documented as an array but the input is not
|
156
|
+
if attributes[attribute_map[key]].is_a?(Array)
|
157
|
+
transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) }
|
158
|
+
end
|
159
|
+
elsif !attributes[attribute_map[key]].nil?
|
160
|
+
transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]])
|
161
|
+
end
|
162
|
+
end
|
163
|
+
new(transformed_hash)
|
164
|
+
end
|
165
|
+
|
166
|
+
# Deserializes the data based on type
|
167
|
+
# @param string type Data type
|
168
|
+
# @param string value Value to be deserialized
|
169
|
+
# @return [Object] Deserialized data
|
170
|
+
def self._deserialize(type, value)
|
171
|
+
case type.to_sym
|
172
|
+
when :Time
|
173
|
+
Time.parse(value)
|
174
|
+
when :Date
|
175
|
+
Date.parse(value)
|
176
|
+
when :String
|
177
|
+
value.to_s
|
178
|
+
when :Integer
|
179
|
+
value.to_i
|
180
|
+
when :Float
|
181
|
+
value.to_f
|
182
|
+
when :Boolean
|
183
|
+
if value.to_s =~ /\A(true|t|yes|y|1)\z/i
|
184
|
+
true
|
185
|
+
else
|
186
|
+
false
|
187
|
+
end
|
188
|
+
when :Object
|
189
|
+
# generic object (usually a Hash), return directly
|
190
|
+
value
|
191
|
+
when /\AArray<(?<inner_type>.+)>\z/
|
192
|
+
inner_type = Regexp.last_match[:inner_type]
|
193
|
+
value.map { |v| _deserialize(inner_type, v) }
|
194
|
+
when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
|
195
|
+
k_type = Regexp.last_match[:k_type]
|
196
|
+
v_type = Regexp.last_match[:v_type]
|
197
|
+
{}.tap do |hash|
|
198
|
+
value.each do |k, v|
|
199
|
+
hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
|
200
|
+
end
|
201
|
+
end
|
202
|
+
else # model
|
203
|
+
# models (e.g. Pet) or oneOf
|
204
|
+
klass = Shotstack.const_get(type)
|
205
|
+
klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
|
206
|
+
end
|
207
|
+
end
|
208
|
+
|
209
|
+
# Returns the string representation of the object
|
210
|
+
# @return [String] String presentation of the object
|
211
|
+
def to_s
|
212
|
+
to_hash.to_s
|
213
|
+
end
|
214
|
+
|
215
|
+
# to_body is an alias to to_hash (backward compatibility)
|
216
|
+
# @return [Hash] Returns the object in the form of hash
|
217
|
+
def to_body
|
218
|
+
to_hash
|
219
|
+
end
|
220
|
+
|
221
|
+
# Returns the object in the form of hash
|
222
|
+
# @return [Hash] Returns the object in the form of hash
|
223
|
+
def to_hash
|
224
|
+
hash = {}
|
225
|
+
self.class.attribute_map.each_pair do |attr, param|
|
226
|
+
value = self.send(attr)
|
227
|
+
if value.nil?
|
228
|
+
is_nullable = self.class.openapi_nullable.include?(attr)
|
229
|
+
next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
|
230
|
+
end
|
231
|
+
|
232
|
+
hash[param] = _to_hash(value)
|
233
|
+
end
|
234
|
+
hash
|
235
|
+
end
|
236
|
+
|
237
|
+
# Outputs non-array value in the form of hash
|
238
|
+
# For object, use to_hash. Otherwise, just return the value
|
239
|
+
# @param [Object] value Any valid value
|
240
|
+
# @return [Hash] Returns the value in the form of hash
|
241
|
+
def _to_hash(value)
|
242
|
+
if value.is_a?(Array)
|
243
|
+
value.compact.map { |v| _to_hash(v) }
|
244
|
+
elsif value.is_a?(Hash)
|
245
|
+
{}.tap do |hash|
|
246
|
+
value.each { |k, v| hash[k] = _to_hash(v) }
|
247
|
+
end
|
248
|
+
elsif value.respond_to? :to_hash
|
249
|
+
value.to_hash
|
250
|
+
else
|
251
|
+
value
|
252
|
+
end
|
253
|
+
end
|
254
|
+
|
255
|
+
end
|
256
|
+
|
257
|
+
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 (an upload), it's id and attributes of the upload request.
|
18
|
+
class UploadResponseData
|
19
|
+
# The type of resource, in this case it is an upload.
|
20
|
+
attr_accessor :type
|
21
|
+
|
22
|
+
# The upload 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' => :'UploadResponseAttributes'
|
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::UploadResponseData` 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::UploadResponseData`. 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
|
@@ -1,12 +1,12 @@
|
|
1
1
|
=begin
|
2
2
|
#Shotstack
|
3
3
|
|
4
|
-
#
|
4
|
+
# Official Ruby SDK for the Shotstack Cloud Video Editing API
|
5
5
|
|
6
6
|
The version of the OpenAPI document: v1
|
7
7
|
|
8
8
|
Generated by: https://openapi-generator.tech
|
9
|
-
|
9
|
+
Generator version: 7.4.0
|
10
10
|
|
11
11
|
=end
|
12
12
|
|
@@ -31,6 +31,9 @@ module Shotstack
|
|
31
31
|
# The volume effect to apply to the video asset <ul> <li>`fadeIn` - fade volume in only</li> <li>`fadeOut` - fade volume out only</li> <li>`fadeInFadeOut` - fade volume in and out</li> </ul>
|
32
32
|
attr_accessor :volume_effect
|
33
33
|
|
34
|
+
# Adjust the playback speed of the video clip between 0 (paused) and 10 (10x normal speed) where 1 is normal speed (defaults to 1). Adjusting the speed will also adjust the duration of the clip and may require you to adjust the Clip length. For example, if you set speed to 0.5, the clip will need to be 2x as long to play the entire video (i.e. original length / 0.5). If you set speed to 2, the clip will need to be half as long to play the entire video (i.e. original length / 2).
|
35
|
+
attr_accessor :speed
|
36
|
+
|
34
37
|
attr_accessor :crop
|
35
38
|
|
36
39
|
class EnumAttributeValidator
|
@@ -63,6 +66,7 @@ module Shotstack
|
|
63
66
|
:'trim' => :'trim',
|
64
67
|
:'volume' => :'volume',
|
65
68
|
:'volume_effect' => :'volumeEffect',
|
69
|
+
:'speed' => :'speed',
|
66
70
|
:'crop' => :'crop'
|
67
71
|
}
|
68
72
|
end
|
@@ -80,6 +84,7 @@ module Shotstack
|
|
80
84
|
:'trim' => :'Float',
|
81
85
|
:'volume' => :'Float',
|
82
86
|
:'volume_effect' => :'String',
|
87
|
+
:'speed' => :'Float',
|
83
88
|
:'crop' => :'Crop'
|
84
89
|
}
|
85
90
|
end
|
@@ -113,6 +118,8 @@ module Shotstack
|
|
113
118
|
|
114
119
|
if attributes.key?(:'src')
|
115
120
|
self.src = attributes[:'src']
|
121
|
+
else
|
122
|
+
self.src = nil
|
116
123
|
end
|
117
124
|
|
118
125
|
if attributes.key?(:'trim')
|
@@ -127,6 +134,10 @@ module Shotstack
|
|
127
134
|
self.volume_effect = attributes[:'volume_effect']
|
128
135
|
end
|
129
136
|
|
137
|
+
if attributes.key?(:'speed')
|
138
|
+
self.speed = attributes[:'speed']
|
139
|
+
end
|
140
|
+
|
130
141
|
if attributes.key?(:'crop')
|
131
142
|
self.crop = attributes[:'crop']
|
132
143
|
end
|
@@ -135,6 +146,7 @@ module Shotstack
|
|
135
146
|
# Show invalid properties with the reasons. Usually used together with valid?
|
136
147
|
# @return Array for valid properties with the reasons
|
137
148
|
def list_invalid_properties
|
149
|
+
warn '[DEPRECATED] the `list_invalid_properties` method is obsolete'
|
138
150
|
invalid_properties = Array.new
|
139
151
|
if @type.nil?
|
140
152
|
invalid_properties.push('invalid value for "type", type cannot be nil.')
|
@@ -144,16 +156,27 @@ module Shotstack
|
|
144
156
|
invalid_properties.push('invalid value for "src", src cannot be nil.')
|
145
157
|
end
|
146
158
|
|
159
|
+
if !@speed.nil? && @speed > 10
|
160
|
+
invalid_properties.push('invalid value for "speed", must be smaller than or equal to 10.')
|
161
|
+
end
|
162
|
+
|
163
|
+
if !@speed.nil? && @speed < 0
|
164
|
+
invalid_properties.push('invalid value for "speed", must be greater than or equal to 0.')
|
165
|
+
end
|
166
|
+
|
147
167
|
invalid_properties
|
148
168
|
end
|
149
169
|
|
150
170
|
# Check to see if the all the properties in the model are valid
|
151
171
|
# @return true if the model is valid
|
152
172
|
def valid?
|
173
|
+
warn '[DEPRECATED] the `valid?` method is obsolete'
|
153
174
|
return false if @type.nil?
|
154
175
|
return false if @src.nil?
|
155
176
|
volume_effect_validator = EnumAttributeValidator.new('String', ["fadeIn", "fadeOut", "fadeInFadeOut"])
|
156
177
|
return false unless volume_effect_validator.valid?(@volume_effect)
|
178
|
+
return false if !@speed.nil? && @speed > 10
|
179
|
+
return false if !@speed.nil? && @speed < 0
|
157
180
|
true
|
158
181
|
end
|
159
182
|
|
@@ -167,6 +190,24 @@ module Shotstack
|
|
167
190
|
@volume_effect = volume_effect
|
168
191
|
end
|
169
192
|
|
193
|
+
# Custom attribute writer method with validation
|
194
|
+
# @param [Object] speed Value to be assigned
|
195
|
+
def speed=(speed)
|
196
|
+
if speed.nil?
|
197
|
+
fail ArgumentError, 'speed cannot be nil'
|
198
|
+
end
|
199
|
+
|
200
|
+
if speed > 10
|
201
|
+
fail ArgumentError, 'invalid value for "speed", must be smaller than or equal to 10.'
|
202
|
+
end
|
203
|
+
|
204
|
+
if speed < 0
|
205
|
+
fail ArgumentError, 'invalid value for "speed", must be greater than or equal to 0.'
|
206
|
+
end
|
207
|
+
|
208
|
+
@speed = speed
|
209
|
+
end
|
210
|
+
|
170
211
|
# Checks equality by comparing each attribute.
|
171
212
|
# @param [Object] Object to be compared
|
172
213
|
def ==(o)
|
@@ -177,6 +218,7 @@ module Shotstack
|
|
177
218
|
trim == o.trim &&
|
178
219
|
volume == o.volume &&
|
179
220
|
volume_effect == o.volume_effect &&
|
221
|
+
speed == o.speed &&
|
180
222
|
crop == o.crop
|
181
223
|
end
|
182
224
|
|
@@ -189,43 +231,37 @@ module Shotstack
|
|
189
231
|
# Calculates hash code according to all attributes.
|
190
232
|
# @return [Integer] Hash code
|
191
233
|
def hash
|
192
|
-
[type, src, trim, volume, volume_effect, crop].hash
|
234
|
+
[type, src, trim, volume, volume_effect, speed, crop].hash
|
193
235
|
end
|
194
236
|
|
195
237
|
# Builds the object from hash
|
196
238
|
# @param [Hash] attributes Model attributes in the form of hash
|
197
239
|
# @return [Object] Returns the model itself
|
198
240
|
def self.build_from_hash(attributes)
|
199
|
-
new.build_from_hash(attributes)
|
200
|
-
end
|
201
|
-
|
202
|
-
# Builds the object from hash
|
203
|
-
# @param [Hash] attributes Model attributes in the form of hash
|
204
|
-
# @return [Object] Returns the model itself
|
205
|
-
def build_from_hash(attributes)
|
206
241
|
return nil unless attributes.is_a?(Hash)
|
207
|
-
|
208
|
-
|
209
|
-
|
242
|
+
attributes = attributes.transform_keys(&:to_sym)
|
243
|
+
transformed_hash = {}
|
244
|
+
openapi_types.each_pair do |key, type|
|
245
|
+
if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil?
|
246
|
+
transformed_hash["#{key}"] = nil
|
210
247
|
elsif type =~ /\AArray<(.*)>/i
|
211
248
|
# check to ensure the input is an array given that the attribute
|
212
249
|
# is documented as an array but the input is not
|
213
|
-
if attributes[
|
214
|
-
|
250
|
+
if attributes[attribute_map[key]].is_a?(Array)
|
251
|
+
transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) }
|
215
252
|
end
|
216
|
-
elsif !attributes[
|
217
|
-
|
253
|
+
elsif !attributes[attribute_map[key]].nil?
|
254
|
+
transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]])
|
218
255
|
end
|
219
256
|
end
|
220
|
-
|
221
|
-
self
|
257
|
+
new(transformed_hash)
|
222
258
|
end
|
223
259
|
|
224
260
|
# Deserializes the data based on type
|
225
261
|
# @param string type Data type
|
226
262
|
# @param string value Value to be deserialized
|
227
263
|
# @return [Object] Deserialized data
|
228
|
-
def _deserialize(type, value)
|
264
|
+
def self._deserialize(type, value)
|
229
265
|
case type.to_sym
|
230
266
|
when :Time
|
231
267
|
Time.parse(value)
|
@@ -260,7 +296,7 @@ module Shotstack
|
|
260
296
|
else # model
|
261
297
|
# models (e.g. Pet) or oneOf
|
262
298
|
klass = Shotstack.const_get(type)
|
263
|
-
klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
|
299
|
+
klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
|
264
300
|
end
|
265
301
|
end
|
266
302
|
|