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
@@ -0,0 +1,390 @@
|
|
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
|
+
# Options for the Stability AI text-to-image service. Set a text prompt to generate an image from plus other engine and configuration options. The output will be generated as a JPG file available at the URL returned in the response.
|
18
|
+
class StabilityAiTextToImageOptions
|
19
|
+
# The type of asset to generate - set to `text-to-image` for text-to-image.
|
20
|
+
attr_accessor :type
|
21
|
+
|
22
|
+
# The text prompt to generate an image from.
|
23
|
+
attr_accessor :prompt
|
24
|
+
|
25
|
+
# The engine (model) to use for generating the image. Select from the list of available engines: <ul> <li>`stable-diffusion-xl-1024-v0-9`</li> <li>`stable-diffusion-xl-1024-v1-0`</li> <li>`stable-diffusion-v1-6`</li> <li>`stable-diffusion-512-v2-1`</li> <li>`stable-diffusion-xl-beta-v2-2-2`</li> </ul>
|
26
|
+
attr_accessor :engine
|
27
|
+
|
28
|
+
# The width of the image in pixels. Must be divisible by 64.
|
29
|
+
attr_accessor :width
|
30
|
+
|
31
|
+
# The height of the image in pixels. Must be divisible by 64.
|
32
|
+
attr_accessor :height
|
33
|
+
|
34
|
+
# The number of iterative diffusion steps to run. A number between 10 and 50.
|
35
|
+
attr_accessor :steps
|
36
|
+
|
37
|
+
# Using the same seed can help you create images that look similar. Set to 0 for a random seed. A number between 0 and 4294967295.
|
38
|
+
attr_accessor :seed
|
39
|
+
|
40
|
+
# Determines how closely the generated image will match the prompt. Lower numbers allow for more creative freedom. A number between 0 and 35.
|
41
|
+
attr_accessor :cfg_scale
|
42
|
+
|
43
|
+
# Apply a preset to generate an image in a particular style. Select from the list of available presets: <ul> <li>`3d-model`</li> <li>`analog-film`</li> <li>`anime`</li> <li>`cinematic`</li> <li>`comic-book`</li> <li>`digital-art`</li> <li>`enhance`</li> <li>`fantasy-art`</li> <li>`isometric`</li> <li>`line-art`</li> <li>`low-poly`</li> <li>`modeling-compound`</li> <li>`neon-punk`</li> <li>`origami`</li> <li>`photographic`</li> <li>`pixel-art`</li> <li>`tile-texture`</li> </ul>
|
44
|
+
attr_accessor :style_preset
|
45
|
+
|
46
|
+
class EnumAttributeValidator
|
47
|
+
attr_reader :datatype
|
48
|
+
attr_reader :allowable_values
|
49
|
+
|
50
|
+
def initialize(datatype, allowable_values)
|
51
|
+
@allowable_values = allowable_values.map do |value|
|
52
|
+
case datatype.to_s
|
53
|
+
when /Integer/i
|
54
|
+
value.to_i
|
55
|
+
when /Float/i
|
56
|
+
value.to_f
|
57
|
+
else
|
58
|
+
value
|
59
|
+
end
|
60
|
+
end
|
61
|
+
end
|
62
|
+
|
63
|
+
def valid?(value)
|
64
|
+
!value || allowable_values.include?(value)
|
65
|
+
end
|
66
|
+
end
|
67
|
+
|
68
|
+
# Attribute mapping from ruby-style variable name to JSON key.
|
69
|
+
def self.attribute_map
|
70
|
+
{
|
71
|
+
:'type' => :'type',
|
72
|
+
:'prompt' => :'prompt',
|
73
|
+
:'engine' => :'engine',
|
74
|
+
:'width' => :'width',
|
75
|
+
:'height' => :'height',
|
76
|
+
:'steps' => :'steps',
|
77
|
+
:'seed' => :'seed',
|
78
|
+
:'cfg_scale' => :'cfgScale',
|
79
|
+
:'style_preset' => :'stylePreset'
|
80
|
+
}
|
81
|
+
end
|
82
|
+
|
83
|
+
# Returns all the JSON keys this model knows about
|
84
|
+
def self.acceptable_attributes
|
85
|
+
attribute_map.values
|
86
|
+
end
|
87
|
+
|
88
|
+
# Attribute type mapping.
|
89
|
+
def self.openapi_types
|
90
|
+
{
|
91
|
+
:'type' => :'String',
|
92
|
+
:'prompt' => :'String',
|
93
|
+
:'engine' => :'String',
|
94
|
+
:'width' => :'Integer',
|
95
|
+
:'height' => :'Integer',
|
96
|
+
:'steps' => :'Integer',
|
97
|
+
:'seed' => :'Integer',
|
98
|
+
:'cfg_scale' => :'Float',
|
99
|
+
:'style_preset' => :'String'
|
100
|
+
}
|
101
|
+
end
|
102
|
+
|
103
|
+
# List of attributes with nullable: true
|
104
|
+
def self.openapi_nullable
|
105
|
+
Set.new([
|
106
|
+
])
|
107
|
+
end
|
108
|
+
|
109
|
+
# Initializes the object
|
110
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
111
|
+
def initialize(attributes = {})
|
112
|
+
if (!attributes.is_a?(Hash))
|
113
|
+
fail ArgumentError, "The input argument (attributes) must be a hash in `Shotstack::StabilityAiTextToImageOptions` initialize method"
|
114
|
+
end
|
115
|
+
|
116
|
+
# check to see if the attribute exists and convert string to symbol for hash key
|
117
|
+
attributes = attributes.each_with_object({}) { |(k, v), h|
|
118
|
+
if (!self.class.attribute_map.key?(k.to_sym))
|
119
|
+
fail ArgumentError, "`#{k}` is not a valid attribute in `Shotstack::StabilityAiTextToImageOptions`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
|
120
|
+
end
|
121
|
+
h[k.to_sym] = v
|
122
|
+
}
|
123
|
+
|
124
|
+
if attributes.key?(:'type')
|
125
|
+
self.type = attributes[:'type']
|
126
|
+
else
|
127
|
+
self.type = 'text-to-image'
|
128
|
+
end
|
129
|
+
|
130
|
+
if attributes.key?(:'prompt')
|
131
|
+
self.prompt = attributes[:'prompt']
|
132
|
+
else
|
133
|
+
self.prompt = nil
|
134
|
+
end
|
135
|
+
|
136
|
+
if attributes.key?(:'engine')
|
137
|
+
self.engine = attributes[:'engine']
|
138
|
+
else
|
139
|
+
self.engine = 'stable-diffusion-xl-1024-v1-0'
|
140
|
+
end
|
141
|
+
|
142
|
+
if attributes.key?(:'width')
|
143
|
+
self.width = attributes[:'width']
|
144
|
+
else
|
145
|
+
self.width = nil
|
146
|
+
end
|
147
|
+
|
148
|
+
if attributes.key?(:'height')
|
149
|
+
self.height = attributes[:'height']
|
150
|
+
else
|
151
|
+
self.height = nil
|
152
|
+
end
|
153
|
+
|
154
|
+
if attributes.key?(:'steps')
|
155
|
+
self.steps = attributes[:'steps']
|
156
|
+
else
|
157
|
+
self.steps = 30
|
158
|
+
end
|
159
|
+
|
160
|
+
if attributes.key?(:'seed')
|
161
|
+
self.seed = attributes[:'seed']
|
162
|
+
else
|
163
|
+
self.seed = 0
|
164
|
+
end
|
165
|
+
|
166
|
+
if attributes.key?(:'cfg_scale')
|
167
|
+
self.cfg_scale = attributes[:'cfg_scale']
|
168
|
+
else
|
169
|
+
self.cfg_scale = 7
|
170
|
+
end
|
171
|
+
|
172
|
+
if attributes.key?(:'style_preset')
|
173
|
+
self.style_preset = attributes[:'style_preset']
|
174
|
+
end
|
175
|
+
end
|
176
|
+
|
177
|
+
# Show invalid properties with the reasons. Usually used together with valid?
|
178
|
+
# @return Array for valid properties with the reasons
|
179
|
+
def list_invalid_properties
|
180
|
+
warn '[DEPRECATED] the `list_invalid_properties` method is obsolete'
|
181
|
+
invalid_properties = Array.new
|
182
|
+
if @type.nil?
|
183
|
+
invalid_properties.push('invalid value for "type", type cannot be nil.')
|
184
|
+
end
|
185
|
+
|
186
|
+
if @prompt.nil?
|
187
|
+
invalid_properties.push('invalid value for "prompt", prompt cannot be nil.')
|
188
|
+
end
|
189
|
+
|
190
|
+
if @width.nil?
|
191
|
+
invalid_properties.push('invalid value for "width", width cannot be nil.')
|
192
|
+
end
|
193
|
+
|
194
|
+
if @height.nil?
|
195
|
+
invalid_properties.push('invalid value for "height", height cannot be nil.')
|
196
|
+
end
|
197
|
+
|
198
|
+
invalid_properties
|
199
|
+
end
|
200
|
+
|
201
|
+
# Check to see if the all the properties in the model are valid
|
202
|
+
# @return true if the model is valid
|
203
|
+
def valid?
|
204
|
+
warn '[DEPRECATED] the `valid?` method is obsolete'
|
205
|
+
return false if @type.nil?
|
206
|
+
type_validator = EnumAttributeValidator.new('String', ["text-to-image"])
|
207
|
+
return false unless type_validator.valid?(@type)
|
208
|
+
return false if @prompt.nil?
|
209
|
+
engine_validator = EnumAttributeValidator.new('String', ["stable-diffusion-xl-1024-v0-9", "stable-diffusion-xl-1024-v1-0", "stable-diffusion-v1-6", "stable-diffusion-512-v2-1", "stable-diffusion-xl-beta-v2-2-2"])
|
210
|
+
return false unless engine_validator.valid?(@engine)
|
211
|
+
return false if @width.nil?
|
212
|
+
return false if @height.nil?
|
213
|
+
style_preset_validator = EnumAttributeValidator.new('String', ["3d-model", "analog-film", "anime", "cinematic", "comic-book", "digital-art", "enhance", "fantasy-art", "isometric", "line-art", "low-poly", "modeling-compound", "neon-punk", "origami", "photographic", "pixel-art", "tile-texture"])
|
214
|
+
return false unless style_preset_validator.valid?(@style_preset)
|
215
|
+
true
|
216
|
+
end
|
217
|
+
|
218
|
+
# Custom attribute writer method checking allowed values (enum).
|
219
|
+
# @param [Object] type Object to be assigned
|
220
|
+
def type=(type)
|
221
|
+
validator = EnumAttributeValidator.new('String', ["text-to-image"])
|
222
|
+
unless validator.valid?(type)
|
223
|
+
fail ArgumentError, "invalid value for \"type\", must be one of #{validator.allowable_values}."
|
224
|
+
end
|
225
|
+
@type = type
|
226
|
+
end
|
227
|
+
|
228
|
+
# Custom attribute writer method checking allowed values (enum).
|
229
|
+
# @param [Object] engine Object to be assigned
|
230
|
+
def engine=(engine)
|
231
|
+
validator = EnumAttributeValidator.new('String', ["stable-diffusion-xl-1024-v0-9", "stable-diffusion-xl-1024-v1-0", "stable-diffusion-v1-6", "stable-diffusion-512-v2-1", "stable-diffusion-xl-beta-v2-2-2"])
|
232
|
+
unless validator.valid?(engine)
|
233
|
+
fail ArgumentError, "invalid value for \"engine\", must be one of #{validator.allowable_values}."
|
234
|
+
end
|
235
|
+
@engine = engine
|
236
|
+
end
|
237
|
+
|
238
|
+
# Custom attribute writer method checking allowed values (enum).
|
239
|
+
# @param [Object] style_preset Object to be assigned
|
240
|
+
def style_preset=(style_preset)
|
241
|
+
validator = EnumAttributeValidator.new('String', ["3d-model", "analog-film", "anime", "cinematic", "comic-book", "digital-art", "enhance", "fantasy-art", "isometric", "line-art", "low-poly", "modeling-compound", "neon-punk", "origami", "photographic", "pixel-art", "tile-texture"])
|
242
|
+
unless validator.valid?(style_preset)
|
243
|
+
fail ArgumentError, "invalid value for \"style_preset\", must be one of #{validator.allowable_values}."
|
244
|
+
end
|
245
|
+
@style_preset = style_preset
|
246
|
+
end
|
247
|
+
|
248
|
+
# Checks equality by comparing each attribute.
|
249
|
+
# @param [Object] Object to be compared
|
250
|
+
def ==(o)
|
251
|
+
return true if self.equal?(o)
|
252
|
+
self.class == o.class &&
|
253
|
+
type == o.type &&
|
254
|
+
prompt == o.prompt &&
|
255
|
+
engine == o.engine &&
|
256
|
+
width == o.width &&
|
257
|
+
height == o.height &&
|
258
|
+
steps == o.steps &&
|
259
|
+
seed == o.seed &&
|
260
|
+
cfg_scale == o.cfg_scale &&
|
261
|
+
style_preset == o.style_preset
|
262
|
+
end
|
263
|
+
|
264
|
+
# @see the `==` method
|
265
|
+
# @param [Object] Object to be compared
|
266
|
+
def eql?(o)
|
267
|
+
self == o
|
268
|
+
end
|
269
|
+
|
270
|
+
# Calculates hash code according to all attributes.
|
271
|
+
# @return [Integer] Hash code
|
272
|
+
def hash
|
273
|
+
[type, prompt, engine, width, height, steps, seed, cfg_scale, style_preset].hash
|
274
|
+
end
|
275
|
+
|
276
|
+
# Builds the object from hash
|
277
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
278
|
+
# @return [Object] Returns the model itself
|
279
|
+
def self.build_from_hash(attributes)
|
280
|
+
return nil unless attributes.is_a?(Hash)
|
281
|
+
attributes = attributes.transform_keys(&:to_sym)
|
282
|
+
transformed_hash = {}
|
283
|
+
openapi_types.each_pair do |key, type|
|
284
|
+
if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil?
|
285
|
+
transformed_hash["#{key}"] = nil
|
286
|
+
elsif type =~ /\AArray<(.*)>/i
|
287
|
+
# check to ensure the input is an array given that the attribute
|
288
|
+
# is documented as an array but the input is not
|
289
|
+
if attributes[attribute_map[key]].is_a?(Array)
|
290
|
+
transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) }
|
291
|
+
end
|
292
|
+
elsif !attributes[attribute_map[key]].nil?
|
293
|
+
transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]])
|
294
|
+
end
|
295
|
+
end
|
296
|
+
new(transformed_hash)
|
297
|
+
end
|
298
|
+
|
299
|
+
# Deserializes the data based on type
|
300
|
+
# @param string type Data type
|
301
|
+
# @param string value Value to be deserialized
|
302
|
+
# @return [Object] Deserialized data
|
303
|
+
def self._deserialize(type, value)
|
304
|
+
case type.to_sym
|
305
|
+
when :Time
|
306
|
+
Time.parse(value)
|
307
|
+
when :Date
|
308
|
+
Date.parse(value)
|
309
|
+
when :String
|
310
|
+
value.to_s
|
311
|
+
when :Integer
|
312
|
+
value.to_i
|
313
|
+
when :Float
|
314
|
+
value.to_f
|
315
|
+
when :Boolean
|
316
|
+
if value.to_s =~ /\A(true|t|yes|y|1)\z/i
|
317
|
+
true
|
318
|
+
else
|
319
|
+
false
|
320
|
+
end
|
321
|
+
when :Object
|
322
|
+
# generic object (usually a Hash), return directly
|
323
|
+
value
|
324
|
+
when /\AArray<(?<inner_type>.+)>\z/
|
325
|
+
inner_type = Regexp.last_match[:inner_type]
|
326
|
+
value.map { |v| _deserialize(inner_type, v) }
|
327
|
+
when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
|
328
|
+
k_type = Regexp.last_match[:k_type]
|
329
|
+
v_type = Regexp.last_match[:v_type]
|
330
|
+
{}.tap do |hash|
|
331
|
+
value.each do |k, v|
|
332
|
+
hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
|
333
|
+
end
|
334
|
+
end
|
335
|
+
else # model
|
336
|
+
# models (e.g. Pet) or oneOf
|
337
|
+
klass = Shotstack.const_get(type)
|
338
|
+
klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
|
339
|
+
end
|
340
|
+
end
|
341
|
+
|
342
|
+
# Returns the string representation of the object
|
343
|
+
# @return [String] String presentation of the object
|
344
|
+
def to_s
|
345
|
+
to_hash.to_s
|
346
|
+
end
|
347
|
+
|
348
|
+
# to_body is an alias to to_hash (backward compatibility)
|
349
|
+
# @return [Hash] Returns the object in the form of hash
|
350
|
+
def to_body
|
351
|
+
to_hash
|
352
|
+
end
|
353
|
+
|
354
|
+
# Returns the object in the form of hash
|
355
|
+
# @return [Hash] Returns the object in the form of hash
|
356
|
+
def to_hash
|
357
|
+
hash = {}
|
358
|
+
self.class.attribute_map.each_pair do |attr, param|
|
359
|
+
value = self.send(attr)
|
360
|
+
if value.nil?
|
361
|
+
is_nullable = self.class.openapi_nullable.include?(attr)
|
362
|
+
next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
|
363
|
+
end
|
364
|
+
|
365
|
+
hash[param] = _to_hash(value)
|
366
|
+
end
|
367
|
+
hash
|
368
|
+
end
|
369
|
+
|
370
|
+
# Outputs non-array value in the form of hash
|
371
|
+
# For object, use to_hash. Otherwise, just return the value
|
372
|
+
# @param [Object] value Any valid value
|
373
|
+
# @return [Hash] Returns the value in the form of hash
|
374
|
+
def _to_hash(value)
|
375
|
+
if value.is_a?(Array)
|
376
|
+
value.compact.map { |v| _to_hash(v) }
|
377
|
+
elsif value.is_a?(Hash)
|
378
|
+
{}.tap do |hash|
|
379
|
+
value.each { |k, v| hash[k] = _to_hash(v) }
|
380
|
+
end
|
381
|
+
elsif value.respond_to? :to_hash
|
382
|
+
value.to_hash
|
383
|
+
else
|
384
|
+
value
|
385
|
+
end
|
386
|
+
end
|
387
|
+
|
388
|
+
end
|
389
|
+
|
390
|
+
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
|
|
@@ -65,6 +65,8 @@ module Shotstack
|
|
65
65
|
|
66
66
|
if attributes.key?(:'name')
|
67
67
|
self.name = attributes[:'name']
|
68
|
+
else
|
69
|
+
self.name = nil
|
68
70
|
end
|
69
71
|
|
70
72
|
if attributes.key?(:'template')
|
@@ -75,6 +77,7 @@ module Shotstack
|
|
75
77
|
# Show invalid properties with the reasons. Usually used together with valid?
|
76
78
|
# @return Array for valid properties with the reasons
|
77
79
|
def list_invalid_properties
|
80
|
+
warn '[DEPRECATED] the `list_invalid_properties` method is obsolete'
|
78
81
|
invalid_properties = Array.new
|
79
82
|
if @name.nil?
|
80
83
|
invalid_properties.push('invalid value for "name", name cannot be nil.')
|
@@ -86,6 +89,7 @@ module Shotstack
|
|
86
89
|
# Check to see if the all the properties in the model are valid
|
87
90
|
# @return true if the model is valid
|
88
91
|
def valid?
|
92
|
+
warn '[DEPRECATED] the `valid?` method is obsolete'
|
89
93
|
return false if @name.nil?
|
90
94
|
true
|
91
95
|
end
|
@@ -115,36 +119,30 @@ module Shotstack
|
|
115
119
|
# @param [Hash] attributes Model attributes in the form of hash
|
116
120
|
# @return [Object] Returns the model itself
|
117
121
|
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
122
|
return nil unless attributes.is_a?(Hash)
|
126
|
-
|
127
|
-
|
128
|
-
|
123
|
+
attributes = attributes.transform_keys(&:to_sym)
|
124
|
+
transformed_hash = {}
|
125
|
+
openapi_types.each_pair do |key, type|
|
126
|
+
if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil?
|
127
|
+
transformed_hash["#{key}"] = nil
|
129
128
|
elsif type =~ /\AArray<(.*)>/i
|
130
129
|
# check to ensure the input is an array given that the attribute
|
131
130
|
# is documented as an array but the input is not
|
132
|
-
if attributes[
|
133
|
-
|
131
|
+
if attributes[attribute_map[key]].is_a?(Array)
|
132
|
+
transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) }
|
134
133
|
end
|
135
|
-
elsif !attributes[
|
136
|
-
|
134
|
+
elsif !attributes[attribute_map[key]].nil?
|
135
|
+
transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]])
|
137
136
|
end
|
138
137
|
end
|
139
|
-
|
140
|
-
self
|
138
|
+
new(transformed_hash)
|
141
139
|
end
|
142
140
|
|
143
141
|
# Deserializes the data based on type
|
144
142
|
# @param string type Data type
|
145
143
|
# @param string value Value to be deserialized
|
146
144
|
# @return [Object] Deserialized data
|
147
|
-
def _deserialize(type, value)
|
145
|
+
def self._deserialize(type, value)
|
148
146
|
case type.to_sym
|
149
147
|
when :Time
|
150
148
|
Time.parse(value)
|
@@ -179,7 +177,7 @@ module Shotstack
|
|
179
177
|
else # model
|
180
178
|
# models (e.g. Pet) or oneOf
|
181
179
|
klass = Shotstack.const_get(type)
|
182
|
-
klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
|
180
|
+
klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
|
183
181
|
end
|
184
182
|
end
|
185
183
|
|
@@ -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,9 +14,9 @@ require 'date'
|
|
14
14
|
require 'time'
|
15
15
|
|
16
16
|
module Shotstack
|
17
|
-
# The template data including the template name and Edit.
|
17
|
+
# The template data including the template name and [Edit](#tocs_edit).
|
18
18
|
class TemplateDataResponse
|
19
|
-
# `true` if successfully
|
19
|
+
# `true` if successfully returned, else `false`.
|
20
20
|
attr_accessor :success
|
21
21
|
|
22
22
|
# `OK`, `Bad Request` or an error message.
|
@@ -70,20 +70,27 @@ module Shotstack
|
|
70
70
|
|
71
71
|
if attributes.key?(:'success')
|
72
72
|
self.success = attributes[:'success']
|
73
|
+
else
|
74
|
+
self.success = nil
|
73
75
|
end
|
74
76
|
|
75
77
|
if attributes.key?(:'message')
|
76
78
|
self.message = attributes[:'message']
|
79
|
+
else
|
80
|
+
self.message = nil
|
77
81
|
end
|
78
82
|
|
79
83
|
if attributes.key?(:'response')
|
80
84
|
self.response = attributes[:'response']
|
85
|
+
else
|
86
|
+
self.response = nil
|
81
87
|
end
|
82
88
|
end
|
83
89
|
|
84
90
|
# Show invalid properties with the reasons. Usually used together with valid?
|
85
91
|
# @return Array for valid properties with the reasons
|
86
92
|
def list_invalid_properties
|
93
|
+
warn '[DEPRECATED] the `list_invalid_properties` method is obsolete'
|
87
94
|
invalid_properties = Array.new
|
88
95
|
if @success.nil?
|
89
96
|
invalid_properties.push('invalid value for "success", success cannot be nil.')
|
@@ -103,6 +110,7 @@ module Shotstack
|
|
103
110
|
# Check to see if the all the properties in the model are valid
|
104
111
|
# @return true if the model is valid
|
105
112
|
def valid?
|
113
|
+
warn '[DEPRECATED] the `valid?` method is obsolete'
|
106
114
|
return false if @success.nil?
|
107
115
|
return false if @message.nil?
|
108
116
|
return false if @response.nil?
|
@@ -135,36 +143,30 @@ module Shotstack
|
|
135
143
|
# @param [Hash] attributes Model attributes in the form of hash
|
136
144
|
# @return [Object] Returns the model itself
|
137
145
|
def self.build_from_hash(attributes)
|
138
|
-
new.build_from_hash(attributes)
|
139
|
-
end
|
140
|
-
|
141
|
-
# Builds the object from hash
|
142
|
-
# @param [Hash] attributes Model attributes in the form of hash
|
143
|
-
# @return [Object] Returns the model itself
|
144
|
-
def build_from_hash(attributes)
|
145
146
|
return nil unless attributes.is_a?(Hash)
|
146
|
-
|
147
|
-
|
148
|
-
|
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
|
149
152
|
elsif type =~ /\AArray<(.*)>/i
|
150
153
|
# check to ensure the input is an array given that the attribute
|
151
154
|
# is documented as an array but the input is not
|
152
|
-
if attributes[
|
153
|
-
|
155
|
+
if attributes[attribute_map[key]].is_a?(Array)
|
156
|
+
transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) }
|
154
157
|
end
|
155
|
-
elsif !attributes[
|
156
|
-
|
158
|
+
elsif !attributes[attribute_map[key]].nil?
|
159
|
+
transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]])
|
157
160
|
end
|
158
161
|
end
|
159
|
-
|
160
|
-
self
|
162
|
+
new(transformed_hash)
|
161
163
|
end
|
162
164
|
|
163
165
|
# Deserializes the data based on type
|
164
166
|
# @param string type Data type
|
165
167
|
# @param string value Value to be deserialized
|
166
168
|
# @return [Object] Deserialized data
|
167
|
-
def _deserialize(type, value)
|
169
|
+
def self._deserialize(type, value)
|
168
170
|
case type.to_sym
|
169
171
|
when :Time
|
170
172
|
Time.parse(value)
|
@@ -199,7 +201,7 @@ module Shotstack
|
|
199
201
|
else # model
|
200
202
|
# models (e.g. Pet) or oneOf
|
201
203
|
klass = Shotstack.const_get(type)
|
202
|
-
klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
|
204
|
+
klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
|
203
205
|
end
|
204
206
|
end
|
205
207
|
|