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