shotstack 0.1.4 → 0.1.5

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.
@@ -6,11 +6,12 @@
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
17
  # A clip is a container for a specific type of asset, i.e. a title, image, video, audio or html. You use a Clip to define when an asset will display on the timeline, how long it will play for and transitions, filters and effects to apply to it.
@@ -40,7 +41,7 @@ module Shotstack
40
41
  # A motion effect to apply to the Clip. <ul> <li>`zoomIn` - slow zoom in</li> <li>`zoomOut` - slow zoom out</li> <li>`slideLeft` - slow slide (pan) left</li> <li>`slideRight` - slow slide (pan) right</li> <li>`slideUp` - slow slide (pan) up</li> <li>`slideDown` - slow slide (pan) down</li> </ul>
41
42
  attr_accessor :effect
42
43
 
43
- # A filter effect to apply to the Clip. <ul> <li>`blur` - blurs the image or video</li> <li>`boost` - boost contrast and saturation</li> <li>`contrast` - increase contrast</li> <li>`darken` - darken the scene</li> <li>`greyscale` - remove colour</li> <li>`lighten` - lighten the scene</li> <li>`muted` - reduce saturation and contrast</li> <li>`invert` - invert colors</li> </ul>
44
+ # A filter effect to apply to the Clip. <ul> <li>`boost` - boost contrast and saturation</li> <li>`contrast` - increase contrast</li> <li>`darken` - darken the scene</li> <li>`greyscale` - remove colour</li> <li>`lighten` - lighten the scene</li> <li>`muted` - reduce saturation and contrast</li> <li>`invert` - invert colors</li> </ul>
44
45
  attr_accessor :filter
45
46
 
46
47
  # Sets the opacity of the Clip where 1 is opaque and 0 is transparent.
@@ -85,6 +86,11 @@ module Shotstack
85
86
  }
86
87
  end
87
88
 
89
+ # Returns all the JSON keys this model knows about
90
+ def self.acceptable_attributes
91
+ attribute_map.values
92
+ end
93
+
88
94
  # Attribute type mapping.
89
95
  def self.openapi_types
90
96
  {
@@ -293,7 +299,9 @@ module Shotstack
293
299
  def build_from_hash(attributes)
294
300
  return nil unless attributes.is_a?(Hash)
295
301
  self.class.openapi_types.each_pair do |key, type|
296
- if type =~ /\AArray<(.*)>/i
302
+ if attributes[self.class.attribute_map[key]].nil? && self.class.openapi_nullable.include?(key)
303
+ self.send("#{key}=", nil)
304
+ elsif type =~ /\AArray<(.*)>/i
297
305
  # check to ensure the input is an array given that the attribute
298
306
  # is documented as an array but the input is not
299
307
  if attributes[self.class.attribute_map[key]].is_a?(Array)
@@ -301,7 +309,7 @@ module Shotstack
301
309
  end
302
310
  elsif !attributes[self.class.attribute_map[key]].nil?
303
311
  self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
304
- end # or else data not found in attributes(hash), not an issue as the data can be optional
312
+ end
305
313
  end
306
314
 
307
315
  self
@@ -313,8 +321,8 @@ module Shotstack
313
321
  # @return [Object] Deserialized data
314
322
  def _deserialize(type, value)
315
323
  case type.to_sym
316
- when :DateTime
317
- DateTime.parse(value)
324
+ when :Time
325
+ Time.parse(value)
318
326
  when :Date
319
327
  Date.parse(value)
320
328
  when :String
@@ -344,7 +352,9 @@ module Shotstack
344
352
  end
345
353
  end
346
354
  else # model
347
- Shotstack.const_get(type).build_from_hash(value)
355
+ # models (e.g. Pet) or oneOf
356
+ klass = Shotstack.const_get(type)
357
+ klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
348
358
  end
349
359
  end
350
360
 
@@ -370,7 +380,7 @@ module Shotstack
370
380
  is_nullable = self.class.openapi_nullable.include?(attr)
371
381
  next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
372
382
  end
373
-
383
+
374
384
  hash[param] = _to_hash(value)
375
385
  end
376
386
  hash
@@ -393,5 +403,7 @@ module Shotstack
393
403
  value
394
404
  end
395
405
  end
406
+
396
407
  end
408
+
397
409
  end
@@ -0,0 +1,346 @@
1
+ =begin
2
+ #Shotstack
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
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
@@ -6,11 +6,12 @@
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
17
  # An edit defines the content of the video in a timeline and the output format.
@@ -31,6 +32,11 @@ module Shotstack
31
32
  }
32
33
  end
33
34
 
35
+ # Returns all the JSON keys this model knows about
36
+ def self.acceptable_attributes
37
+ attribute_map.values
38
+ end
39
+
34
40
  # Attribute type mapping.
35
41
  def self.openapi_types
36
42
  {
@@ -132,7 +138,9 @@ module Shotstack
132
138
  def build_from_hash(attributes)
133
139
  return nil unless attributes.is_a?(Hash)
134
140
  self.class.openapi_types.each_pair do |key, type|
135
- if type =~ /\AArray<(.*)>/i
141
+ if attributes[self.class.attribute_map[key]].nil? && self.class.openapi_nullable.include?(key)
142
+ self.send("#{key}=", nil)
143
+ elsif type =~ /\AArray<(.*)>/i
136
144
  # check to ensure the input is an array given that the attribute
137
145
  # is documented as an array but the input is not
138
146
  if attributes[self.class.attribute_map[key]].is_a?(Array)
@@ -140,7 +148,7 @@ module Shotstack
140
148
  end
141
149
  elsif !attributes[self.class.attribute_map[key]].nil?
142
150
  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
151
+ end
144
152
  end
145
153
 
146
154
  self
@@ -152,8 +160,8 @@ module Shotstack
152
160
  # @return [Object] Deserialized data
153
161
  def _deserialize(type, value)
154
162
  case type.to_sym
155
- when :DateTime
156
- DateTime.parse(value)
163
+ when :Time
164
+ Time.parse(value)
157
165
  when :Date
158
166
  Date.parse(value)
159
167
  when :String
@@ -183,7 +191,9 @@ module Shotstack
183
191
  end
184
192
  end
185
193
  else # model
186
- Shotstack.const_get(type).build_from_hash(value)
194
+ # models (e.g. Pet) or oneOf
195
+ klass = Shotstack.const_get(type)
196
+ klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
187
197
  end
188
198
  end
189
199
 
@@ -209,7 +219,7 @@ module Shotstack
209
219
  is_nullable = self.class.openapi_nullable.include?(attr)
210
220
  next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
211
221
  end
212
-
222
+
213
223
  hash[param] = _to_hash(value)
214
224
  end
215
225
  hash
@@ -232,5 +242,7 @@ module Shotstack
232
242
  value
233
243
  end
234
244
  end
245
+
235
246
  end
247
+
236
248
  end