shotstack 0.0.9 → 0.1.2

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 +5 -5
  2. data/README.md +17 -0
  3. data/lib/shotstack.rb +31 -15
  4. data/lib/shotstack/api/endpoints_api.rb +149 -0
  5. data/lib/shotstack/api_client.rb +142 -74
  6. data/lib/shotstack/api_error.rb +38 -5
  7. data/lib/shotstack/configuration.rb +93 -5
  8. data/lib/shotstack/models/asset.rb +17 -0
  9. data/lib/shotstack/models/audio_asset.rb +251 -0
  10. data/lib/shotstack/models/clip.rb +395 -0
  11. data/lib/shotstack/models/edit.rb +121 -42
  12. data/lib/shotstack/models/font.rb +213 -0
  13. data/lib/shotstack/models/html_asset.rb +319 -0
  14. data/lib/shotstack/models/image_asset.rb +231 -0
  15. data/lib/shotstack/models/luma_asset.rb +241 -0
  16. data/lib/shotstack/models/offset.rb +266 -0
  17. data/lib/shotstack/models/output.rb +207 -46
  18. data/lib/shotstack/models/poster.rb +213 -0
  19. data/lib/shotstack/models/queued_response.rb +121 -49
  20. data/lib/shotstack/models/queued_response_data.rb +116 -46
  21. data/lib/shotstack/models/render_response.rb +121 -49
  22. data/lib/shotstack/models/render_response_data.rb +193 -69
  23. data/lib/shotstack/models/soundtrack.rb +152 -42
  24. data/lib/shotstack/models/thumbnail.rb +228 -0
  25. data/lib/shotstack/models/timeline.rb +124 -45
  26. data/lib/shotstack/models/title_asset.rb +354 -0
  27. data/lib/shotstack/models/track.rb +100 -34
  28. data/lib/shotstack/models/transition.rb +132 -43
  29. data/lib/shotstack/models/video_asset.rb +251 -0
  30. data/lib/shotstack/version.rb +13 -1
  31. data/shotstack.gemspec +23 -16
  32. metadata +37 -150
  33. data/lib/shotstack/api/render_api.rb +0 -137
  34. data/lib/shotstack/models/clips.rb +0 -147
  35. data/lib/shotstack/models/image_clip.rb +0 -216
  36. data/lib/shotstack/models/image_clip_options.rb +0 -175
  37. data/lib/shotstack/models/title_clip.rb +0 -216
  38. data/lib/shotstack/models/title_clip_options.rb +0 -194
  39. data/lib/shotstack/models/video_clip.rb +0 -216
  40. data/lib/shotstack/models/video_clip_options.rb +0 -185
  41. data/tags +0 -306
@@ -1,87 +1,146 @@
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: 4.2.1
10
+
11
+ =end
12
+
1
13
  require 'date'
2
14
 
3
15
  module Shotstack
4
- # Model for QueuedResponseData
5
16
  class QueuedResponseData
6
- attr_accessor :id
7
-
17
+ # Success response message
8
18
  attr_accessor :message
9
19
 
20
+ # The id of the render task in UUID format
21
+ attr_accessor :id
22
+
10
23
  # Attribute mapping from ruby-style variable name to JSON key.
11
24
  def self.attribute_map
12
25
  {
13
-
14
- :'id' => :'id',
15
-
16
- :'message' => :'message'
17
-
26
+ :'message' => :'message',
27
+ :'id' => :'id'
18
28
  }
19
29
  end
20
30
 
21
31
  # Attribute type mapping.
22
- def self.swagger_types
32
+ def self.openapi_types
23
33
  {
24
- :'id' => :'String',
25
- :'message' => :'String'
26
-
34
+ :'message' => :'String',
35
+ :'id' => :'String'
27
36
  }
28
37
  end
29
38
 
39
+ # List of attributes with nullable: true
40
+ def self.openapi_nullable
41
+ Set.new([
42
+ ])
43
+ end
44
+
45
+ # Initializes the object
46
+ # @param [Hash] attributes Model attributes in the form of hash
30
47
  def initialize(attributes = {})
31
- return unless attributes.is_a?(Hash)
48
+ if (!attributes.is_a?(Hash))
49
+ fail ArgumentError, "The input argument (attributes) must be a hash in `Shotstack::QueuedResponseData` initialize method"
50
+ end
32
51
 
33
- # convert string to symbol for hash key
34
- attributes = attributes.inject({}){|memo,(k,v)| memo[k.to_sym] = v; memo}
52
+ # check to see if the attribute exists and convert string to symbol for hash key
53
+ attributes = attributes.each_with_object({}) { |(k, v), h|
54
+ if (!self.class.attribute_map.key?(k.to_sym))
55
+ fail ArgumentError, "`#{k}` is not a valid attribute in `Shotstack::QueuedResponseData`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
56
+ end
57
+ h[k.to_sym] = v
58
+ }
35
59
 
36
-
37
- if attributes[:'id']
60
+ if attributes.key?(:'message')
61
+ self.message = attributes[:'message']
62
+ end
63
+
64
+ if attributes.key?(:'id')
38
65
  self.id = attributes[:'id']
39
66
  end
40
-
41
- if attributes[:'message']
42
- self.message = attributes[:'message']
67
+ end
68
+
69
+ # Show invalid properties with the reasons. Usually used together with valid?
70
+ # @return Array for valid properties with the reasons
71
+ def list_invalid_properties
72
+ invalid_properties = Array.new
73
+ if @message.nil?
74
+ invalid_properties.push('invalid value for "message", message cannot be nil.')
43
75
  end
44
-
76
+
77
+ if @id.nil?
78
+ invalid_properties.push('invalid value for "id", id cannot be nil.')
79
+ end
80
+
81
+ invalid_properties
82
+ end
83
+
84
+ # Check to see if the all the properties in the model are valid
85
+ # @return true if the model is valid
86
+ def valid?
87
+ return false if @message.nil?
88
+ return false if @id.nil?
89
+ true
45
90
  end
46
91
 
47
- # Check equality by comparing each attribute.
92
+ # Checks equality by comparing each attribute.
93
+ # @param [Object] Object to be compared
48
94
  def ==(o)
49
95
  return true if self.equal?(o)
50
96
  self.class == o.class &&
51
- id == o.id &&
52
- message == o.message
97
+ message == o.message &&
98
+ id == o.id
53
99
  end
54
100
 
55
101
  # @see the `==` method
102
+ # @param [Object] Object to be compared
56
103
  def eql?(o)
57
104
  self == o
58
105
  end
59
106
 
60
- # Calculate hash code according to all attributes.
107
+ # Calculates hash code according to all attributes.
108
+ # @return [Integer] Hash code
61
109
  def hash
62
- [id, message].hash
110
+ [message, id].hash
111
+ end
112
+
113
+ # Builds the object from hash
114
+ # @param [Hash] attributes Model attributes in the form of hash
115
+ # @return [Object] Returns the model itself
116
+ def self.build_from_hash(attributes)
117
+ new.build_from_hash(attributes)
63
118
  end
64
119
 
65
- # build the object from hash
120
+ # Builds the object from hash
121
+ # @param [Hash] attributes Model attributes in the form of hash
122
+ # @return [Object] Returns the model itself
66
123
  def build_from_hash(attributes)
67
124
  return nil unless attributes.is_a?(Hash)
68
- self.class.swagger_types.each_pair do |key, type|
69
- if type =~ /^Array<(.*)>/i
125
+ self.class.openapi_types.each_pair do |key, type|
126
+ if type =~ /\AArray<(.*)>/i
127
+ # check to ensure the input is an array given that the attribute
128
+ # is documented as an array but the input is not
70
129
  if attributes[self.class.attribute_map[key]].is_a?(Array)
71
- self.send("#{key}=", attributes[self.class.attribute_map[key]].map{ |v| _deserialize($1, v) } )
72
- else
73
- #TODO show warning in debug mode
130
+ self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
74
131
  end
75
132
  elsif !attributes[self.class.attribute_map[key]].nil?
76
133
  self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
77
- else
78
- # data not found in attributes(hash), not an issue as the data can be optional
79
- end
134
+ end # or else data not found in attributes(hash), not an issue as the data can be optional
80
135
  end
81
136
 
82
137
  self
83
138
  end
84
139
 
140
+ # Deserializes the data based on type
141
+ # @param string type Data type
142
+ # @param string value Value to be deserialized
143
+ # @return [Object] Deserialized data
85
144
  def _deserialize(type, value)
86
145
  case type.to_sym
87
146
  when :DateTime
@@ -94,16 +153,19 @@ module Shotstack
94
153
  value.to_i
95
154
  when :Float
96
155
  value.to_f
97
- when :BOOLEAN
98
- if value =~ /^(true|t|yes|y|1)$/i
156
+ when :Boolean
157
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
99
158
  true
100
159
  else
101
160
  false
102
161
  end
162
+ when :Object
163
+ # generic object (usually a Hash), return directly
164
+ value
103
165
  when /\AArray<(?<inner_type>.+)>\z/
104
166
  inner_type = Regexp.last_match[:inner_type]
105
167
  value.map { |v| _deserialize(inner_type, v) }
106
- when /\AHash<(?<k_type>.+), (?<v_type>.+)>\z/
168
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
107
169
  k_type = Regexp.last_match[:k_type]
108
170
  v_type = Regexp.last_match[:v_type]
109
171
  {}.tap do |hash|
@@ -112,36 +174,45 @@ module Shotstack
112
174
  end
113
175
  end
114
176
  else # model
115
- _model = Shotstack.const_get(type).new
116
- _model.build_from_hash(value)
177
+ Shotstack.const_get(type).build_from_hash(value)
117
178
  end
118
179
  end
119
180
 
181
+ # Returns the string representation of the object
182
+ # @return [String] String presentation of the object
120
183
  def to_s
121
184
  to_hash.to_s
122
185
  end
123
186
 
124
- # to_body is an alias to to_body (backward compatibility))
187
+ # to_body is an alias to to_hash (backward compatibility)
188
+ # @return [Hash] Returns the object in the form of hash
125
189
  def to_body
126
190
  to_hash
127
191
  end
128
192
 
129
- # return the object in the form of hash
193
+ # Returns the object in the form of hash
194
+ # @return [Hash] Returns the object in the form of hash
130
195
  def to_hash
131
196
  hash = {}
132
197
  self.class.attribute_map.each_pair do |attr, param|
133
198
  value = self.send(attr)
134
- next if value.nil?
199
+ if value.nil?
200
+ is_nullable = self.class.openapi_nullable.include?(attr)
201
+ next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
202
+ end
203
+
135
204
  hash[param] = _to_hash(value)
136
205
  end
137
206
  hash
138
207
  end
139
208
 
140
- # Method to output non-array value in the form of hash
209
+ # Outputs non-array value in the form of hash
141
210
  # For object, use to_hash. Otherwise, just return the value
211
+ # @param [Object] value Any valid value
212
+ # @return [Hash] Returns the value in the form of hash
142
213
  def _to_hash(value)
143
214
  if value.is_a?(Array)
144
- value.compact.map{ |v| _to_hash(v) }
215
+ value.compact.map { |v| _to_hash(v) }
145
216
  elsif value.is_a?(Hash)
146
217
  {}.tap do |hash|
147
218
  value.each { |k, v| hash[k] = _to_hash(v) }
@@ -152,6 +223,5 @@ module Shotstack
152
223
  value
153
224
  end
154
225
  end
155
-
156
226
  end
157
227
  end
@@ -1,97 +1,158 @@
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: 4.2.1
10
+
11
+ =end
12
+
1
13
  require 'date'
2
14
 
3
15
  module Shotstack
4
- # Model for RenderResponse
5
16
  class RenderResponse
17
+ attr_accessor :success
18
+
6
19
  attr_accessor :message
7
20
 
8
21
  attr_accessor :response
9
22
 
10
- attr_accessor :success
11
-
12
23
  # Attribute mapping from ruby-style variable name to JSON key.
13
24
  def self.attribute_map
14
25
  {
15
-
26
+ :'success' => :'success',
16
27
  :'message' => :'message',
17
-
18
- :'response' => :'response',
19
-
20
- :'success' => :'success'
21
-
28
+ :'response' => :'response'
22
29
  }
23
30
  end
24
31
 
25
32
  # Attribute type mapping.
26
- def self.swagger_types
33
+ def self.openapi_types
27
34
  {
35
+ :'success' => :'Boolean',
28
36
  :'message' => :'String',
29
- :'response' => :'RenderResponseData',
30
- :'success' => :'BOOLEAN'
31
-
37
+ :'response' => :'RenderResponseData'
32
38
  }
33
39
  end
34
40
 
41
+ # List of attributes with nullable: true
42
+ def self.openapi_nullable
43
+ Set.new([
44
+ ])
45
+ end
46
+
47
+ # Initializes the object
48
+ # @param [Hash] attributes Model attributes in the form of hash
35
49
  def initialize(attributes = {})
36
- return unless attributes.is_a?(Hash)
50
+ if (!attributes.is_a?(Hash))
51
+ fail ArgumentError, "The input argument (attributes) must be a hash in `Shotstack::RenderResponse` initialize method"
52
+ end
37
53
 
38
- # convert string to symbol for hash key
39
- attributes = attributes.inject({}){|memo,(k,v)| memo[k.to_sym] = v; memo}
54
+ # check to see if the attribute exists and convert string to symbol for hash key
55
+ attributes = attributes.each_with_object({}) { |(k, v), h|
56
+ if (!self.class.attribute_map.key?(k.to_sym))
57
+ fail ArgumentError, "`#{k}` is not a valid attribute in `Shotstack::RenderResponse`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
58
+ end
59
+ h[k.to_sym] = v
60
+ }
40
61
 
41
-
42
- if attributes[:'message']
62
+ if attributes.key?(:'success')
63
+ self.success = attributes[:'success']
64
+ end
65
+
66
+ if attributes.key?(:'message')
43
67
  self.message = attributes[:'message']
44
68
  end
45
-
46
- if attributes[:'response']
69
+
70
+ if attributes.key?(:'response')
47
71
  self.response = attributes[:'response']
48
72
  end
49
-
50
- if attributes[:'success']
51
- self.success = attributes[:'success']
73
+ end
74
+
75
+ # Show invalid properties with the reasons. Usually used together with valid?
76
+ # @return Array for valid properties with the reasons
77
+ def list_invalid_properties
78
+ invalid_properties = Array.new
79
+ if @success.nil?
80
+ invalid_properties.push('invalid value for "success", success cannot be nil.')
52
81
  end
53
-
82
+
83
+ if @message.nil?
84
+ invalid_properties.push('invalid value for "message", message cannot be nil.')
85
+ end
86
+
87
+ if @response.nil?
88
+ invalid_properties.push('invalid value for "response", response cannot be nil.')
89
+ end
90
+
91
+ invalid_properties
54
92
  end
55
93
 
56
- # Check equality by comparing each attribute.
94
+ # Check to see if the all the properties in the model are valid
95
+ # @return true if the model is valid
96
+ def valid?
97
+ return false if @success.nil?
98
+ return false if @message.nil?
99
+ return false if @response.nil?
100
+ true
101
+ end
102
+
103
+ # Checks equality by comparing each attribute.
104
+ # @param [Object] Object to be compared
57
105
  def ==(o)
58
106
  return true if self.equal?(o)
59
107
  self.class == o.class &&
108
+ success == o.success &&
60
109
  message == o.message &&
61
- response == o.response &&
62
- success == o.success
110
+ response == o.response
63
111
  end
64
112
 
65
113
  # @see the `==` method
114
+ # @param [Object] Object to be compared
66
115
  def eql?(o)
67
116
  self == o
68
117
  end
69
118
 
70
- # Calculate hash code according to all attributes.
119
+ # Calculates hash code according to all attributes.
120
+ # @return [Integer] Hash code
71
121
  def hash
72
- [message, response, success].hash
122
+ [success, message, response].hash
73
123
  end
74
124
 
75
- # build the object from hash
125
+ # Builds the object from hash
126
+ # @param [Hash] attributes Model attributes in the form of hash
127
+ # @return [Object] Returns the model itself
128
+ def self.build_from_hash(attributes)
129
+ new.build_from_hash(attributes)
130
+ end
131
+
132
+ # Builds the object from hash
133
+ # @param [Hash] attributes Model attributes in the form of hash
134
+ # @return [Object] Returns the model itself
76
135
  def build_from_hash(attributes)
77
136
  return nil unless attributes.is_a?(Hash)
78
- self.class.swagger_types.each_pair do |key, type|
79
- if type =~ /^Array<(.*)>/i
137
+ self.class.openapi_types.each_pair do |key, type|
138
+ if type =~ /\AArray<(.*)>/i
139
+ # check to ensure the input is an array given that the attribute
140
+ # is documented as an array but the input is not
80
141
  if attributes[self.class.attribute_map[key]].is_a?(Array)
81
- self.send("#{key}=", attributes[self.class.attribute_map[key]].map{ |v| _deserialize($1, v) } )
82
- else
83
- #TODO show warning in debug mode
142
+ self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
84
143
  end
85
144
  elsif !attributes[self.class.attribute_map[key]].nil?
86
145
  self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
87
- else
88
- # data not found in attributes(hash), not an issue as the data can be optional
89
- end
146
+ end # or else data not found in attributes(hash), not an issue as the data can be optional
90
147
  end
91
148
 
92
149
  self
93
150
  end
94
151
 
152
+ # Deserializes the data based on type
153
+ # @param string type Data type
154
+ # @param string value Value to be deserialized
155
+ # @return [Object] Deserialized data
95
156
  def _deserialize(type, value)
96
157
  case type.to_sym
97
158
  when :DateTime
@@ -104,16 +165,19 @@ module Shotstack
104
165
  value.to_i
105
166
  when :Float
106
167
  value.to_f
107
- when :BOOLEAN
108
- if value =~ /^(true|t|yes|y|1)$/i
168
+ when :Boolean
169
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
109
170
  true
110
171
  else
111
172
  false
112
173
  end
174
+ when :Object
175
+ # generic object (usually a Hash), return directly
176
+ value
113
177
  when /\AArray<(?<inner_type>.+)>\z/
114
178
  inner_type = Regexp.last_match[:inner_type]
115
179
  value.map { |v| _deserialize(inner_type, v) }
116
- when /\AHash<(?<k_type>.+), (?<v_type>.+)>\z/
180
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
117
181
  k_type = Regexp.last_match[:k_type]
118
182
  v_type = Regexp.last_match[:v_type]
119
183
  {}.tap do |hash|
@@ -122,36 +186,45 @@ module Shotstack
122
186
  end
123
187
  end
124
188
  else # model
125
- _model = Shotstack.const_get(type).new
126
- _model.build_from_hash(value)
189
+ Shotstack.const_get(type).build_from_hash(value)
127
190
  end
128
191
  end
129
192
 
193
+ # Returns the string representation of the object
194
+ # @return [String] String presentation of the object
130
195
  def to_s
131
196
  to_hash.to_s
132
197
  end
133
198
 
134
- # to_body is an alias to to_body (backward compatibility))
199
+ # to_body is an alias to to_hash (backward compatibility)
200
+ # @return [Hash] Returns the object in the form of hash
135
201
  def to_body
136
202
  to_hash
137
203
  end
138
204
 
139
- # return the object in the form of hash
205
+ # Returns the object in the form of hash
206
+ # @return [Hash] Returns the object in the form of hash
140
207
  def to_hash
141
208
  hash = {}
142
209
  self.class.attribute_map.each_pair do |attr, param|
143
210
  value = self.send(attr)
144
- next if value.nil?
211
+ if value.nil?
212
+ is_nullable = self.class.openapi_nullable.include?(attr)
213
+ next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
214
+ end
215
+
145
216
  hash[param] = _to_hash(value)
146
217
  end
147
218
  hash
148
219
  end
149
220
 
150
- # Method to output non-array value in the form of hash
221
+ # Outputs non-array value in the form of hash
151
222
  # For object, use to_hash. Otherwise, just return the value
223
+ # @param [Object] value Any valid value
224
+ # @return [Hash] Returns the value in the form of hash
152
225
  def _to_hash(value)
153
226
  if value.is_a?(Array)
154
- value.compact.map{ |v| _to_hash(v) }
227
+ value.compact.map { |v| _to_hash(v) }
155
228
  elsif value.is_a?(Hash)
156
229
  {}.tap do |hash|
157
230
  value.each { |k, v| hash[k] = _to_hash(v) }
@@ -162,6 +235,5 @@ module Shotstack
162
235
  value
163
236
  end
164
237
  end
165
-
166
238
  end
167
239
  end