shotstack 0.1.4 → 0.1.5

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,260 @@
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
+ # Specify a time range to render, i.e. to render only a portion of a video or audio file. Omit this setting to export the entire video.
18
+ class Range
19
+ # The point on the timeline, in seconds, to start the render from - i.e. start at second 3.
20
+ attr_accessor :start
21
+
22
+ # The length of the portion of the video to render - i.e. render 6 seconds of the video.
23
+ attr_accessor :length
24
+
25
+ # Attribute mapping from ruby-style variable name to JSON key.
26
+ def self.attribute_map
27
+ {
28
+ :'start' => :'start',
29
+ :'length' => :'length'
30
+ }
31
+ end
32
+
33
+ # Returns all the JSON keys this model knows about
34
+ def self.acceptable_attributes
35
+ attribute_map.values
36
+ end
37
+
38
+ # Attribute type mapping.
39
+ def self.openapi_types
40
+ {
41
+ :'start' => :'Float',
42
+ :'length' => :'Float'
43
+ }
44
+ end
45
+
46
+ # List of attributes with nullable: true
47
+ def self.openapi_nullable
48
+ Set.new([
49
+ ])
50
+ end
51
+
52
+ # Initializes the object
53
+ # @param [Hash] attributes Model attributes in the form of hash
54
+ def initialize(attributes = {})
55
+ if (!attributes.is_a?(Hash))
56
+ fail ArgumentError, "The input argument (attributes) must be a hash in `Shotstack::Range` initialize method"
57
+ end
58
+
59
+ # check to see if the attribute exists and convert string to symbol for hash key
60
+ attributes = attributes.each_with_object({}) { |(k, v), h|
61
+ if (!self.class.attribute_map.key?(k.to_sym))
62
+ fail ArgumentError, "`#{k}` is not a valid attribute in `Shotstack::Range`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
63
+ end
64
+ h[k.to_sym] = v
65
+ }
66
+
67
+ if attributes.key?(:'start')
68
+ self.start = attributes[:'start']
69
+ end
70
+
71
+ if attributes.key?(:'length')
72
+ self.length = attributes[:'length']
73
+ end
74
+ end
75
+
76
+ # Show invalid properties with the reasons. Usually used together with valid?
77
+ # @return Array for valid properties with the reasons
78
+ def list_invalid_properties
79
+ invalid_properties = Array.new
80
+ if !@start.nil? && @start < 0
81
+ invalid_properties.push('invalid value for "start", must be greater than or equal to 0.')
82
+ end
83
+
84
+ if !@length.nil? && @length < 0
85
+ invalid_properties.push('invalid value for "length", must be greater than or equal to 0.')
86
+ end
87
+
88
+ invalid_properties
89
+ end
90
+
91
+ # Check to see if the all the properties in the model are valid
92
+ # @return true if the model is valid
93
+ def valid?
94
+ return false if !@start.nil? && @start < 0
95
+ return false if !@length.nil? && @length < 0
96
+ true
97
+ end
98
+
99
+ # Custom attribute writer method with validation
100
+ # @param [Object] start Value to be assigned
101
+ def start=(start)
102
+ if !start.nil? && start < 0
103
+ fail ArgumentError, 'invalid value for "start", must be greater than or equal to 0.'
104
+ end
105
+
106
+ @start = start
107
+ end
108
+
109
+ # Custom attribute writer method with validation
110
+ # @param [Object] length Value to be assigned
111
+ def length=(length)
112
+ if !length.nil? && length < 0
113
+ fail ArgumentError, 'invalid value for "length", must be greater than or equal to 0.'
114
+ end
115
+
116
+ @length = length
117
+ end
118
+
119
+ # Checks equality by comparing each attribute.
120
+ # @param [Object] Object to be compared
121
+ def ==(o)
122
+ return true if self.equal?(o)
123
+ self.class == o.class &&
124
+ start == o.start &&
125
+ length == o.length
126
+ end
127
+
128
+ # @see the `==` method
129
+ # @param [Object] Object to be compared
130
+ def eql?(o)
131
+ self == o
132
+ end
133
+
134
+ # Calculates hash code according to all attributes.
135
+ # @return [Integer] Hash code
136
+ def hash
137
+ [start, length].hash
138
+ end
139
+
140
+ # Builds the object from hash
141
+ # @param [Hash] attributes Model attributes in the form of hash
142
+ # @return [Object] Returns the model itself
143
+ def self.build_from_hash(attributes)
144
+ new.build_from_hash(attributes)
145
+ end
146
+
147
+ # Builds the object from hash
148
+ # @param [Hash] attributes Model attributes in the form of hash
149
+ # @return [Object] Returns the model itself
150
+ def build_from_hash(attributes)
151
+ return nil unless attributes.is_a?(Hash)
152
+ self.class.openapi_types.each_pair do |key, type|
153
+ if attributes[self.class.attribute_map[key]].nil? && self.class.openapi_nullable.include?(key)
154
+ self.send("#{key}=", nil)
155
+ elsif type =~ /\AArray<(.*)>/i
156
+ # check to ensure the input is an array given that the attribute
157
+ # is documented as an array but the input is not
158
+ if attributes[self.class.attribute_map[key]].is_a?(Array)
159
+ self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
160
+ end
161
+ elsif !attributes[self.class.attribute_map[key]].nil?
162
+ self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
163
+ end
164
+ end
165
+
166
+ self
167
+ end
168
+
169
+ # Deserializes the data based on type
170
+ # @param string type Data type
171
+ # @param string value Value to be deserialized
172
+ # @return [Object] Deserialized data
173
+ def _deserialize(type, value)
174
+ case type.to_sym
175
+ when :Time
176
+ Time.parse(value)
177
+ when :Date
178
+ Date.parse(value)
179
+ when :String
180
+ value.to_s
181
+ when :Integer
182
+ value.to_i
183
+ when :Float
184
+ value.to_f
185
+ when :Boolean
186
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
187
+ true
188
+ else
189
+ false
190
+ end
191
+ when :Object
192
+ # generic object (usually a Hash), return directly
193
+ value
194
+ when /\AArray<(?<inner_type>.+)>\z/
195
+ inner_type = Regexp.last_match[:inner_type]
196
+ value.map { |v| _deserialize(inner_type, v) }
197
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
198
+ k_type = Regexp.last_match[:k_type]
199
+ v_type = Regexp.last_match[:v_type]
200
+ {}.tap do |hash|
201
+ value.each do |k, v|
202
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
203
+ end
204
+ end
205
+ else # model
206
+ # models (e.g. Pet) or oneOf
207
+ klass = Shotstack.const_get(type)
208
+ klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
209
+ end
210
+ end
211
+
212
+ # Returns the string representation of the object
213
+ # @return [String] String presentation of the object
214
+ def to_s
215
+ to_hash.to_s
216
+ end
217
+
218
+ # to_body is an alias to to_hash (backward compatibility)
219
+ # @return [Hash] Returns the object in the form of hash
220
+ def to_body
221
+ to_hash
222
+ end
223
+
224
+ # Returns the object in the form of hash
225
+ # @return [Hash] Returns the object in the form of hash
226
+ def to_hash
227
+ hash = {}
228
+ self.class.attribute_map.each_pair do |attr, param|
229
+ value = self.send(attr)
230
+ if value.nil?
231
+ is_nullable = self.class.openapi_nullable.include?(attr)
232
+ next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
233
+ end
234
+
235
+ hash[param] = _to_hash(value)
236
+ end
237
+ hash
238
+ end
239
+
240
+ # Outputs non-array value in the form of hash
241
+ # For object, use to_hash. Otherwise, just return the value
242
+ # @param [Object] value Any valid value
243
+ # @return [Hash] Returns the value in the form of hash
244
+ def _to_hash(value)
245
+ if value.is_a?(Array)
246
+ value.compact.map { |v| _to_hash(v) }
247
+ elsif value.is_a?(Hash)
248
+ {}.tap do |hash|
249
+ value.each { |k, v| hash[k] = _to_hash(v) }
250
+ end
251
+ elsif value.respond_to? :to_hash
252
+ value.to_hash
253
+ else
254
+ value
255
+ end
256
+ end
257
+
258
+ end
259
+
260
+ 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
  class RenderResponse
@@ -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
  {
@@ -137,7 +143,9 @@ module Shotstack
137
143
  def build_from_hash(attributes)
138
144
  return nil unless attributes.is_a?(Hash)
139
145
  self.class.openapi_types.each_pair do |key, type|
140
- if type =~ /\AArray<(.*)>/i
146
+ if attributes[self.class.attribute_map[key]].nil? && self.class.openapi_nullable.include?(key)
147
+ self.send("#{key}=", nil)
148
+ elsif type =~ /\AArray<(.*)>/i
141
149
  # check to ensure the input is an array given that the attribute
142
150
  # is documented as an array but the input is not
143
151
  if attributes[self.class.attribute_map[key]].is_a?(Array)
@@ -145,7 +153,7 @@ module Shotstack
145
153
  end
146
154
  elsif !attributes[self.class.attribute_map[key]].nil?
147
155
  self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
148
- end # or else data not found in attributes(hash), not an issue as the data can be optional
156
+ end
149
157
  end
150
158
 
151
159
  self
@@ -157,8 +165,8 @@ module Shotstack
157
165
  # @return [Object] Deserialized data
158
166
  def _deserialize(type, value)
159
167
  case type.to_sym
160
- when :DateTime
161
- DateTime.parse(value)
168
+ when :Time
169
+ Time.parse(value)
162
170
  when :Date
163
171
  Date.parse(value)
164
172
  when :String
@@ -188,7 +196,9 @@ module Shotstack
188
196
  end
189
197
  end
190
198
  else # model
191
- Shotstack.const_get(type).build_from_hash(value)
199
+ # models (e.g. Pet) or oneOf
200
+ klass = Shotstack.const_get(type)
201
+ klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
192
202
  end
193
203
  end
194
204
 
@@ -214,7 +224,7 @@ module Shotstack
214
224
  is_nullable = self.class.openapi_nullable.include?(attr)
215
225
  next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
216
226
  end
217
-
227
+
218
228
  hash[param] = _to_hash(value)
219
229
  end
220
230
  hash
@@ -237,5 +247,7 @@ module Shotstack
237
247
  value
238
248
  end
239
249
  end
250
+
240
251
  end
252
+
241
253
  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
  class RenderResponseData
@@ -93,6 +94,11 @@ module Shotstack
93
94
  }
94
95
  end
95
96
 
97
+ # Returns all the JSON keys this model knows about
98
+ def self.acceptable_attributes
99
+ attribute_map.values
100
+ end
101
+
96
102
  # Attribute type mapping.
97
103
  def self.openapi_types
98
104
  {
@@ -286,7 +292,9 @@ module Shotstack
286
292
  def build_from_hash(attributes)
287
293
  return nil unless attributes.is_a?(Hash)
288
294
  self.class.openapi_types.each_pair do |key, type|
289
- if type =~ /\AArray<(.*)>/i
295
+ if attributes[self.class.attribute_map[key]].nil? && self.class.openapi_nullable.include?(key)
296
+ self.send("#{key}=", nil)
297
+ elsif type =~ /\AArray<(.*)>/i
290
298
  # check to ensure the input is an array given that the attribute
291
299
  # is documented as an array but the input is not
292
300
  if attributes[self.class.attribute_map[key]].is_a?(Array)
@@ -294,7 +302,7 @@ module Shotstack
294
302
  end
295
303
  elsif !attributes[self.class.attribute_map[key]].nil?
296
304
  self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
297
- end # or else data not found in attributes(hash), not an issue as the data can be optional
305
+ end
298
306
  end
299
307
 
300
308
  self
@@ -306,8 +314,8 @@ module Shotstack
306
314
  # @return [Object] Deserialized data
307
315
  def _deserialize(type, value)
308
316
  case type.to_sym
309
- when :DateTime
310
- DateTime.parse(value)
317
+ when :Time
318
+ Time.parse(value)
311
319
  when :Date
312
320
  Date.parse(value)
313
321
  when :String
@@ -337,7 +345,9 @@ module Shotstack
337
345
  end
338
346
  end
339
347
  else # model
340
- Shotstack.const_get(type).build_from_hash(value)
348
+ # models (e.g. Pet) or oneOf
349
+ klass = Shotstack.const_get(type)
350
+ klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
341
351
  end
342
352
  end
343
353
 
@@ -363,7 +373,7 @@ module Shotstack
363
373
  is_nullable = self.class.openapi_nullable.include?(attr)
364
374
  next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
365
375
  end
366
-
376
+
367
377
  hash[param] = _to_hash(value)
368
378
  end
369
379
  hash
@@ -386,5 +396,7 @@ module Shotstack
386
396
  value
387
397
  end
388
398
  end
399
+
389
400
  end
401
+
390
402
  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
  # A music or audio file in mp3 format that plays for the duration of the rendered video or the length of the audio file, which ever is shortest.
@@ -55,6 +56,11 @@ module Shotstack
55
56
  }
56
57
  end
57
58
 
59
+ # Returns all the JSON keys this model knows about
60
+ def self.acceptable_attributes
61
+ attribute_map.values
62
+ end
63
+
58
64
  # Attribute type mapping.
59
65
  def self.openapi_types
60
66
  {
@@ -165,7 +171,9 @@ module Shotstack
165
171
  def build_from_hash(attributes)
166
172
  return nil unless attributes.is_a?(Hash)
167
173
  self.class.openapi_types.each_pair do |key, type|
168
- if type =~ /\AArray<(.*)>/i
174
+ if attributes[self.class.attribute_map[key]].nil? && self.class.openapi_nullable.include?(key)
175
+ self.send("#{key}=", nil)
176
+ elsif type =~ /\AArray<(.*)>/i
169
177
  # check to ensure the input is an array given that the attribute
170
178
  # is documented as an array but the input is not
171
179
  if attributes[self.class.attribute_map[key]].is_a?(Array)
@@ -173,7 +181,7 @@ module Shotstack
173
181
  end
174
182
  elsif !attributes[self.class.attribute_map[key]].nil?
175
183
  self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
176
- end # or else data not found in attributes(hash), not an issue as the data can be optional
184
+ end
177
185
  end
178
186
 
179
187
  self
@@ -185,8 +193,8 @@ module Shotstack
185
193
  # @return [Object] Deserialized data
186
194
  def _deserialize(type, value)
187
195
  case type.to_sym
188
- when :DateTime
189
- DateTime.parse(value)
196
+ when :Time
197
+ Time.parse(value)
190
198
  when :Date
191
199
  Date.parse(value)
192
200
  when :String
@@ -216,7 +224,9 @@ module Shotstack
216
224
  end
217
225
  end
218
226
  else # model
219
- Shotstack.const_get(type).build_from_hash(value)
227
+ # models (e.g. Pet) or oneOf
228
+ klass = Shotstack.const_get(type)
229
+ klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
220
230
  end
221
231
  end
222
232
 
@@ -242,7 +252,7 @@ module Shotstack
242
252
  is_nullable = self.class.openapi_nullable.include?(attr)
243
253
  next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
244
254
  end
245
-
255
+
246
256
  hash[param] = _to_hash(value)
247
257
  end
248
258
  hash
@@ -265,5 +275,7 @@ module Shotstack
265
275
  value
266
276
  end
267
277
  end
278
+
268
279
  end
280
+
269
281
  end