shotstack 0.2.2 → 0.2.6

Sign up to get free protection for your applications and to get access to all the features.
Files changed (121) hide show
  1. checksums.yaml +4 -4
  2. data/Gemfile +9 -0
  3. data/Rakefile +10 -0
  4. data/lib/shotstack/api/create_api.rb +158 -0
  5. data/lib/shotstack/api/edit_api.rb +20 -20
  6. data/lib/shotstack/api/ingest_api.rb +338 -0
  7. data/lib/shotstack/api/serve_api.rb +76 -8
  8. data/lib/shotstack/api_client.rb +28 -24
  9. data/lib/shotstack/api_error.rb +3 -2
  10. data/lib/shotstack/configuration.rb +55 -9
  11. data/lib/shotstack/models/asset.rb +3 -3
  12. data/lib/shotstack/models/asset_render_response.rb +18 -20
  13. data/lib/shotstack/models/asset_response.rb +18 -20
  14. data/lib/shotstack/models/asset_response_attributes.rb +23 -21
  15. data/lib/shotstack/models/asset_response_data.rb +20 -20
  16. data/lib/shotstack/models/audio_asset.rb +57 -21
  17. data/lib/shotstack/models/audio_enhancement.rb +43 -0
  18. data/lib/shotstack/models/clip.rb +27 -25
  19. data/lib/shotstack/models/crop.rb +40 -28
  20. data/lib/shotstack/models/destinations.rb +78 -243
  21. data/lib/shotstack/models/did_generated_asset.rb +273 -0
  22. data/lib/shotstack/models/did_generated_asset_options.rb +54 -0
  23. data/lib/shotstack/models/did_text_to_avatar_options.rb +313 -0
  24. data/lib/shotstack/models/dolby_enhancement.rb +239 -0
  25. data/lib/shotstack/models/dolby_enhancement_options.rb +257 -0
  26. data/lib/shotstack/models/edit.rb +22 -22
  27. data/lib/shotstack/models/eleven_labs_generated_asset.rb +273 -0
  28. data/lib/shotstack/models/eleven_labs_generated_asset_options.rb +54 -0
  29. data/lib/shotstack/models/eleven_labs_text_to_speech_options.rb +303 -0
  30. data/lib/shotstack/models/enhancements.rb +215 -0
  31. data/lib/shotstack/models/flip_transformation.rb +16 -20
  32. data/lib/shotstack/models/font.rb +18 -20
  33. data/lib/shotstack/models/generated_asset.rb +48 -0
  34. data/lib/shotstack/models/generated_asset_error_response.rb +225 -0
  35. data/lib/shotstack/models/generated_asset_error_response_data.rb +257 -0
  36. data/lib/shotstack/models/generated_asset_response.rb +222 -0
  37. data/lib/shotstack/models/generated_asset_response_attributes.rb +376 -0
  38. data/lib/shotstack/models/generated_asset_response_data.rb +256 -0
  39. data/lib/shotstack/models/google_cloud_storage_destination.rb +232 -0
  40. data/lib/shotstack/models/google_cloud_storage_destination_options.rb +243 -0
  41. data/lib/shotstack/models/google_drive_destination.rb +239 -0
  42. data/lib/shotstack/models/google_drive_destination_options.rb +233 -0
  43. data/lib/shotstack/models/hey_gen_generated_asset.rb +273 -0
  44. data/lib/shotstack/models/hey_gen_generated_asset_options.rb +54 -0
  45. data/lib/shotstack/models/hey_gen_text_to_avatar_options.rb +396 -0
  46. data/lib/shotstack/models/html_asset.rb +20 -22
  47. data/lib/shotstack/models/image_asset.rb +18 -20
  48. data/lib/shotstack/models/ingest_error_response.rb +225 -0
  49. data/lib/shotstack/models/ingest_error_response_data.rb +257 -0
  50. data/lib/shotstack/models/luma_asset.rb +18 -20
  51. data/lib/shotstack/models/merge_field.rb +20 -20
  52. data/lib/shotstack/models/mux_destination.rb +18 -22
  53. data/lib/shotstack/models/mux_destination_options.rb +50 -25
  54. data/lib/shotstack/models/offset.rb +28 -24
  55. data/lib/shotstack/models/open_ai_generated_asset.rb +273 -0
  56. data/lib/shotstack/models/open_ai_generated_asset_options.rb +54 -0
  57. data/lib/shotstack/models/open_ai_text_generator_options.rb +313 -0
  58. data/lib/shotstack/models/output.rb +27 -29
  59. data/lib/shotstack/models/outputs.rb +227 -0
  60. data/lib/shotstack/models/outputs_response.rb +218 -0
  61. data/lib/shotstack/models/poster.rb +18 -20
  62. data/lib/shotstack/models/probe_response.rb +22 -20
  63. data/lib/shotstack/models/queued_response.rb +22 -20
  64. data/lib/shotstack/models/queued_response_data.rb +20 -20
  65. data/lib/shotstack/models/queued_source_response.rb +222 -0
  66. data/lib/shotstack/models/queued_source_response_data.rb +240 -0
  67. data/lib/shotstack/models/range.rb +26 -22
  68. data/lib/shotstack/models/render_response.rb +22 -20
  69. data/lib/shotstack/models/render_response_data.rb +22 -20
  70. data/lib/shotstack/models/rendition.rb +429 -0
  71. data/lib/shotstack/models/rendition_response_attributes.rb +336 -0
  72. data/lib/shotstack/models/rotate_transformation.rb +16 -20
  73. data/lib/shotstack/models/s3_destination.rb +18 -22
  74. data/lib/shotstack/models/s3_destination_options.rb +21 -21
  75. data/lib/shotstack/models/shotstack_destination.rb +19 -23
  76. data/lib/shotstack/models/shotstack_generated_asset.rb +273 -0
  77. data/lib/shotstack/models/shotstack_generated_asset_options.rb +60 -0
  78. data/lib/shotstack/models/shotstack_image_to_video_options.rb +298 -0
  79. data/lib/shotstack/models/shotstack_text_generator_options.rb +274 -0
  80. data/lib/shotstack/models/shotstack_text_to_image_options.rb +308 -0
  81. data/lib/shotstack/models/shotstack_text_to_speech_options.rb +339 -0
  82. data/lib/shotstack/models/size.rb +36 -32
  83. data/lib/shotstack/models/skew_transformation.rb +16 -20
  84. data/lib/shotstack/models/soundtrack.rb +18 -20
  85. data/lib/shotstack/models/source.rb +244 -0
  86. data/lib/shotstack/models/source_list_response.rb +225 -0
  87. data/lib/shotstack/models/source_response.rb +222 -0
  88. data/lib/shotstack/models/source_response_attributes.rb +373 -0
  89. data/lib/shotstack/models/source_response_data.rb +256 -0
  90. data/lib/shotstack/models/speed.rb +254 -0
  91. data/lib/shotstack/models/stability_ai_generated_asset.rb +273 -0
  92. data/lib/shotstack/models/stability_ai_generated_asset_options.rb +54 -0
  93. data/lib/shotstack/models/stability_ai_text_to_image_options.rb +390 -0
  94. data/lib/shotstack/models/template.rb +18 -20
  95. data/lib/shotstack/models/template_data_response.rb +23 -21
  96. data/lib/shotstack/models/template_data_response_data.rb +24 -20
  97. data/lib/shotstack/models/template_list_response.rb +24 -22
  98. data/lib/shotstack/models/template_list_response_data.rb +20 -20
  99. data/lib/shotstack/models/template_list_response_item.rb +20 -20
  100. data/lib/shotstack/models/template_render.rb +18 -20
  101. data/lib/shotstack/models/template_response.rb +22 -20
  102. data/lib/shotstack/models/template_response_data.rb +20 -20
  103. data/lib/shotstack/models/thumbnail.rb +20 -20
  104. data/lib/shotstack/models/timeline.rb +19 -21
  105. data/lib/shotstack/models/title_asset.rb +18 -20
  106. data/lib/shotstack/models/track.rb +18 -20
  107. data/lib/shotstack/models/transcription.rb +250 -0
  108. data/lib/shotstack/models/transfer.rb +259 -0
  109. data/lib/shotstack/models/transfer_response.rb +222 -0
  110. data/lib/shotstack/models/transfer_response_attributes.rb +280 -0
  111. data/lib/shotstack/models/transfer_response_data.rb +225 -0
  112. data/lib/shotstack/models/transformation.rb +16 -20
  113. data/lib/shotstack/models/transition.rb +16 -20
  114. data/lib/shotstack/models/upload_response.rb +222 -0
  115. data/lib/shotstack/models/upload_response_attributes.rb +257 -0
  116. data/lib/shotstack/models/upload_response_data.rb +256 -0
  117. data/lib/shotstack/models/video_asset.rb +57 -21
  118. data/lib/shotstack/version.rb +3 -3
  119. data/lib/shotstack.rb +61 -2
  120. data/shotstack.gemspec +8 -8
  121. metadata +69 -16
@@ -0,0 +1,54 @@
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
+ # Generate assets using OpenAI provider AI services. The following AI generation services are available: <ul> <li><a href=\"#tocs_openaitextgeneratoroptions\">OpenAiTextGeneratorOptions</a></li> </ul>
18
+ module OpenAiGeneratedAssetOptions
19
+ class << self
20
+ # List of class defined in oneOf (OpenAPI v3)
21
+ def openapi_one_of
22
+ [
23
+ :'OpenAiTextGeneratorOptions'
24
+ ]
25
+ end
26
+
27
+ # Discriminator's property name (OpenAPI v3)
28
+ def openapi_discriminator_name
29
+ :'type'
30
+ end
31
+
32
+ # Discriminator's mapping (OpenAPI v3)
33
+ def openapi_discriminator_mapping
34
+ {
35
+ :'text-generator' => :'OpenAiTextGeneratorOptions'
36
+ }
37
+ end
38
+
39
+ # Builds the object
40
+ # @param [Mixed] Data to be matched against the list of oneOf items
41
+ # @return [Object] Returns the model or the data itself
42
+ def build(data)
43
+ discriminator_value = data[openapi_discriminator_name]
44
+ return nil if discriminator_value.nil?
45
+
46
+ klass = openapi_discriminator_mapping[discriminator_value.to_s.to_sym]
47
+ return nil unless klass
48
+
49
+ Shotstack.const_get(klass).build_from_hash(data)
50
+ end
51
+ end
52
+ end
53
+
54
+ end
@@ -0,0 +1,313 @@
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 OpenAI text-generator service. Set a text prompt that will be used to generate a new body of text. The output will be generated as a text (txt) file available at the URL returned in the response.
18
+ class OpenAiTextGeneratorOptions
19
+ # The type of asset to generate - set to `text-generator` for text generation.
20
+ attr_accessor :type
21
+
22
+ # The text prompt to generate text from.
23
+ attr_accessor :prompt
24
+
25
+ # The model to use for generating the text. Select from the list of available models: <ul> <li>`gpt-3.5-turbo`</li> <li>`gpt-4`</li> </ul>
26
+ attr_accessor :model
27
+
28
+ # The system prompt to use for generating the text. This is an optional prompt that can be used to provide context or additional information to the model.
29
+ attr_accessor :system_prompt
30
+
31
+ class EnumAttributeValidator
32
+ attr_reader :datatype
33
+ attr_reader :allowable_values
34
+
35
+ def initialize(datatype, allowable_values)
36
+ @allowable_values = allowable_values.map do |value|
37
+ case datatype.to_s
38
+ when /Integer/i
39
+ value.to_i
40
+ when /Float/i
41
+ value.to_f
42
+ else
43
+ value
44
+ end
45
+ end
46
+ end
47
+
48
+ def valid?(value)
49
+ !value || allowable_values.include?(value)
50
+ end
51
+ end
52
+
53
+ # Attribute mapping from ruby-style variable name to JSON key.
54
+ def self.attribute_map
55
+ {
56
+ :'type' => :'type',
57
+ :'prompt' => :'prompt',
58
+ :'model' => :'model',
59
+ :'system_prompt' => :'systemPrompt'
60
+ }
61
+ end
62
+
63
+ # Returns all the JSON keys this model knows about
64
+ def self.acceptable_attributes
65
+ attribute_map.values
66
+ end
67
+
68
+ # Attribute type mapping.
69
+ def self.openapi_types
70
+ {
71
+ :'type' => :'String',
72
+ :'prompt' => :'String',
73
+ :'model' => :'String',
74
+ :'system_prompt' => :'String'
75
+ }
76
+ end
77
+
78
+ # List of attributes with nullable: true
79
+ def self.openapi_nullable
80
+ Set.new([
81
+ ])
82
+ end
83
+
84
+ # Initializes the object
85
+ # @param [Hash] attributes Model attributes in the form of hash
86
+ def initialize(attributes = {})
87
+ if (!attributes.is_a?(Hash))
88
+ fail ArgumentError, "The input argument (attributes) must be a hash in `Shotstack::OpenAiTextGeneratorOptions` initialize method"
89
+ end
90
+
91
+ # check to see if the attribute exists and convert string to symbol for hash key
92
+ attributes = attributes.each_with_object({}) { |(k, v), h|
93
+ if (!self.class.attribute_map.key?(k.to_sym))
94
+ fail ArgumentError, "`#{k}` is not a valid attribute in `Shotstack::OpenAiTextGeneratorOptions`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
95
+ end
96
+ h[k.to_sym] = v
97
+ }
98
+
99
+ if attributes.key?(:'type')
100
+ self.type = attributes[:'type']
101
+ else
102
+ self.type = 'text-generator'
103
+ end
104
+
105
+ if attributes.key?(:'prompt')
106
+ self.prompt = attributes[:'prompt']
107
+ else
108
+ self.prompt = nil
109
+ end
110
+
111
+ if attributes.key?(:'model')
112
+ self.model = attributes[:'model']
113
+ else
114
+ self.model = nil
115
+ end
116
+
117
+ if attributes.key?(:'system_prompt')
118
+ self.system_prompt = attributes[:'system_prompt']
119
+ end
120
+ end
121
+
122
+ # Show invalid properties with the reasons. Usually used together with valid?
123
+ # @return Array for valid properties with the reasons
124
+ def list_invalid_properties
125
+ warn '[DEPRECATED] the `list_invalid_properties` method is obsolete'
126
+ invalid_properties = Array.new
127
+ if @type.nil?
128
+ invalid_properties.push('invalid value for "type", type cannot be nil.')
129
+ end
130
+
131
+ if @prompt.nil?
132
+ invalid_properties.push('invalid value for "prompt", prompt cannot be nil.')
133
+ end
134
+
135
+ if @model.nil?
136
+ invalid_properties.push('invalid value for "model", model cannot be nil.')
137
+ end
138
+
139
+ invalid_properties
140
+ end
141
+
142
+ # Check to see if the all the properties in the model are valid
143
+ # @return true if the model is valid
144
+ def valid?
145
+ warn '[DEPRECATED] the `valid?` method is obsolete'
146
+ return false if @type.nil?
147
+ type_validator = EnumAttributeValidator.new('String', ["text-generator"])
148
+ return false unless type_validator.valid?(@type)
149
+ return false if @prompt.nil?
150
+ return false if @model.nil?
151
+ model_validator = EnumAttributeValidator.new('String', ["gpt-3.5-turbo", "gpt-4"])
152
+ return false unless model_validator.valid?(@model)
153
+ true
154
+ end
155
+
156
+ # Custom attribute writer method checking allowed values (enum).
157
+ # @param [Object] type Object to be assigned
158
+ def type=(type)
159
+ validator = EnumAttributeValidator.new('String', ["text-generator"])
160
+ unless validator.valid?(type)
161
+ fail ArgumentError, "invalid value for \"type\", must be one of #{validator.allowable_values}."
162
+ end
163
+ @type = type
164
+ end
165
+
166
+ # Custom attribute writer method checking allowed values (enum).
167
+ # @param [Object] model Object to be assigned
168
+ def model=(model)
169
+ validator = EnumAttributeValidator.new('String', ["gpt-3.5-turbo", "gpt-4"])
170
+ unless validator.valid?(model)
171
+ fail ArgumentError, "invalid value for \"model\", must be one of #{validator.allowable_values}."
172
+ end
173
+ @model = model
174
+ end
175
+
176
+ # Checks equality by comparing each attribute.
177
+ # @param [Object] Object to be compared
178
+ def ==(o)
179
+ return true if self.equal?(o)
180
+ self.class == o.class &&
181
+ type == o.type &&
182
+ prompt == o.prompt &&
183
+ model == o.model &&
184
+ system_prompt == o.system_prompt
185
+ end
186
+
187
+ # @see the `==` method
188
+ # @param [Object] Object to be compared
189
+ def eql?(o)
190
+ self == o
191
+ end
192
+
193
+ # Calculates hash code according to all attributes.
194
+ # @return [Integer] Hash code
195
+ def hash
196
+ [type, prompt, model, system_prompt].hash
197
+ end
198
+
199
+ # Builds the object from hash
200
+ # @param [Hash] attributes Model attributes in the form of hash
201
+ # @return [Object] Returns the model itself
202
+ def self.build_from_hash(attributes)
203
+ return nil unless attributes.is_a?(Hash)
204
+ attributes = attributes.transform_keys(&:to_sym)
205
+ transformed_hash = {}
206
+ openapi_types.each_pair do |key, type|
207
+ if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil?
208
+ transformed_hash["#{key}"] = nil
209
+ elsif type =~ /\AArray<(.*)>/i
210
+ # check to ensure the input is an array given that the attribute
211
+ # is documented as an array but the input is not
212
+ if attributes[attribute_map[key]].is_a?(Array)
213
+ transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) }
214
+ end
215
+ elsif !attributes[attribute_map[key]].nil?
216
+ transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]])
217
+ end
218
+ end
219
+ new(transformed_hash)
220
+ end
221
+
222
+ # Deserializes the data based on type
223
+ # @param string type Data type
224
+ # @param string value Value to be deserialized
225
+ # @return [Object] Deserialized data
226
+ def self._deserialize(type, value)
227
+ case type.to_sym
228
+ when :Time
229
+ Time.parse(value)
230
+ when :Date
231
+ Date.parse(value)
232
+ when :String
233
+ value.to_s
234
+ when :Integer
235
+ value.to_i
236
+ when :Float
237
+ value.to_f
238
+ when :Boolean
239
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
240
+ true
241
+ else
242
+ false
243
+ end
244
+ when :Object
245
+ # generic object (usually a Hash), return directly
246
+ value
247
+ when /\AArray<(?<inner_type>.+)>\z/
248
+ inner_type = Regexp.last_match[:inner_type]
249
+ value.map { |v| _deserialize(inner_type, v) }
250
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
251
+ k_type = Regexp.last_match[:k_type]
252
+ v_type = Regexp.last_match[:v_type]
253
+ {}.tap do |hash|
254
+ value.each do |k, v|
255
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
256
+ end
257
+ end
258
+ else # model
259
+ # models (e.g. Pet) or oneOf
260
+ klass = Shotstack.const_get(type)
261
+ klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
262
+ end
263
+ end
264
+
265
+ # Returns the string representation of the object
266
+ # @return [String] String presentation of the object
267
+ def to_s
268
+ to_hash.to_s
269
+ end
270
+
271
+ # to_body is an alias to to_hash (backward compatibility)
272
+ # @return [Hash] Returns the object in the form of hash
273
+ def to_body
274
+ to_hash
275
+ end
276
+
277
+ # Returns the object in the form of hash
278
+ # @return [Hash] Returns the object in the form of hash
279
+ def to_hash
280
+ hash = {}
281
+ self.class.attribute_map.each_pair do |attr, param|
282
+ value = self.send(attr)
283
+ if value.nil?
284
+ is_nullable = self.class.openapi_nullable.include?(attr)
285
+ next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
286
+ end
287
+
288
+ hash[param] = _to_hash(value)
289
+ end
290
+ hash
291
+ end
292
+
293
+ # Outputs non-array value in the form of hash
294
+ # For object, use to_hash. Otherwise, just return the value
295
+ # @param [Object] value Any valid value
296
+ # @return [Hash] Returns the value in the form of hash
297
+ def _to_hash(value)
298
+ if value.is_a?(Array)
299
+ value.compact.map { |v| _to_hash(v) }
300
+ elsif value.is_a?(Hash)
301
+ {}.tap do |hash|
302
+ value.each { |k, v| hash[k] = _to_hash(v) }
303
+ end
304
+ elsif value.respond_to? :to_hash
305
+ value.to_hash
306
+ else
307
+ value
308
+ end
309
+ end
310
+
311
+ end
312
+
313
+ end
@@ -1,12 +1,12 @@
1
1
  =begin
2
2
  #Shotstack
3
3
 
4
- #Shotstack is a video, image and audio editing service that allows for the automated generation of videos, images and audio using JSON and a RESTful API. You arrange and configure an edit and POST it to the API which will render your media and provide a file location when complete. For more details visit [shotstack.io](https://shotstack.io) or checkout our [getting started](https://shotstack.io/docs/guide/) documentation. There are two main API's, one for editing and generating assets (Edit API) and one for managing hosted assets (Serve API). The Edit API base URL is: <b>https://api.shotstack.io/{version}</b> The Serve API base URL is: <b>https://api.shotstack.io/serve/{version}</b>
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
- OpenAPI Generator version: 5.4.0
9
+ Generator version: 7.4.0
10
10
 
11
11
  =end
12
12
 
@@ -19,7 +19,7 @@ module Shotstack
19
19
  # The output format and type of media file to generate. <ul> <li>`mp4` - mp4 video file</li> <li>`gif` - animated gif</li> <li>`jpg` - jpg image file</li> <li>`png` - png image file</li> <li>`bmp` - bmp image file</li> <li>`mp3` - mp3 audio file (audio only)</li> </ul>
20
20
  attr_accessor :format
21
21
 
22
- # The output resolution of the video or image. <ul> <li>`preview` - 512px x 288px @ 15fps</li> <li>`mobile` - 640px x 360px @ 25fps</li> <li>`sd` - 1024px x 576px @ 25fps</li> <li>`hd` - 1280px x 720px @ 25fps</li> <li>`1080` - 1920px x 1080px @ 25fps</li> </ul>
22
+ # The preset output resolution of the video or image. For custom sizes use the `size` property. <ul> <li>`preview` - 512px x 288px @ 15fps</li> <li>`mobile` - 640px x 360px @ 25fps</li> <li>`sd` - 1024px x 576px @ 25fps</li> <li>`hd` - 1280px x 720px @ 25fps</li> <li>`1080` - 1920px x 1080px @ 25fps</li> <li>`4k` - 3840px x 2160px @ 25fps</li> </ul>
23
23
  attr_accessor :resolution
24
24
 
25
25
  # The aspect ratio (shape) of the video or image. Useful for social media output formats. Options are: <ul> <li>`16:9` (default) - regular landscape/horizontal aspect ratio</li> <li>`9:16` - vertical/portrait aspect ratio</li> <li>`1:1` - square aspect ratio</li> <li>`4:5` - short vertical/portrait aspect ratio</li> <li>`4:3` - legacy TV aspect ratio</li> </ul>
@@ -27,13 +27,13 @@ module Shotstack
27
27
 
28
28
  attr_accessor :size
29
29
 
30
- # Override the default frames per second. Useful for when the source footage is recorded at 30fps, i.e. on mobile devices. Lower frame rates can be used to add cinematic quality (24fps) or to create smaller file size/faster render times or animated gifs (12 or 15fps). Default is 25fps. <ul> <li>`12` - 12fps</li> <li>`15` - 15fps</li> <li>`24` - 24fps</li> <li>`23.976` - 23.976fps</li> <li>`25` (default) - 25fps</li> <li>`29.97` - 29.97fps</li> <li>`30` - 30fps</li> </ul>
30
+ # Override the default frames per second. Useful for when the source footage is recorded at 30fps, i.e. on mobile devices. Lower frame rates can be used to add cinematic quality (24fps) or to create smaller file size/faster render times or animated gifs (12 or 15fps). Default is 25fps. <ul> <li>`12` - 12fps</li> <li>`15` - 15fps</li> <li>`24` - 24fps</li> <li>`23.976` - 23.976fps</li> <li>`25` (default) - 25fps</li> <li>`29.97` - 29.97fps</li> <li>`30` - 30fps</li> <li>`48` - 48fps</li> <li>`50` - 50fps</li> <li>`59.94` - 59.94fps</li> <li>`60` - 60fps</li> </ul>
31
31
  attr_accessor :fps
32
32
 
33
33
  # Override the resolution and scale the video or image to render at a different size. When using scaleTo the asset should be edited at the resolution dimensions, i.e. use font sizes that look best at HD, then use scaleTo to output the file at SD and the text will be scaled to the correct size. This is useful if you want to create multiple asset sizes. <ul> <li>`preview` - 512px x 288px @ 15fps</li> <li>`mobile` - 640px x 360px @ 25fps</li> <li>`sd` - 1024px x 576px @25fps</li> <li>`hd` - 1280px x 720px @25fps</li> <li>`1080` - 1920px x 1080px @25fps</li> </ul>
34
34
  attr_accessor :scale_to
35
35
 
36
- # Adjust the output quality of the video, image or audio. Adjusting quality affects render speed, download speeds and storage requirements due to file size. The default `medium` provides the most optimized choice for all three factors. <ul> <li>`low` - slightly reduced quality, smaller file size</li> <li>`medium` (default) - optimized quality, render speeds and file size</li> <li>`high` - slightly increased quality, larger file size</li> </ul>
36
+ # Adjust the output quality of the video, image or audio. Adjusting quality affects render speed, download speeds and storage requirements due to file size. The default `medium` provides the most optimized choice for all three factors. <ul> <li>`verylow` - reduced quality, smallest file size</li> <li>`low` - slightly reduced quality, smaller file size</li> <li>`medium` (default) - optimized quality, render speeds and file size</li> <li>`high` - slightly increased quality, larger file size</li> <li>`veryhigh` - highest quality, largest file size</li> </ul>
37
37
  attr_accessor :quality
38
38
 
39
39
  # Loop settings for gif files. Set to `true` to loop, `false` to play only once.
@@ -139,6 +139,8 @@ module Shotstack
139
139
 
140
140
  if attributes.key?(:'format')
141
141
  self.format = attributes[:'format']
142
+ else
143
+ self.format = nil
142
144
  end
143
145
 
144
146
  if attributes.key?(:'resolution')
@@ -195,6 +197,7 @@ module Shotstack
195
197
  # Show invalid properties with the reasons. Usually used together with valid?
196
198
  # @return Array for valid properties with the reasons
197
199
  def list_invalid_properties
200
+ warn '[DEPRECATED] the `list_invalid_properties` method is obsolete'
198
201
  invalid_properties = Array.new
199
202
  if @format.nil?
200
203
  invalid_properties.push('invalid value for "format", format cannot be nil.')
@@ -206,18 +209,19 @@ module Shotstack
206
209
  # Check to see if the all the properties in the model are valid
207
210
  # @return true if the model is valid
208
211
  def valid?
212
+ warn '[DEPRECATED] the `valid?` method is obsolete'
209
213
  return false if @format.nil?
210
214
  format_validator = EnumAttributeValidator.new('String', ["mp4", "gif", "mp3", "jpg", "png", "bmp"])
211
215
  return false unless format_validator.valid?(@format)
212
- resolution_validator = EnumAttributeValidator.new('String', ["preview", "mobile", "sd", "hd", "1080"])
216
+ resolution_validator = EnumAttributeValidator.new('String', ["preview", "mobile", "sd", "hd", "1080", "4k"])
213
217
  return false unless resolution_validator.valid?(@resolution)
214
218
  aspect_ratio_validator = EnumAttributeValidator.new('String', ["16:9", "9:16", "1:1", "4:5", "4:3"])
215
219
  return false unless aspect_ratio_validator.valid?(@aspect_ratio)
216
- fps_validator = EnumAttributeValidator.new('Float', [12, 15, 23.976, 24, 25, 29.97, 30])
220
+ fps_validator = EnumAttributeValidator.new('Float', [12, 15, 23.976, 24, 25, 29.97, 30, 48, 50, 59.94, 60])
217
221
  return false unless fps_validator.valid?(@fps)
218
222
  scale_to_validator = EnumAttributeValidator.new('String', ["preview", "mobile", "sd", "hd", "1080"])
219
223
  return false unless scale_to_validator.valid?(@scale_to)
220
- quality_validator = EnumAttributeValidator.new('String', ["low", "medium", "high"])
224
+ quality_validator = EnumAttributeValidator.new('String', ["verylow", "low", "medium", "high", "veryhigh"])
221
225
  return false unless quality_validator.valid?(@quality)
222
226
  true
223
227
  end
@@ -235,7 +239,7 @@ module Shotstack
235
239
  # Custom attribute writer method checking allowed values (enum).
236
240
  # @param [Object] resolution Object to be assigned
237
241
  def resolution=(resolution)
238
- validator = EnumAttributeValidator.new('String', ["preview", "mobile", "sd", "hd", "1080"])
242
+ validator = EnumAttributeValidator.new('String', ["preview", "mobile", "sd", "hd", "1080", "4k"])
239
243
  unless validator.valid?(resolution)
240
244
  fail ArgumentError, "invalid value for \"resolution\", must be one of #{validator.allowable_values}."
241
245
  end
@@ -255,7 +259,7 @@ module Shotstack
255
259
  # Custom attribute writer method checking allowed values (enum).
256
260
  # @param [Object] fps Object to be assigned
257
261
  def fps=(fps)
258
- validator = EnumAttributeValidator.new('Float', [12, 15, 23.976, 24, 25, 29.97, 30])
262
+ validator = EnumAttributeValidator.new('Float', [12, 15, 23.976, 24, 25, 29.97, 30, 48, 50, 59.94, 60])
259
263
  unless validator.valid?(fps)
260
264
  fail ArgumentError, "invalid value for \"fps\", must be one of #{validator.allowable_values}."
261
265
  end
@@ -275,7 +279,7 @@ module Shotstack
275
279
  # Custom attribute writer method checking allowed values (enum).
276
280
  # @param [Object] quality Object to be assigned
277
281
  def quality=(quality)
278
- validator = EnumAttributeValidator.new('String', ["low", "medium", "high"])
282
+ validator = EnumAttributeValidator.new('String', ["verylow", "low", "medium", "high", "veryhigh"])
279
283
  unless validator.valid?(quality)
280
284
  fail ArgumentError, "invalid value for \"quality\", must be one of #{validator.allowable_values}."
281
285
  end
@@ -318,36 +322,30 @@ module Shotstack
318
322
  # @param [Hash] attributes Model attributes in the form of hash
319
323
  # @return [Object] Returns the model itself
320
324
  def self.build_from_hash(attributes)
321
- new.build_from_hash(attributes)
322
- end
323
-
324
- # Builds the object from hash
325
- # @param [Hash] attributes Model attributes in the form of hash
326
- # @return [Object] Returns the model itself
327
- def build_from_hash(attributes)
328
325
  return nil unless attributes.is_a?(Hash)
329
- self.class.openapi_types.each_pair do |key, type|
330
- if attributes[self.class.attribute_map[key]].nil? && self.class.openapi_nullable.include?(key)
331
- self.send("#{key}=", nil)
326
+ attributes = attributes.transform_keys(&:to_sym)
327
+ transformed_hash = {}
328
+ openapi_types.each_pair do |key, type|
329
+ if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil?
330
+ transformed_hash["#{key}"] = nil
332
331
  elsif type =~ /\AArray<(.*)>/i
333
332
  # check to ensure the input is an array given that the attribute
334
333
  # is documented as an array but the input is not
335
- if attributes[self.class.attribute_map[key]].is_a?(Array)
336
- self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
334
+ if attributes[attribute_map[key]].is_a?(Array)
335
+ transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) }
337
336
  end
338
- elsif !attributes[self.class.attribute_map[key]].nil?
339
- self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
337
+ elsif !attributes[attribute_map[key]].nil?
338
+ transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]])
340
339
  end
341
340
  end
342
-
343
- self
341
+ new(transformed_hash)
344
342
  end
345
343
 
346
344
  # Deserializes the data based on type
347
345
  # @param string type Data type
348
346
  # @param string value Value to be deserialized
349
347
  # @return [Object] Deserialized data
350
- def _deserialize(type, value)
348
+ def self._deserialize(type, value)
351
349
  case type.to_sym
352
350
  when :Time
353
351
  Time.parse(value)
@@ -382,7 +380,7 @@ module Shotstack
382
380
  else # model
383
381
  # models (e.g. Pet) or oneOf
384
382
  klass = Shotstack.const_get(type)
385
- klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
383
+ klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
386
384
  end
387
385
  end
388
386