shotstack 0.1.3 → 0.1.7

Sign up to get free protection for your applications and to get access to all the features.
@@ -1,16 +1,17 @@
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
+ #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 visit [shotstack.io](https://shotstack.io) or checkout our [getting started](https://shotstack.gitbook.io/docs/guides/getting-started) documentation.
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
17
  class QueuedResponse
@@ -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
@@ -1,16 +1,17 @@
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
+ #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 visit [shotstack.io](https://shotstack.io) or checkout our [getting started](https://shotstack.gitbook.io/docs/guides/getting-started) documentation.
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
17
  class QueuedResponseData
@@ -28,6 +29,11 @@ module Shotstack
28
29
  }
29
30
  end
30
31
 
32
+ # Returns all the JSON keys this model knows about
33
+ def self.acceptable_attributes
34
+ attribute_map.values
35
+ end
36
+
31
37
  # Attribute type mapping.
32
38
  def self.openapi_types
33
39
  {
@@ -123,7 +129,9 @@ module Shotstack
123
129
  def build_from_hash(attributes)
124
130
  return nil unless attributes.is_a?(Hash)
125
131
  self.class.openapi_types.each_pair do |key, type|
126
- if type =~ /\AArray<(.*)>/i
132
+ if attributes[self.class.attribute_map[key]].nil? && self.class.openapi_nullable.include?(key)
133
+ self.send("#{key}=", nil)
134
+ elsif type =~ /\AArray<(.*)>/i
127
135
  # check to ensure the input is an array given that the attribute
128
136
  # is documented as an array but the input is not
129
137
  if attributes[self.class.attribute_map[key]].is_a?(Array)
@@ -131,7 +139,7 @@ module Shotstack
131
139
  end
132
140
  elsif !attributes[self.class.attribute_map[key]].nil?
133
141
  self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
134
- end # or else data not found in attributes(hash), not an issue as the data can be optional
142
+ end
135
143
  end
136
144
 
137
145
  self
@@ -143,8 +151,8 @@ module Shotstack
143
151
  # @return [Object] Deserialized data
144
152
  def _deserialize(type, value)
145
153
  case type.to_sym
146
- when :DateTime
147
- DateTime.parse(value)
154
+ when :Time
155
+ Time.parse(value)
148
156
  when :Date
149
157
  Date.parse(value)
150
158
  when :String
@@ -174,7 +182,9 @@ module Shotstack
174
182
  end
175
183
  end
176
184
  else # model
177
- Shotstack.const_get(type).build_from_hash(value)
185
+ # models (e.g. Pet) or oneOf
186
+ klass = Shotstack.const_get(type)
187
+ klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
178
188
  end
179
189
  end
180
190
 
@@ -200,7 +210,7 @@ module Shotstack
200
210
  is_nullable = self.class.openapi_nullable.include?(attr)
201
211
  next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
202
212
  end
203
-
213
+
204
214
  hash[param] = _to_hash(value)
205
215
  end
206
216
  hash
@@ -223,5 +233,7 @@ module Shotstack
223
233
  value
224
234
  end
225
235
  end
236
+
226
237
  end
238
+
227
239
  end
@@ -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 visit [shotstack.io](https://shotstack.io) or checkout our [getting started](https://shotstack.gitbook.io/docs/guides/getting-started) documentation.
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
@@ -1,16 +1,17 @@
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
+ #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 visit [shotstack.io](https://shotstack.io) or checkout our [getting started](https://shotstack.gitbook.io/docs/guides/getting-started) documentation.
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
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