shotstack 0.1.4 → 0.1.8

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.
Files changed (41) hide show
  1. checksums.yaml +4 -4
  2. data/lib/shotstack.rb +12 -2
  3. data/lib/shotstack/api/edit_api.rb +155 -0
  4. data/lib/shotstack/api/endpoints_api.rb +10 -8
  5. data/lib/shotstack/api/serve_api.rb +224 -0
  6. data/lib/shotstack/api_client.rb +50 -46
  7. data/lib/shotstack/api_error.rb +2 -2
  8. data/lib/shotstack/configuration.rb +50 -9
  9. data/lib/shotstack/models/asset_render_response.rb +222 -0
  10. data/lib/shotstack/models/asset_response.rb +219 -0
  11. data/lib/shotstack/models/asset_response_attributes.rb +334 -0
  12. data/lib/shotstack/models/asset_response_data.rb +229 -0
  13. data/lib/shotstack/models/audio_asset.rb +68 -12
  14. data/lib/shotstack/models/clip.rb +23 -11
  15. data/lib/shotstack/models/crop.rb +346 -0
  16. data/lib/shotstack/models/destinations.rb +17 -0
  17. data/lib/shotstack/models/edit.rb +72 -14
  18. data/lib/shotstack/models/font.rb +21 -9
  19. data/lib/shotstack/models/html_asset.rb +26 -14
  20. data/lib/shotstack/models/image_asset.rb +34 -13
  21. data/lib/shotstack/models/luma_asset.rb +24 -12
  22. data/lib/shotstack/models/offset.rb +20 -8
  23. data/lib/shotstack/models/output.rb +111 -26
  24. data/lib/shotstack/models/poster.rb +20 -8
  25. data/lib/shotstack/models/queued_response.rb +21 -8
  26. data/lib/shotstack/models/queued_response_data.rb +21 -8
  27. data/lib/shotstack/models/range.rb +260 -0
  28. data/lib/shotstack/models/render_response.rb +21 -8
  29. data/lib/shotstack/models/render_response_data.rb +25 -12
  30. data/lib/shotstack/models/shotstack_destination.rb +240 -0
  31. data/lib/shotstack/models/size.rb +278 -0
  32. data/lib/shotstack/models/soundtrack.rb +20 -8
  33. data/lib/shotstack/models/thumbnail.rb +21 -9
  34. data/lib/shotstack/models/timeline.rb +37 -13
  35. data/lib/shotstack/models/title_asset.rb +20 -8
  36. data/lib/shotstack/models/track.rb +20 -8
  37. data/lib/shotstack/models/transition.rb +26 -14
  38. data/lib/shotstack/models/video_asset.rb +33 -12
  39. data/lib/shotstack/version.rb +3 -3
  40. data/shotstack.gemspec +4 -5
  41. metadata +22 -27
@@ -0,0 +1,346 @@
1
+ =begin
2
+ #Shotstack
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.gitbook.io/docs/guides/getting-started) 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>
5
+
6
+ The version of the OpenAPI document: v1
7
+
8
+ Generated by: https://openapi-generator.tech
9
+ OpenAPI Generator version: 5.0.0
10
+
11
+ =end
12
+
13
+ require 'date'
14
+ require 'time'
15
+
16
+ module Shotstack
17
+ # Crop the sides of an asset by a relative amount. The size of the crop is specified using a scale between 0 and 1, relative to the screen width - i.e a left crop of 0.5 will crop half of the asset from the left, a top crop of 0.25 will crop the top by quarter of the asset.
18
+ class Crop
19
+ # Crop from the top of the asset
20
+ attr_accessor :top
21
+
22
+ # Crop from the bottom of the asset
23
+ attr_accessor :bottom
24
+
25
+ # Crop from the left of the asset
26
+ attr_accessor :left
27
+
28
+ # Crop from the left of the asset
29
+ attr_accessor :right
30
+
31
+ # Attribute mapping from ruby-style variable name to JSON key.
32
+ def self.attribute_map
33
+ {
34
+ :'top' => :'top',
35
+ :'bottom' => :'bottom',
36
+ :'left' => :'left',
37
+ :'right' => :'right'
38
+ }
39
+ end
40
+
41
+ # Returns all the JSON keys this model knows about
42
+ def self.acceptable_attributes
43
+ attribute_map.values
44
+ end
45
+
46
+ # Attribute type mapping.
47
+ def self.openapi_types
48
+ {
49
+ :'top' => :'Float',
50
+ :'bottom' => :'Float',
51
+ :'left' => :'Float',
52
+ :'right' => :'Float'
53
+ }
54
+ end
55
+
56
+ # List of attributes with nullable: true
57
+ def self.openapi_nullable
58
+ Set.new([
59
+ ])
60
+ end
61
+
62
+ # Initializes the object
63
+ # @param [Hash] attributes Model attributes in the form of hash
64
+ def initialize(attributes = {})
65
+ if (!attributes.is_a?(Hash))
66
+ fail ArgumentError, "The input argument (attributes) must be a hash in `Shotstack::Crop` initialize method"
67
+ end
68
+
69
+ # check to see if the attribute exists and convert string to symbol for hash key
70
+ attributes = attributes.each_with_object({}) { |(k, v), h|
71
+ if (!self.class.attribute_map.key?(k.to_sym))
72
+ fail ArgumentError, "`#{k}` is not a valid attribute in `Shotstack::Crop`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
73
+ end
74
+ h[k.to_sym] = v
75
+ }
76
+
77
+ if attributes.key?(:'top')
78
+ self.top = attributes[:'top']
79
+ end
80
+
81
+ if attributes.key?(:'bottom')
82
+ self.bottom = attributes[:'bottom']
83
+ end
84
+
85
+ if attributes.key?(:'left')
86
+ self.left = attributes[:'left']
87
+ end
88
+
89
+ if attributes.key?(:'right')
90
+ self.right = attributes[:'right']
91
+ end
92
+ end
93
+
94
+ # Show invalid properties with the reasons. Usually used together with valid?
95
+ # @return Array for valid properties with the reasons
96
+ def list_invalid_properties
97
+ invalid_properties = Array.new
98
+ if !@top.nil? && @top > 1
99
+ invalid_properties.push('invalid value for "top", must be smaller than or equal to 1.')
100
+ end
101
+
102
+ if !@top.nil? && @top < 0
103
+ invalid_properties.push('invalid value for "top", must be greater than or equal to 0.')
104
+ end
105
+
106
+ if !@bottom.nil? && @bottom > 1
107
+ invalid_properties.push('invalid value for "bottom", must be smaller than or equal to 1.')
108
+ end
109
+
110
+ if !@bottom.nil? && @bottom < 0
111
+ invalid_properties.push('invalid value for "bottom", must be greater than or equal to 0.')
112
+ end
113
+
114
+ if !@left.nil? && @left > 1
115
+ invalid_properties.push('invalid value for "left", must be smaller than or equal to 1.')
116
+ end
117
+
118
+ if !@left.nil? && @left < 0
119
+ invalid_properties.push('invalid value for "left", must be greater than or equal to 0.')
120
+ end
121
+
122
+ if !@right.nil? && @right > 1
123
+ invalid_properties.push('invalid value for "right", must be smaller than or equal to 1.')
124
+ end
125
+
126
+ if !@right.nil? && @right < 0
127
+ invalid_properties.push('invalid value for "right", must be greater than or equal to 0.')
128
+ end
129
+
130
+ invalid_properties
131
+ end
132
+
133
+ # Check to see if the all the properties in the model are valid
134
+ # @return true if the model is valid
135
+ def valid?
136
+ return false if !@top.nil? && @top > 1
137
+ return false if !@top.nil? && @top < 0
138
+ return false if !@bottom.nil? && @bottom > 1
139
+ return false if !@bottom.nil? && @bottom < 0
140
+ return false if !@left.nil? && @left > 1
141
+ return false if !@left.nil? && @left < 0
142
+ return false if !@right.nil? && @right > 1
143
+ return false if !@right.nil? && @right < 0
144
+ true
145
+ end
146
+
147
+ # Custom attribute writer method with validation
148
+ # @param [Object] top Value to be assigned
149
+ def top=(top)
150
+ if !top.nil? && top > 1
151
+ fail ArgumentError, 'invalid value for "top", must be smaller than or equal to 1.'
152
+ end
153
+
154
+ if !top.nil? && top < 0
155
+ fail ArgumentError, 'invalid value for "top", must be greater than or equal to 0.'
156
+ end
157
+
158
+ @top = top
159
+ end
160
+
161
+ # Custom attribute writer method with validation
162
+ # @param [Object] bottom Value to be assigned
163
+ def bottom=(bottom)
164
+ if !bottom.nil? && bottom > 1
165
+ fail ArgumentError, 'invalid value for "bottom", must be smaller than or equal to 1.'
166
+ end
167
+
168
+ if !bottom.nil? && bottom < 0
169
+ fail ArgumentError, 'invalid value for "bottom", must be greater than or equal to 0.'
170
+ end
171
+
172
+ @bottom = bottom
173
+ end
174
+
175
+ # Custom attribute writer method with validation
176
+ # @param [Object] left Value to be assigned
177
+ def left=(left)
178
+ if !left.nil? && left > 1
179
+ fail ArgumentError, 'invalid value for "left", must be smaller than or equal to 1.'
180
+ end
181
+
182
+ if !left.nil? && left < 0
183
+ fail ArgumentError, 'invalid value for "left", must be greater than or equal to 0.'
184
+ end
185
+
186
+ @left = left
187
+ end
188
+
189
+ # Custom attribute writer method with validation
190
+ # @param [Object] right Value to be assigned
191
+ def right=(right)
192
+ if !right.nil? && right > 1
193
+ fail ArgumentError, 'invalid value for "right", must be smaller than or equal to 1.'
194
+ end
195
+
196
+ if !right.nil? && right < 0
197
+ fail ArgumentError, 'invalid value for "right", must be greater than or equal to 0.'
198
+ end
199
+
200
+ @right = right
201
+ end
202
+
203
+ # Checks equality by comparing each attribute.
204
+ # @param [Object] Object to be compared
205
+ def ==(o)
206
+ return true if self.equal?(o)
207
+ self.class == o.class &&
208
+ top == o.top &&
209
+ bottom == o.bottom &&
210
+ left == o.left &&
211
+ right == o.right
212
+ end
213
+
214
+ # @see the `==` method
215
+ # @param [Object] Object to be compared
216
+ def eql?(o)
217
+ self == o
218
+ end
219
+
220
+ # Calculates hash code according to all attributes.
221
+ # @return [Integer] Hash code
222
+ def hash
223
+ [top, bottom, left, right].hash
224
+ end
225
+
226
+ # Builds the object from hash
227
+ # @param [Hash] attributes Model attributes in the form of hash
228
+ # @return [Object] Returns the model itself
229
+ def self.build_from_hash(attributes)
230
+ new.build_from_hash(attributes)
231
+ end
232
+
233
+ # Builds the object from hash
234
+ # @param [Hash] attributes Model attributes in the form of hash
235
+ # @return [Object] Returns the model itself
236
+ def build_from_hash(attributes)
237
+ return nil unless attributes.is_a?(Hash)
238
+ self.class.openapi_types.each_pair do |key, type|
239
+ if attributes[self.class.attribute_map[key]].nil? && self.class.openapi_nullable.include?(key)
240
+ self.send("#{key}=", nil)
241
+ elsif type =~ /\AArray<(.*)>/i
242
+ # check to ensure the input is an array given that the attribute
243
+ # is documented as an array but the input is not
244
+ if attributes[self.class.attribute_map[key]].is_a?(Array)
245
+ self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
246
+ end
247
+ elsif !attributes[self.class.attribute_map[key]].nil?
248
+ self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
249
+ end
250
+ end
251
+
252
+ self
253
+ end
254
+
255
+ # Deserializes the data based on type
256
+ # @param string type Data type
257
+ # @param string value Value to be deserialized
258
+ # @return [Object] Deserialized data
259
+ def _deserialize(type, value)
260
+ case type.to_sym
261
+ when :Time
262
+ Time.parse(value)
263
+ when :Date
264
+ Date.parse(value)
265
+ when :String
266
+ value.to_s
267
+ when :Integer
268
+ value.to_i
269
+ when :Float
270
+ value.to_f
271
+ when :Boolean
272
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
273
+ true
274
+ else
275
+ false
276
+ end
277
+ when :Object
278
+ # generic object (usually a Hash), return directly
279
+ value
280
+ when /\AArray<(?<inner_type>.+)>\z/
281
+ inner_type = Regexp.last_match[:inner_type]
282
+ value.map { |v| _deserialize(inner_type, v) }
283
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
284
+ k_type = Regexp.last_match[:k_type]
285
+ v_type = Regexp.last_match[:v_type]
286
+ {}.tap do |hash|
287
+ value.each do |k, v|
288
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
289
+ end
290
+ end
291
+ else # model
292
+ # models (e.g. Pet) or oneOf
293
+ klass = Shotstack.const_get(type)
294
+ klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
295
+ end
296
+ end
297
+
298
+ # Returns the string representation of the object
299
+ # @return [String] String presentation of the object
300
+ def to_s
301
+ to_hash.to_s
302
+ end
303
+
304
+ # to_body is an alias to to_hash (backward compatibility)
305
+ # @return [Hash] Returns the object in the form of hash
306
+ def to_body
307
+ to_hash
308
+ end
309
+
310
+ # Returns the object in the form of hash
311
+ # @return [Hash] Returns the object in the form of hash
312
+ def to_hash
313
+ hash = {}
314
+ self.class.attribute_map.each_pair do |attr, param|
315
+ value = self.send(attr)
316
+ if value.nil?
317
+ is_nullable = self.class.openapi_nullable.include?(attr)
318
+ next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
319
+ end
320
+
321
+ hash[param] = _to_hash(value)
322
+ end
323
+ hash
324
+ end
325
+
326
+ # Outputs non-array value in the form of hash
327
+ # For object, use to_hash. Otherwise, just return the value
328
+ # @param [Object] value Any valid value
329
+ # @return [Hash] Returns the value in the form of hash
330
+ def _to_hash(value)
331
+ if value.is_a?(Array)
332
+ value.compact.map { |v| _to_hash(v) }
333
+ elsif value.is_a?(Hash)
334
+ {}.tap do |hash|
335
+ value.each { |k, v| hash[k] = _to_hash(v) }
336
+ end
337
+ elsif value.respond_to? :to_hash
338
+ value.to_hash
339
+ else
340
+ value
341
+ end
342
+ end
343
+
344
+ end
345
+
346
+ end
@@ -0,0 +1,17 @@
1
+ module Shotstack
2
+ class Destinations
3
+ # Builds the object from hash
4
+ # @param [Hash] attributes Model attributes in the form of hash
5
+ # @return [Object] Returns the model itself
6
+ def self.build_from_hash(attributes)
7
+ new.build_from_hash(attributes)
8
+ end
9
+
10
+ # Builds the object from hash
11
+ # @param [Hash] attributes Model attributes in the form of hash
12
+ # @return [Object] Returns the model itself
13
+ def build_from_hash(attributes)
14
+
15
+ end
16
+ end
17
+ end
@@ -1,42 +1,75 @@
1
1
  =begin
2
2
  #Shotstack
3
3
 
4
- #The Shotstack API is a video editing service that allows for the automated creation of videos using JSON. You can configure an edit and POST it to the Shotstack API which will render your video and provide a file location when complete. For more details check https://shotstack.io
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.gitbook.io/docs/guides/getting-started) 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>
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: 4.2.1
9
+ OpenAPI Generator version: 5.0.0
10
10
 
11
11
  =end
12
12
 
13
13
  require 'date'
14
+ require 'time'
14
15
 
15
16
  module Shotstack
16
- # An edit defines the content of the video in a timeline and the output format.
17
+ # An edit defines the arrangement of a video on a timeline, an audio edit or an image design and the output format.
17
18
  class Edit
18
19
  attr_accessor :timeline
19
20
 
20
21
  attr_accessor :output
21
22
 
22
- # An optional webhook callback URL used to receive status notifications when a render completes or fails.
23
+ # An optional webhook callback URL used to receive status notifications when a render completes or fails. See [webhooks](https://shotstack.gitbook.io/docs/guides/architecting-an-application/webhooks) for more details.
23
24
  attr_accessor :callback
24
25
 
26
+ # The disk type to use for storing footage and assets for each render. See [disk types](https://shotstack.gitbook.io/docs/guides/architecting-an-application/disk-types) for more details. <ul> <li>`local` - optimized for high speed rendering with up to 512MB storage</li> <li>`mount` - optimized for larger file sizes and longer videos with 5GB for source footage and 512MB for output render</li> </ul>
27
+ attr_accessor :disk
28
+
29
+ class EnumAttributeValidator
30
+ attr_reader :datatype
31
+ attr_reader :allowable_values
32
+
33
+ def initialize(datatype, allowable_values)
34
+ @allowable_values = allowable_values.map do |value|
35
+ case datatype.to_s
36
+ when /Integer/i
37
+ value.to_i
38
+ when /Float/i
39
+ value.to_f
40
+ else
41
+ value
42
+ end
43
+ end
44
+ end
45
+
46
+ def valid?(value)
47
+ !value || allowable_values.include?(value)
48
+ end
49
+ end
50
+
25
51
  # Attribute mapping from ruby-style variable name to JSON key.
26
52
  def self.attribute_map
27
53
  {
28
54
  :'timeline' => :'timeline',
29
55
  :'output' => :'output',
30
- :'callback' => :'callback'
56
+ :'callback' => :'callback',
57
+ :'disk' => :'disk'
31
58
  }
32
59
  end
33
60
 
61
+ # Returns all the JSON keys this model knows about
62
+ def self.acceptable_attributes
63
+ attribute_map.values
64
+ end
65
+
34
66
  # Attribute type mapping.
35
67
  def self.openapi_types
36
68
  {
37
69
  :'timeline' => :'Timeline',
38
70
  :'output' => :'Output',
39
- :'callback' => :'String'
71
+ :'callback' => :'String',
72
+ :'disk' => :'String'
40
73
  }
41
74
  end
42
75
 
@@ -72,6 +105,12 @@ module Shotstack
72
105
  if attributes.key?(:'callback')
73
106
  self.callback = attributes[:'callback']
74
107
  end
108
+
109
+ if attributes.key?(:'disk')
110
+ self.disk = attributes[:'disk']
111
+ else
112
+ self.disk = 'local'
113
+ end
75
114
  end
76
115
 
77
116
  # Show invalid properties with the reasons. Usually used together with valid?
@@ -94,9 +133,21 @@ module Shotstack
94
133
  def valid?
95
134
  return false if @timeline.nil?
96
135
  return false if @output.nil?
136
+ disk_validator = EnumAttributeValidator.new('String', ["local", "mount"])
137
+ return false unless disk_validator.valid?(@disk)
97
138
  true
98
139
  end
99
140
 
141
+ # Custom attribute writer method checking allowed values (enum).
142
+ # @param [Object] disk Object to be assigned
143
+ def disk=(disk)
144
+ validator = EnumAttributeValidator.new('String', ["local", "mount"])
145
+ unless validator.valid?(disk)
146
+ fail ArgumentError, "invalid value for \"disk\", must be one of #{validator.allowable_values}."
147
+ end
148
+ @disk = disk
149
+ end
150
+
100
151
  # Checks equality by comparing each attribute.
101
152
  # @param [Object] Object to be compared
102
153
  def ==(o)
@@ -104,7 +155,8 @@ module Shotstack
104
155
  self.class == o.class &&
105
156
  timeline == o.timeline &&
106
157
  output == o.output &&
107
- callback == o.callback
158
+ callback == o.callback &&
159
+ disk == o.disk
108
160
  end
109
161
 
110
162
  # @see the `==` method
@@ -116,7 +168,7 @@ module Shotstack
116
168
  # Calculates hash code according to all attributes.
117
169
  # @return [Integer] Hash code
118
170
  def hash
119
- [timeline, output, callback].hash
171
+ [timeline, output, callback, disk].hash
120
172
  end
121
173
 
122
174
  # Builds the object from hash
@@ -132,7 +184,9 @@ module Shotstack
132
184
  def build_from_hash(attributes)
133
185
  return nil unless attributes.is_a?(Hash)
134
186
  self.class.openapi_types.each_pair do |key, type|
135
- if type =~ /\AArray<(.*)>/i
187
+ if attributes[self.class.attribute_map[key]].nil? && self.class.openapi_nullable.include?(key)
188
+ self.send("#{key}=", nil)
189
+ elsif type =~ /\AArray<(.*)>/i
136
190
  # check to ensure the input is an array given that the attribute
137
191
  # is documented as an array but the input is not
138
192
  if attributes[self.class.attribute_map[key]].is_a?(Array)
@@ -140,7 +194,7 @@ module Shotstack
140
194
  end
141
195
  elsif !attributes[self.class.attribute_map[key]].nil?
142
196
  self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
143
- end # or else data not found in attributes(hash), not an issue as the data can be optional
197
+ end
144
198
  end
145
199
 
146
200
  self
@@ -152,8 +206,8 @@ module Shotstack
152
206
  # @return [Object] Deserialized data
153
207
  def _deserialize(type, value)
154
208
  case type.to_sym
155
- when :DateTime
156
- DateTime.parse(value)
209
+ when :Time
210
+ Time.parse(value)
157
211
  when :Date
158
212
  Date.parse(value)
159
213
  when :String
@@ -183,7 +237,9 @@ module Shotstack
183
237
  end
184
238
  end
185
239
  else # model
186
- Shotstack.const_get(type).build_from_hash(value)
240
+ # models (e.g. Pet) or oneOf
241
+ klass = Shotstack.const_get(type)
242
+ klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
187
243
  end
188
244
  end
189
245
 
@@ -209,7 +265,7 @@ module Shotstack
209
265
  is_nullable = self.class.openapi_nullable.include?(attr)
210
266
  next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
211
267
  end
212
-
268
+
213
269
  hash[param] = _to_hash(value)
214
270
  end
215
271
  hash
@@ -232,5 +288,7 @@ module Shotstack
232
288
  value
233
289
  end
234
290
  end
291
+
235
292
  end
293
+
236
294
  end