shotstack 0.2.1 → 0.2.6
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 +4 -4
- data/Gemfile +9 -0
- data/README.md +387 -23
- 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 +4 -4
- data/lib/shotstack/models/asset_render_response.rb +23 -20
- data/lib/shotstack/models/asset_response.rb +23 -20
- data/lib/shotstack/models/asset_response_attributes.rb +38 -21
- data/lib/shotstack/models/asset_response_data.rb +30 -20
- data/lib/shotstack/models/audio_asset.rb +57 -23
- data/lib/shotstack/models/audio_enhancement.rb +43 -0
- data/lib/shotstack/models/clip.rb +29 -33
- data/lib/shotstack/models/crop.rb +40 -28
- data/lib/shotstack/models/destinations.rb +78 -244
- 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 -24
- 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 -24
- 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 -26
- 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 +46 -46
- 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 +40 -35
- 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 +24 -35
- 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 -22
- data/lib/shotstack/models/s3_destination.rb +232 -0
- data/lib/shotstack/models/s3_destination_options.rb +270 -0
- data/lib/shotstack/models/shotstack_destination.rb +19 -25
- 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 +39 -35
- data/lib/shotstack/models/skew_transformation.rb +16 -24
- data/lib/shotstack/models/soundtrack.rb +18 -22
- 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 +24 -22
- data/lib/shotstack/models/template_data_response_data.rb +25 -22
- 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 -30
- data/lib/shotstack/models/template_render.rb +19 -21
- data/lib/shotstack/models/template_response.rb +23 -21
- 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 -25
- data/lib/shotstack/models/title_asset.rb +19 -27
- 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 +102 -22
- data/lib/shotstack/version.rb +3 -3
- data/lib/shotstack.rb +63 -2
- data/shotstack.gemspec +8 -8
- metadata +80 -24
@@ -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
|
|
@@ -14,12 +14,12 @@ require 'date'
|
|
14
14
|
require 'time'
|
15
15
|
|
16
16
|
module Shotstack
|
17
|
-
# Set a custom size for a video or image. When using a custom size omit the `resolution` and `aspectRatio`. Custom sizes must be divisible by 2 based on the encoder specifications.
|
17
|
+
# Set a custom size for a video or image in pixels. When using a custom size omit the `resolution` and `aspectRatio`. Custom sizes must be divisible by 2 based on the encoder specifications.
|
18
18
|
class Size
|
19
|
-
# Set a custom width for the video or image file. Value must be divisible by 2. Maximum video width is 1920px, maximum image width is 4096px.
|
19
|
+
# Set a custom width for the video or image file in pixels. Value must be divisible by 2. Maximum video width is 1920px, maximum image width is 4096px.
|
20
20
|
attr_accessor :width
|
21
21
|
|
22
|
-
# Set a custom height for the video or image file. Value must be divisible by 2. Maximum video height is 1920px, maximum image height is 4096px.
|
22
|
+
# Set a custom height for the video or image file in pixels. Value must be divisible by 2. Maximum video height is 1920px, maximum image height is 4096px.
|
23
23
|
attr_accessor :height
|
24
24
|
|
25
25
|
# Attribute mapping from ruby-style variable name to JSON key.
|
@@ -76,21 +76,22 @@ module Shotstack
|
|
76
76
|
# Show invalid properties with the reasons. Usually used together with valid?
|
77
77
|
# @return Array for valid properties with the reasons
|
78
78
|
def list_invalid_properties
|
79
|
+
warn '[DEPRECATED] the `list_invalid_properties` method is obsolete'
|
79
80
|
invalid_properties = Array.new
|
80
81
|
if !@width.nil? && @width > 4096
|
81
82
|
invalid_properties.push('invalid value for "width", must be smaller than or equal to 4096.')
|
82
83
|
end
|
83
84
|
|
84
|
-
if !@width.nil? && @width <
|
85
|
-
invalid_properties.push('invalid value for "width", must be greater than or equal to
|
85
|
+
if !@width.nil? && @width < 1
|
86
|
+
invalid_properties.push('invalid value for "width", must be greater than or equal to 1.')
|
86
87
|
end
|
87
88
|
|
88
89
|
if !@height.nil? && @height > 4096
|
89
90
|
invalid_properties.push('invalid value for "height", must be smaller than or equal to 4096.')
|
90
91
|
end
|
91
92
|
|
92
|
-
if !@height.nil? && @height <
|
93
|
-
invalid_properties.push('invalid value for "height", must be greater than or equal to
|
93
|
+
if !@height.nil? && @height < 1
|
94
|
+
invalid_properties.push('invalid value for "height", must be greater than or equal to 1.')
|
94
95
|
end
|
95
96
|
|
96
97
|
invalid_properties
|
@@ -99,22 +100,27 @@ module Shotstack
|
|
99
100
|
# Check to see if the all the properties in the model are valid
|
100
101
|
# @return true if the model is valid
|
101
102
|
def valid?
|
103
|
+
warn '[DEPRECATED] the `valid?` method is obsolete'
|
102
104
|
return false if !@width.nil? && @width > 4096
|
103
|
-
return false if !@width.nil? && @width <
|
105
|
+
return false if !@width.nil? && @width < 1
|
104
106
|
return false if !@height.nil? && @height > 4096
|
105
|
-
return false if !@height.nil? && @height <
|
107
|
+
return false if !@height.nil? && @height < 1
|
106
108
|
true
|
107
109
|
end
|
108
110
|
|
109
111
|
# Custom attribute writer method with validation
|
110
112
|
# @param [Object] width Value to be assigned
|
111
113
|
def width=(width)
|
112
|
-
if
|
114
|
+
if width.nil?
|
115
|
+
fail ArgumentError, 'width cannot be nil'
|
116
|
+
end
|
117
|
+
|
118
|
+
if width > 4096
|
113
119
|
fail ArgumentError, 'invalid value for "width", must be smaller than or equal to 4096.'
|
114
120
|
end
|
115
121
|
|
116
|
-
if
|
117
|
-
fail ArgumentError, 'invalid value for "width", must be greater than or equal to
|
122
|
+
if width < 1
|
123
|
+
fail ArgumentError, 'invalid value for "width", must be greater than or equal to 1.'
|
118
124
|
end
|
119
125
|
|
120
126
|
@width = width
|
@@ -123,12 +129,16 @@ module Shotstack
|
|
123
129
|
# Custom attribute writer method with validation
|
124
130
|
# @param [Object] height Value to be assigned
|
125
131
|
def height=(height)
|
126
|
-
if
|
132
|
+
if height.nil?
|
133
|
+
fail ArgumentError, 'height cannot be nil'
|
134
|
+
end
|
135
|
+
|
136
|
+
if height > 4096
|
127
137
|
fail ArgumentError, 'invalid value for "height", must be smaller than or equal to 4096.'
|
128
138
|
end
|
129
139
|
|
130
|
-
if
|
131
|
-
fail ArgumentError, 'invalid value for "height", must be greater than or equal to
|
140
|
+
if height < 1
|
141
|
+
fail ArgumentError, 'invalid value for "height", must be greater than or equal to 1.'
|
132
142
|
end
|
133
143
|
|
134
144
|
@height = height
|
@@ -159,36 +169,30 @@ module Shotstack
|
|
159
169
|
# @param [Hash] attributes Model attributes in the form of hash
|
160
170
|
# @return [Object] Returns the model itself
|
161
171
|
def self.build_from_hash(attributes)
|
162
|
-
new.build_from_hash(attributes)
|
163
|
-
end
|
164
|
-
|
165
|
-
# Builds the object from hash
|
166
|
-
# @param [Hash] attributes Model attributes in the form of hash
|
167
|
-
# @return [Object] Returns the model itself
|
168
|
-
def build_from_hash(attributes)
|
169
172
|
return nil unless attributes.is_a?(Hash)
|
170
|
-
|
171
|
-
|
172
|
-
|
173
|
+
attributes = attributes.transform_keys(&:to_sym)
|
174
|
+
transformed_hash = {}
|
175
|
+
openapi_types.each_pair do |key, type|
|
176
|
+
if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil?
|
177
|
+
transformed_hash["#{key}"] = nil
|
173
178
|
elsif type =~ /\AArray<(.*)>/i
|
174
179
|
# check to ensure the input is an array given that the attribute
|
175
180
|
# is documented as an array but the input is not
|
176
|
-
if attributes[
|
177
|
-
|
181
|
+
if attributes[attribute_map[key]].is_a?(Array)
|
182
|
+
transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) }
|
178
183
|
end
|
179
|
-
elsif !attributes[
|
180
|
-
|
184
|
+
elsif !attributes[attribute_map[key]].nil?
|
185
|
+
transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]])
|
181
186
|
end
|
182
187
|
end
|
183
|
-
|
184
|
-
self
|
188
|
+
new(transformed_hash)
|
185
189
|
end
|
186
190
|
|
187
191
|
# Deserializes the data based on type
|
188
192
|
# @param string type Data type
|
189
193
|
# @param string value Value to be deserialized
|
190
194
|
# @return [Object] Deserialized data
|
191
|
-
def _deserialize(type, value)
|
195
|
+
def self._deserialize(type, value)
|
192
196
|
case type.to_sym
|
193
197
|
when :Time
|
194
198
|
Time.parse(value)
|
@@ -223,7 +227,7 @@ module Shotstack
|
|
223
227
|
else # model
|
224
228
|
# models (e.g. Pet) or oneOf
|
225
229
|
klass = Shotstack.const_get(type)
|
226
|
-
klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
|
230
|
+
klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
|
227
231
|
end
|
228
232
|
end
|
229
233
|
|
@@ -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
|
|
@@ -66,20 +66,17 @@ module Shotstack
|
|
66
66
|
|
67
67
|
if attributes.key?(:'x')
|
68
68
|
self.x = attributes[:'x']
|
69
|
-
else
|
70
|
-
self.x = 0
|
71
69
|
end
|
72
70
|
|
73
71
|
if attributes.key?(:'y')
|
74
72
|
self.y = attributes[:'y']
|
75
|
-
else
|
76
|
-
self.y = 0
|
77
73
|
end
|
78
74
|
end
|
79
75
|
|
80
76
|
# Show invalid properties with the reasons. Usually used together with valid?
|
81
77
|
# @return Array for valid properties with the reasons
|
82
78
|
def list_invalid_properties
|
79
|
+
warn '[DEPRECATED] the `list_invalid_properties` method is obsolete'
|
83
80
|
invalid_properties = Array.new
|
84
81
|
invalid_properties
|
85
82
|
end
|
@@ -87,6 +84,7 @@ module Shotstack
|
|
87
84
|
# Check to see if the all the properties in the model are valid
|
88
85
|
# @return true if the model is valid
|
89
86
|
def valid?
|
87
|
+
warn '[DEPRECATED] the `valid?` method is obsolete'
|
90
88
|
true
|
91
89
|
end
|
92
90
|
|
@@ -115,36 +113,30 @@ module Shotstack
|
|
115
113
|
# @param [Hash] attributes Model attributes in the form of hash
|
116
114
|
# @return [Object] Returns the model itself
|
117
115
|
def self.build_from_hash(attributes)
|
118
|
-
new.build_from_hash(attributes)
|
119
|
-
end
|
120
|
-
|
121
|
-
# Builds the object from hash
|
122
|
-
# @param [Hash] attributes Model attributes in the form of hash
|
123
|
-
# @return [Object] Returns the model itself
|
124
|
-
def build_from_hash(attributes)
|
125
116
|
return nil unless attributes.is_a?(Hash)
|
126
|
-
|
127
|
-
|
128
|
-
|
117
|
+
attributes = attributes.transform_keys(&:to_sym)
|
118
|
+
transformed_hash = {}
|
119
|
+
openapi_types.each_pair do |key, type|
|
120
|
+
if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil?
|
121
|
+
transformed_hash["#{key}"] = nil
|
129
122
|
elsif type =~ /\AArray<(.*)>/i
|
130
123
|
# check to ensure the input is an array given that the attribute
|
131
124
|
# is documented as an array but the input is not
|
132
|
-
if attributes[
|
133
|
-
|
125
|
+
if attributes[attribute_map[key]].is_a?(Array)
|
126
|
+
transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) }
|
134
127
|
end
|
135
|
-
elsif !attributes[
|
136
|
-
|
128
|
+
elsif !attributes[attribute_map[key]].nil?
|
129
|
+
transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]])
|
137
130
|
end
|
138
131
|
end
|
139
|
-
|
140
|
-
self
|
132
|
+
new(transformed_hash)
|
141
133
|
end
|
142
134
|
|
143
135
|
# Deserializes the data based on type
|
144
136
|
# @param string type Data type
|
145
137
|
# @param string value Value to be deserialized
|
146
138
|
# @return [Object] Deserialized data
|
147
|
-
def _deserialize(type, value)
|
139
|
+
def self._deserialize(type, value)
|
148
140
|
case type.to_sym
|
149
141
|
when :Time
|
150
142
|
Time.parse(value)
|
@@ -179,7 +171,7 @@ module Shotstack
|
|
179
171
|
else # model
|
180
172
|
# models (e.g. Pet) or oneOf
|
181
173
|
klass = Shotstack.const_get(type)
|
182
|
-
klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
|
174
|
+
klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
|
183
175
|
end
|
184
176
|
end
|
185
177
|
|
@@ -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
|
|
@@ -93,6 +93,8 @@ module Shotstack
|
|
93
93
|
|
94
94
|
if attributes.key?(:'src')
|
95
95
|
self.src = attributes[:'src']
|
96
|
+
else
|
97
|
+
self.src = nil
|
96
98
|
end
|
97
99
|
|
98
100
|
if attributes.key?(:'effect')
|
@@ -101,14 +103,13 @@ module Shotstack
|
|
101
103
|
|
102
104
|
if attributes.key?(:'volume')
|
103
105
|
self.volume = attributes[:'volume']
|
104
|
-
else
|
105
|
-
self.volume = 1
|
106
106
|
end
|
107
107
|
end
|
108
108
|
|
109
109
|
# Show invalid properties with the reasons. Usually used together with valid?
|
110
110
|
# @return Array for valid properties with the reasons
|
111
111
|
def list_invalid_properties
|
112
|
+
warn '[DEPRECATED] the `list_invalid_properties` method is obsolete'
|
112
113
|
invalid_properties = Array.new
|
113
114
|
if @src.nil?
|
114
115
|
invalid_properties.push('invalid value for "src", src cannot be nil.')
|
@@ -120,6 +121,7 @@ module Shotstack
|
|
120
121
|
# Check to see if the all the properties in the model are valid
|
121
122
|
# @return true if the model is valid
|
122
123
|
def valid?
|
124
|
+
warn '[DEPRECATED] the `valid?` method is obsolete'
|
123
125
|
return false if @src.nil?
|
124
126
|
effect_validator = EnumAttributeValidator.new('String', ["fadeIn", "fadeOut", "fadeInFadeOut"])
|
125
127
|
return false unless effect_validator.valid?(@effect)
|
@@ -162,36 +164,30 @@ module Shotstack
|
|
162
164
|
# @param [Hash] attributes Model attributes in the form of hash
|
163
165
|
# @return [Object] Returns the model itself
|
164
166
|
def self.build_from_hash(attributes)
|
165
|
-
new.build_from_hash(attributes)
|
166
|
-
end
|
167
|
-
|
168
|
-
# Builds the object from hash
|
169
|
-
# @param [Hash] attributes Model attributes in the form of hash
|
170
|
-
# @return [Object] Returns the model itself
|
171
|
-
def build_from_hash(attributes)
|
172
167
|
return nil unless attributes.is_a?(Hash)
|
173
|
-
|
174
|
-
|
175
|
-
|
168
|
+
attributes = attributes.transform_keys(&:to_sym)
|
169
|
+
transformed_hash = {}
|
170
|
+
openapi_types.each_pair do |key, type|
|
171
|
+
if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil?
|
172
|
+
transformed_hash["#{key}"] = nil
|
176
173
|
elsif type =~ /\AArray<(.*)>/i
|
177
174
|
# check to ensure the input is an array given that the attribute
|
178
175
|
# is documented as an array but the input is not
|
179
|
-
if attributes[
|
180
|
-
|
176
|
+
if attributes[attribute_map[key]].is_a?(Array)
|
177
|
+
transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) }
|
181
178
|
end
|
182
|
-
elsif !attributes[
|
183
|
-
|
179
|
+
elsif !attributes[attribute_map[key]].nil?
|
180
|
+
transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]])
|
184
181
|
end
|
185
182
|
end
|
186
|
-
|
187
|
-
self
|
183
|
+
new(transformed_hash)
|
188
184
|
end
|
189
185
|
|
190
186
|
# Deserializes the data based on type
|
191
187
|
# @param string type Data type
|
192
188
|
# @param string value Value to be deserialized
|
193
189
|
# @return [Object] Deserialized data
|
194
|
-
def _deserialize(type, value)
|
190
|
+
def self._deserialize(type, value)
|
195
191
|
case type.to_sym
|
196
192
|
when :Time
|
197
193
|
Time.parse(value)
|
@@ -226,7 +222,7 @@ module Shotstack
|
|
226
222
|
else # model
|
227
223
|
# models (e.g. Pet) or oneOf
|
228
224
|
klass = Shotstack.const_get(type)
|
229
|
-
klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
|
225
|
+
klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
|
230
226
|
end
|
231
227
|
end
|
232
228
|
|
@@ -0,0 +1,244 @@
|
|
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 details of the file to be ingested and any transformations to be applied. Once the source file has been ingested, new renditions can be created from it. The renditions are specified in the **outputs** property. A rendition is a new version, generated from the source. This can be used to create new sizes and aspect ratios tht serve different purposes within an application.
|
18
|
+
class Source
|
19
|
+
# The URL of the file to be ingested. The URL must be publicly accessible or include credentials.
|
20
|
+
attr_accessor :url
|
21
|
+
|
22
|
+
attr_accessor :outputs
|
23
|
+
|
24
|
+
attr_accessor :destinations
|
25
|
+
|
26
|
+
# An optional webhook callback URL used to receive status notifications when sources are uploaded and renditions processed.
|
27
|
+
attr_accessor :callback
|
28
|
+
|
29
|
+
# Attribute mapping from ruby-style variable name to JSON key.
|
30
|
+
def self.attribute_map
|
31
|
+
{
|
32
|
+
:'url' => :'url',
|
33
|
+
:'outputs' => :'outputs',
|
34
|
+
:'destinations' => :'destinations',
|
35
|
+
:'callback' => :'callback'
|
36
|
+
}
|
37
|
+
end
|
38
|
+
|
39
|
+
# Returns all the JSON keys this model knows about
|
40
|
+
def self.acceptable_attributes
|
41
|
+
attribute_map.values
|
42
|
+
end
|
43
|
+
|
44
|
+
# Attribute type mapping.
|
45
|
+
def self.openapi_types
|
46
|
+
{
|
47
|
+
:'url' => :'String',
|
48
|
+
:'outputs' => :'Outputs',
|
49
|
+
:'destinations' => :'Destinations',
|
50
|
+
:'callback' => :'String'
|
51
|
+
}
|
52
|
+
end
|
53
|
+
|
54
|
+
# List of attributes with nullable: true
|
55
|
+
def self.openapi_nullable
|
56
|
+
Set.new([
|
57
|
+
])
|
58
|
+
end
|
59
|
+
|
60
|
+
# Initializes the object
|
61
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
62
|
+
def initialize(attributes = {})
|
63
|
+
if (!attributes.is_a?(Hash))
|
64
|
+
fail ArgumentError, "The input argument (attributes) must be a hash in `Shotstack::Source` initialize method"
|
65
|
+
end
|
66
|
+
|
67
|
+
# check to see if the attribute exists and convert string to symbol for hash key
|
68
|
+
attributes = attributes.each_with_object({}) { |(k, v), h|
|
69
|
+
if (!self.class.attribute_map.key?(k.to_sym))
|
70
|
+
fail ArgumentError, "`#{k}` is not a valid attribute in `Shotstack::Source`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
|
71
|
+
end
|
72
|
+
h[k.to_sym] = v
|
73
|
+
}
|
74
|
+
|
75
|
+
if attributes.key?(:'url')
|
76
|
+
self.url = attributes[:'url']
|
77
|
+
end
|
78
|
+
|
79
|
+
if attributes.key?(:'outputs')
|
80
|
+
self.outputs = attributes[:'outputs']
|
81
|
+
end
|
82
|
+
|
83
|
+
if attributes.key?(:'destinations')
|
84
|
+
self.destinations = attributes[:'destinations']
|
85
|
+
end
|
86
|
+
|
87
|
+
if attributes.key?(:'callback')
|
88
|
+
self.callback = attributes[:'callback']
|
89
|
+
end
|
90
|
+
end
|
91
|
+
|
92
|
+
# Show invalid properties with the reasons. Usually used together with valid?
|
93
|
+
# @return Array for valid properties with the reasons
|
94
|
+
def list_invalid_properties
|
95
|
+
warn '[DEPRECATED] the `list_invalid_properties` method is obsolete'
|
96
|
+
invalid_properties = Array.new
|
97
|
+
invalid_properties
|
98
|
+
end
|
99
|
+
|
100
|
+
# Check to see if the all the properties in the model are valid
|
101
|
+
# @return true if the model is valid
|
102
|
+
def valid?
|
103
|
+
warn '[DEPRECATED] the `valid?` method is obsolete'
|
104
|
+
true
|
105
|
+
end
|
106
|
+
|
107
|
+
# Checks equality by comparing each attribute.
|
108
|
+
# @param [Object] Object to be compared
|
109
|
+
def ==(o)
|
110
|
+
return true if self.equal?(o)
|
111
|
+
self.class == o.class &&
|
112
|
+
url == o.url &&
|
113
|
+
outputs == o.outputs &&
|
114
|
+
destinations == o.destinations &&
|
115
|
+
callback == o.callback
|
116
|
+
end
|
117
|
+
|
118
|
+
# @see the `==` method
|
119
|
+
# @param [Object] Object to be compared
|
120
|
+
def eql?(o)
|
121
|
+
self == o
|
122
|
+
end
|
123
|
+
|
124
|
+
# Calculates hash code according to all attributes.
|
125
|
+
# @return [Integer] Hash code
|
126
|
+
def hash
|
127
|
+
[url, outputs, destinations, callback].hash
|
128
|
+
end
|
129
|
+
|
130
|
+
# Builds the object from hash
|
131
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
132
|
+
# @return [Object] Returns the model itself
|
133
|
+
def self.build_from_hash(attributes)
|
134
|
+
return nil unless attributes.is_a?(Hash)
|
135
|
+
attributes = attributes.transform_keys(&:to_sym)
|
136
|
+
transformed_hash = {}
|
137
|
+
openapi_types.each_pair do |key, type|
|
138
|
+
if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil?
|
139
|
+
transformed_hash["#{key}"] = nil
|
140
|
+
elsif type =~ /\AArray<(.*)>/i
|
141
|
+
# check to ensure the input is an array given that the attribute
|
142
|
+
# is documented as an array but the input is not
|
143
|
+
if attributes[attribute_map[key]].is_a?(Array)
|
144
|
+
transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) }
|
145
|
+
end
|
146
|
+
elsif !attributes[attribute_map[key]].nil?
|
147
|
+
transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]])
|
148
|
+
end
|
149
|
+
end
|
150
|
+
new(transformed_hash)
|
151
|
+
end
|
152
|
+
|
153
|
+
# Deserializes the data based on type
|
154
|
+
# @param string type Data type
|
155
|
+
# @param string value Value to be deserialized
|
156
|
+
# @return [Object] Deserialized data
|
157
|
+
def self._deserialize(type, value)
|
158
|
+
case type.to_sym
|
159
|
+
when :Time
|
160
|
+
Time.parse(value)
|
161
|
+
when :Date
|
162
|
+
Date.parse(value)
|
163
|
+
when :String
|
164
|
+
value.to_s
|
165
|
+
when :Integer
|
166
|
+
value.to_i
|
167
|
+
when :Float
|
168
|
+
value.to_f
|
169
|
+
when :Boolean
|
170
|
+
if value.to_s =~ /\A(true|t|yes|y|1)\z/i
|
171
|
+
true
|
172
|
+
else
|
173
|
+
false
|
174
|
+
end
|
175
|
+
when :Object
|
176
|
+
# generic object (usually a Hash), return directly
|
177
|
+
value
|
178
|
+
when /\AArray<(?<inner_type>.+)>\z/
|
179
|
+
inner_type = Regexp.last_match[:inner_type]
|
180
|
+
value.map { |v| _deserialize(inner_type, v) }
|
181
|
+
when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
|
182
|
+
k_type = Regexp.last_match[:k_type]
|
183
|
+
v_type = Regexp.last_match[:v_type]
|
184
|
+
{}.tap do |hash|
|
185
|
+
value.each do |k, v|
|
186
|
+
hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
|
187
|
+
end
|
188
|
+
end
|
189
|
+
else # model
|
190
|
+
# models (e.g. Pet) or oneOf
|
191
|
+
klass = Shotstack.const_get(type)
|
192
|
+
klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
|
193
|
+
end
|
194
|
+
end
|
195
|
+
|
196
|
+
# Returns the string representation of the object
|
197
|
+
# @return [String] String presentation of the object
|
198
|
+
def to_s
|
199
|
+
to_hash.to_s
|
200
|
+
end
|
201
|
+
|
202
|
+
# to_body is an alias to to_hash (backward compatibility)
|
203
|
+
# @return [Hash] Returns the object in the form of hash
|
204
|
+
def to_body
|
205
|
+
to_hash
|
206
|
+
end
|
207
|
+
|
208
|
+
# Returns the object in the form of hash
|
209
|
+
# @return [Hash] Returns the object in the form of hash
|
210
|
+
def to_hash
|
211
|
+
hash = {}
|
212
|
+
self.class.attribute_map.each_pair do |attr, param|
|
213
|
+
value = self.send(attr)
|
214
|
+
if value.nil?
|
215
|
+
is_nullable = self.class.openapi_nullable.include?(attr)
|
216
|
+
next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
|
217
|
+
end
|
218
|
+
|
219
|
+
hash[param] = _to_hash(value)
|
220
|
+
end
|
221
|
+
hash
|
222
|
+
end
|
223
|
+
|
224
|
+
# Outputs non-array value in the form of hash
|
225
|
+
# For object, use to_hash. Otherwise, just return the value
|
226
|
+
# @param [Object] value Any valid value
|
227
|
+
# @return [Hash] Returns the value in the form of hash
|
228
|
+
def _to_hash(value)
|
229
|
+
if value.is_a?(Array)
|
230
|
+
value.compact.map { |v| _to_hash(v) }
|
231
|
+
elsif value.is_a?(Hash)
|
232
|
+
{}.tap do |hash|
|
233
|
+
value.each { |k, v| hash[k] = _to_hash(v) }
|
234
|
+
end
|
235
|
+
elsif value.respond_to? :to_hash
|
236
|
+
value.to_hash
|
237
|
+
else
|
238
|
+
value
|
239
|
+
end
|
240
|
+
end
|
241
|
+
|
242
|
+
end
|
243
|
+
|
244
|
+
end
|