shotstack 0.0.11 → 0.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/shotstack.rb +12 -5
- data/lib/shotstack/api/{default_api.rb → endpoints_api.rb} +17 -17
- data/lib/shotstack/api_client.rb +33 -34
- data/lib/shotstack/api_error.rb +4 -4
- data/lib/shotstack/configuration.rb +11 -10
- data/lib/shotstack/models/audio_asset.rb +251 -0
- data/lib/shotstack/models/clip.rb +98 -11
- data/lib/shotstack/models/edit.rb +29 -9
- data/lib/shotstack/models/font.rb +213 -0
- data/lib/shotstack/models/html_asset.rb +319 -0
- data/lib/shotstack/models/image_asset.rb +15 -5
- data/lib/shotstack/models/luma_asset.rb +241 -0
- data/lib/shotstack/models/offset.rb +266 -0
- data/lib/shotstack/models/output.rb +85 -11
- data/lib/shotstack/models/poster.rb +213 -0
- data/lib/shotstack/models/queued_response.rb +14 -4
- data/lib/shotstack/models/queued_response_data.rb +14 -4
- data/lib/shotstack/models/render_response.rb +14 -4
- data/lib/shotstack/models/render_response_data.rb +14 -4
- data/lib/shotstack/models/soundtrack.rb +30 -10
- data/lib/shotstack/models/thumbnail.rb +228 -0
- data/lib/shotstack/models/timeline.rb +32 -8
- data/lib/shotstack/models/title_asset.rb +78 -13
- data/lib/shotstack/models/track.rb +15 -5
- data/lib/shotstack/models/transition.rb +18 -8
- data/lib/shotstack/models/video_asset.rb +18 -8
- data/lib/shotstack/version.rb +4 -4
- data/shotstack-0.0.11.gem +0 -0
- data/shotstack.gemspec +6 -12
- metadata +16 -126
@@ -0,0 +1,266 @@
|
|
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
|
+
|
13
|
+
require 'date'
|
14
|
+
|
15
|
+
module Shotstack
|
16
|
+
# Offsets the position of an asset horizontally or vertically by a relative distance.
|
17
|
+
class Offset
|
18
|
+
# Offset an asset on the horizontal axis (left or right), range varies from -1 to 1. Positive numbers move the asset right, negative left. For all assets except titles the distance moved is relative to the width of the viewport - i.e. an X offset of 0.5 will move the asset half the screen width to the right.
|
19
|
+
attr_accessor :x
|
20
|
+
|
21
|
+
# Offset an asset on the vertical axis (up or down), range varies from -1 to 1. Positive numbers move the asset up, negative down. For all assets except titles the distance moved is relative to the height of the viewport - i.e. an Y offset of 0.5 will move the asset up half the screen height.
|
22
|
+
attr_accessor :y
|
23
|
+
|
24
|
+
# Attribute mapping from ruby-style variable name to JSON key.
|
25
|
+
def self.attribute_map
|
26
|
+
{
|
27
|
+
:'x' => :'x',
|
28
|
+
:'y' => :'y'
|
29
|
+
}
|
30
|
+
end
|
31
|
+
|
32
|
+
# Attribute type mapping.
|
33
|
+
def self.openapi_types
|
34
|
+
{
|
35
|
+
:'x' => :'Float',
|
36
|
+
:'y' => :'Float'
|
37
|
+
}
|
38
|
+
end
|
39
|
+
|
40
|
+
# List of attributes with nullable: true
|
41
|
+
def self.openapi_nullable
|
42
|
+
Set.new([
|
43
|
+
])
|
44
|
+
end
|
45
|
+
|
46
|
+
# Initializes the object
|
47
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
48
|
+
def initialize(attributes = {})
|
49
|
+
if (!attributes.is_a?(Hash))
|
50
|
+
fail ArgumentError, "The input argument (attributes) must be a hash in `Shotstack::Offset` initialize method"
|
51
|
+
end
|
52
|
+
|
53
|
+
# check to see if the attribute exists and convert string to symbol for hash key
|
54
|
+
attributes = attributes.each_with_object({}) { |(k, v), h|
|
55
|
+
if (!self.class.attribute_map.key?(k.to_sym))
|
56
|
+
fail ArgumentError, "`#{k}` is not a valid attribute in `Shotstack::Offset`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
|
57
|
+
end
|
58
|
+
h[k.to_sym] = v
|
59
|
+
}
|
60
|
+
|
61
|
+
if attributes.key?(:'x')
|
62
|
+
self.x = attributes[:'x']
|
63
|
+
end
|
64
|
+
|
65
|
+
if attributes.key?(:'y')
|
66
|
+
self.y = attributes[:'y']
|
67
|
+
end
|
68
|
+
end
|
69
|
+
|
70
|
+
# Show invalid properties with the reasons. Usually used together with valid?
|
71
|
+
# @return Array for valid properties with the reasons
|
72
|
+
def list_invalid_properties
|
73
|
+
invalid_properties = Array.new
|
74
|
+
if !@x.nil? && @x > 1
|
75
|
+
invalid_properties.push('invalid value for "x", must be smaller than or equal to 1.')
|
76
|
+
end
|
77
|
+
|
78
|
+
if !@x.nil? && @x < -1
|
79
|
+
invalid_properties.push('invalid value for "x", must be greater than or equal to -1.')
|
80
|
+
end
|
81
|
+
|
82
|
+
if !@y.nil? && @y > 1
|
83
|
+
invalid_properties.push('invalid value for "y", must be smaller than or equal to 1.')
|
84
|
+
end
|
85
|
+
|
86
|
+
if !@y.nil? && @y < -1
|
87
|
+
invalid_properties.push('invalid value for "y", must be greater than or equal to -1.')
|
88
|
+
end
|
89
|
+
|
90
|
+
invalid_properties
|
91
|
+
end
|
92
|
+
|
93
|
+
# Check to see if the all the properties in the model are valid
|
94
|
+
# @return true if the model is valid
|
95
|
+
def valid?
|
96
|
+
return false if !@x.nil? && @x > 1
|
97
|
+
return false if !@x.nil? && @x < -1
|
98
|
+
return false if !@y.nil? && @y > 1
|
99
|
+
return false if !@y.nil? && @y < -1
|
100
|
+
true
|
101
|
+
end
|
102
|
+
|
103
|
+
# Custom attribute writer method with validation
|
104
|
+
# @param [Object] x Value to be assigned
|
105
|
+
def x=(x)
|
106
|
+
if !x.nil? && x > 1
|
107
|
+
fail ArgumentError, 'invalid value for "x", must be smaller than or equal to 1.'
|
108
|
+
end
|
109
|
+
|
110
|
+
if !x.nil? && x < -1
|
111
|
+
fail ArgumentError, 'invalid value for "x", must be greater than or equal to -1.'
|
112
|
+
end
|
113
|
+
|
114
|
+
@x = x
|
115
|
+
end
|
116
|
+
|
117
|
+
# Custom attribute writer method with validation
|
118
|
+
# @param [Object] y Value to be assigned
|
119
|
+
def y=(y)
|
120
|
+
if !y.nil? && y > 1
|
121
|
+
fail ArgumentError, 'invalid value for "y", must be smaller than or equal to 1.'
|
122
|
+
end
|
123
|
+
|
124
|
+
if !y.nil? && y < -1
|
125
|
+
fail ArgumentError, 'invalid value for "y", must be greater than or equal to -1.'
|
126
|
+
end
|
127
|
+
|
128
|
+
@y = y
|
129
|
+
end
|
130
|
+
|
131
|
+
# Checks equality by comparing each attribute.
|
132
|
+
# @param [Object] Object to be compared
|
133
|
+
def ==(o)
|
134
|
+
return true if self.equal?(o)
|
135
|
+
self.class == o.class &&
|
136
|
+
x == o.x &&
|
137
|
+
y == o.y
|
138
|
+
end
|
139
|
+
|
140
|
+
# @see the `==` method
|
141
|
+
# @param [Object] Object to be compared
|
142
|
+
def eql?(o)
|
143
|
+
self == o
|
144
|
+
end
|
145
|
+
|
146
|
+
# Calculates hash code according to all attributes.
|
147
|
+
# @return [Integer] Hash code
|
148
|
+
def hash
|
149
|
+
[x, y].hash
|
150
|
+
end
|
151
|
+
|
152
|
+
# Builds the object from hash
|
153
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
154
|
+
# @return [Object] Returns the model itself
|
155
|
+
def self.build_from_hash(attributes)
|
156
|
+
new.build_from_hash(attributes)
|
157
|
+
end
|
158
|
+
|
159
|
+
# Builds the object from hash
|
160
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
161
|
+
# @return [Object] Returns the model itself
|
162
|
+
def build_from_hash(attributes)
|
163
|
+
return nil unless attributes.is_a?(Hash)
|
164
|
+
self.class.openapi_types.each_pair do |key, type|
|
165
|
+
if type =~ /\AArray<(.*)>/i
|
166
|
+
# check to ensure the input is an array given that the attribute
|
167
|
+
# is documented as an array but the input is not
|
168
|
+
if attributes[self.class.attribute_map[key]].is_a?(Array)
|
169
|
+
self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
|
170
|
+
end
|
171
|
+
elsif !attributes[self.class.attribute_map[key]].nil?
|
172
|
+
self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
|
173
|
+
end # or else data not found in attributes(hash), not an issue as the data can be optional
|
174
|
+
end
|
175
|
+
|
176
|
+
self
|
177
|
+
end
|
178
|
+
|
179
|
+
# Deserializes the data based on type
|
180
|
+
# @param string type Data type
|
181
|
+
# @param string value Value to be deserialized
|
182
|
+
# @return [Object] Deserialized data
|
183
|
+
def _deserialize(type, value)
|
184
|
+
case type.to_sym
|
185
|
+
when :DateTime
|
186
|
+
DateTime.parse(value)
|
187
|
+
when :Date
|
188
|
+
Date.parse(value)
|
189
|
+
when :String
|
190
|
+
value.to_s
|
191
|
+
when :Integer
|
192
|
+
value.to_i
|
193
|
+
when :Float
|
194
|
+
value.to_f
|
195
|
+
when :Boolean
|
196
|
+
if value.to_s =~ /\A(true|t|yes|y|1)\z/i
|
197
|
+
true
|
198
|
+
else
|
199
|
+
false
|
200
|
+
end
|
201
|
+
when :Object
|
202
|
+
# generic object (usually a Hash), return directly
|
203
|
+
value
|
204
|
+
when /\AArray<(?<inner_type>.+)>\z/
|
205
|
+
inner_type = Regexp.last_match[:inner_type]
|
206
|
+
value.map { |v| _deserialize(inner_type, v) }
|
207
|
+
when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
|
208
|
+
k_type = Regexp.last_match[:k_type]
|
209
|
+
v_type = Regexp.last_match[:v_type]
|
210
|
+
{}.tap do |hash|
|
211
|
+
value.each do |k, v|
|
212
|
+
hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
|
213
|
+
end
|
214
|
+
end
|
215
|
+
else # model
|
216
|
+
Shotstack.const_get(type).build_from_hash(value)
|
217
|
+
end
|
218
|
+
end
|
219
|
+
|
220
|
+
# Returns the string representation of the object
|
221
|
+
# @return [String] String presentation of the object
|
222
|
+
def to_s
|
223
|
+
to_hash.to_s
|
224
|
+
end
|
225
|
+
|
226
|
+
# to_body is an alias to to_hash (backward compatibility)
|
227
|
+
# @return [Hash] Returns the object in the form of hash
|
228
|
+
def to_body
|
229
|
+
to_hash
|
230
|
+
end
|
231
|
+
|
232
|
+
# Returns the object in the form of hash
|
233
|
+
# @return [Hash] Returns the object in the form of hash
|
234
|
+
def to_hash
|
235
|
+
hash = {}
|
236
|
+
self.class.attribute_map.each_pair do |attr, param|
|
237
|
+
value = self.send(attr)
|
238
|
+
if value.nil?
|
239
|
+
is_nullable = self.class.openapi_nullable.include?(attr)
|
240
|
+
next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
|
241
|
+
end
|
242
|
+
|
243
|
+
hash[param] = _to_hash(value)
|
244
|
+
end
|
245
|
+
hash
|
246
|
+
end
|
247
|
+
|
248
|
+
# Outputs non-array value in the form of hash
|
249
|
+
# For object, use to_hash. Otherwise, just return the value
|
250
|
+
# @param [Object] value Any valid value
|
251
|
+
# @return [Hash] Returns the value in the form of hash
|
252
|
+
def _to_hash(value)
|
253
|
+
if value.is_a?(Array)
|
254
|
+
value.compact.map { |v| _to_hash(v) }
|
255
|
+
elsif value.is_a?(Hash)
|
256
|
+
{}.tap do |hash|
|
257
|
+
value.each { |k, v| hash[k] = _to_hash(v) }
|
258
|
+
end
|
259
|
+
elsif value.respond_to? :to_hash
|
260
|
+
value.to_hash
|
261
|
+
else
|
262
|
+
value
|
263
|
+
end
|
264
|
+
end
|
265
|
+
end
|
266
|
+
end
|
@@ -1,24 +1,36 @@
|
|
1
1
|
=begin
|
2
|
-
#
|
2
|
+
#Shotstack
|
3
3
|
|
4
|
-
#The Shotstack API is a video editing service that allows for the
|
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
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.
|
9
|
+
OpenAPI Generator version: 4.2.1
|
10
10
|
|
11
11
|
=end
|
12
12
|
|
13
13
|
require 'date'
|
14
14
|
|
15
15
|
module Shotstack
|
16
|
-
# The video output format
|
16
|
+
# The video output format.
|
17
17
|
class Output
|
18
|
+
# `mp4`, `webm` video or animated `gif`
|
18
19
|
attr_accessor :format
|
19
20
|
|
21
|
+
# The output resolution of the video. <ul> <li>`preview` - 512px x 288px @ 15fps</li> <li>`mobile` - 640px x 360px @ 25fps</li> <li>`sd` - 1024px x 576px @ 25fps</li> <li>`hd` - 1280px x 720px @ 25fps</li> <li>`1080` - 1920px x 1080px @ 25fps</li> </ul>
|
20
22
|
attr_accessor :resolution
|
21
23
|
|
24
|
+
# The aspect ratio (shape) of the video. Useful for social media sites. Options are: <ul> <li>`16:9` - regular landscape/horizontal aspect ratio (default)</li> <li>`9:16` - vertical/portrait aspect ratio.</li> <li>`1:1` - square aspect ratio.</li> </ul>
|
25
|
+
attr_accessor :aspect_ratio
|
26
|
+
|
27
|
+
# Override the resolution and scale the video to render at a different size. When using scaleTo the video should be edited at the resolution dimensions, i.e. use font sizes that look best at HD, then use scaleTo to output the video at SD and the text will be scaled to the correct size. This is useful if you want to create multiple video sizes. <ul> <li>`preview` - 512px x 288px @ 15fps</li> <li>`mobile` - 640px x 360px @ 25fps</li> <li>`sd` - 1024px x 576px @25fps</li> <li>`hd` - 1280px x 720px @25fps</li> <li>`1080` - 1920px x 1080px @25fps</li> </ul>
|
28
|
+
attr_accessor :scale_to
|
29
|
+
|
30
|
+
attr_accessor :poster
|
31
|
+
|
32
|
+
attr_accessor :thumbnail
|
33
|
+
|
22
34
|
class EnumAttributeValidator
|
23
35
|
attr_reader :datatype
|
24
36
|
attr_reader :allowable_values
|
@@ -45,7 +57,11 @@ module Shotstack
|
|
45
57
|
def self.attribute_map
|
46
58
|
{
|
47
59
|
:'format' => :'format',
|
48
|
-
:'resolution' => :'resolution'
|
60
|
+
:'resolution' => :'resolution',
|
61
|
+
:'aspect_ratio' => :'aspectRatio',
|
62
|
+
:'scale_to' => :'scaleTo',
|
63
|
+
:'poster' => :'poster',
|
64
|
+
:'thumbnail' => :'thumbnail'
|
49
65
|
}
|
50
66
|
end
|
51
67
|
|
@@ -53,10 +69,20 @@ module Shotstack
|
|
53
69
|
def self.openapi_types
|
54
70
|
{
|
55
71
|
:'format' => :'String',
|
56
|
-
:'resolution' => :'String'
|
72
|
+
:'resolution' => :'String',
|
73
|
+
:'aspect_ratio' => :'String',
|
74
|
+
:'scale_to' => :'String',
|
75
|
+
:'poster' => :'Poster',
|
76
|
+
:'thumbnail' => :'Thumbnail'
|
57
77
|
}
|
58
78
|
end
|
59
79
|
|
80
|
+
# List of attributes with nullable: true
|
81
|
+
def self.openapi_nullable
|
82
|
+
Set.new([
|
83
|
+
])
|
84
|
+
end
|
85
|
+
|
60
86
|
# Initializes the object
|
61
87
|
# @param [Hash] attributes Model attributes in the form of hash
|
62
88
|
def initialize(attributes = {})
|
@@ -79,6 +105,22 @@ module Shotstack
|
|
79
105
|
if attributes.key?(:'resolution')
|
80
106
|
self.resolution = attributes[:'resolution']
|
81
107
|
end
|
108
|
+
|
109
|
+
if attributes.key?(:'aspect_ratio')
|
110
|
+
self.aspect_ratio = attributes[:'aspect_ratio']
|
111
|
+
end
|
112
|
+
|
113
|
+
if attributes.key?(:'scale_to')
|
114
|
+
self.scale_to = attributes[:'scale_to']
|
115
|
+
end
|
116
|
+
|
117
|
+
if attributes.key?(:'poster')
|
118
|
+
self.poster = attributes[:'poster']
|
119
|
+
end
|
120
|
+
|
121
|
+
if attributes.key?(:'thumbnail')
|
122
|
+
self.thumbnail = attributes[:'thumbnail']
|
123
|
+
end
|
82
124
|
end
|
83
125
|
|
84
126
|
# Show invalid properties with the reasons. Usually used together with valid?
|
@@ -100,18 +142,22 @@ module Shotstack
|
|
100
142
|
# @return true if the model is valid
|
101
143
|
def valid?
|
102
144
|
return false if @format.nil?
|
103
|
-
format_validator = EnumAttributeValidator.new('String', ["mp4", "gif"])
|
145
|
+
format_validator = EnumAttributeValidator.new('String', ["mp4", "webm", "gif"])
|
104
146
|
return false unless format_validator.valid?(@format)
|
105
147
|
return false if @resolution.nil?
|
106
148
|
resolution_validator = EnumAttributeValidator.new('String', ["preview", "mobile", "sd", "hd", "1080"])
|
107
149
|
return false unless resolution_validator.valid?(@resolution)
|
150
|
+
aspect_ratio_validator = EnumAttributeValidator.new('String', ["16:9", "9:16", "1:1"])
|
151
|
+
return false unless aspect_ratio_validator.valid?(@aspect_ratio)
|
152
|
+
scale_to_validator = EnumAttributeValidator.new('String', ["preview", "mobile", "sd", "hd", "1080"])
|
153
|
+
return false unless scale_to_validator.valid?(@scale_to)
|
108
154
|
true
|
109
155
|
end
|
110
156
|
|
111
157
|
# Custom attribute writer method checking allowed values (enum).
|
112
158
|
# @param [Object] format Object to be assigned
|
113
159
|
def format=(format)
|
114
|
-
validator = EnumAttributeValidator.new('String', ["mp4", "gif"])
|
160
|
+
validator = EnumAttributeValidator.new('String', ["mp4", "webm", "gif"])
|
115
161
|
unless validator.valid?(format)
|
116
162
|
fail ArgumentError, "invalid value for \"format\", must be one of #{validator.allowable_values}."
|
117
163
|
end
|
@@ -128,13 +174,37 @@ module Shotstack
|
|
128
174
|
@resolution = resolution
|
129
175
|
end
|
130
176
|
|
177
|
+
# Custom attribute writer method checking allowed values (enum).
|
178
|
+
# @param [Object] aspect_ratio Object to be assigned
|
179
|
+
def aspect_ratio=(aspect_ratio)
|
180
|
+
validator = EnumAttributeValidator.new('String', ["16:9", "9:16", "1:1"])
|
181
|
+
unless validator.valid?(aspect_ratio)
|
182
|
+
fail ArgumentError, "invalid value for \"aspect_ratio\", must be one of #{validator.allowable_values}."
|
183
|
+
end
|
184
|
+
@aspect_ratio = aspect_ratio
|
185
|
+
end
|
186
|
+
|
187
|
+
# Custom attribute writer method checking allowed values (enum).
|
188
|
+
# @param [Object] scale_to Object to be assigned
|
189
|
+
def scale_to=(scale_to)
|
190
|
+
validator = EnumAttributeValidator.new('String', ["preview", "mobile", "sd", "hd", "1080"])
|
191
|
+
unless validator.valid?(scale_to)
|
192
|
+
fail ArgumentError, "invalid value for \"scale_to\", must be one of #{validator.allowable_values}."
|
193
|
+
end
|
194
|
+
@scale_to = scale_to
|
195
|
+
end
|
196
|
+
|
131
197
|
# Checks equality by comparing each attribute.
|
132
198
|
# @param [Object] Object to be compared
|
133
199
|
def ==(o)
|
134
200
|
return true if self.equal?(o)
|
135
201
|
self.class == o.class &&
|
136
202
|
format == o.format &&
|
137
|
-
resolution == o.resolution
|
203
|
+
resolution == o.resolution &&
|
204
|
+
aspect_ratio == o.aspect_ratio &&
|
205
|
+
scale_to == o.scale_to &&
|
206
|
+
poster == o.poster &&
|
207
|
+
thumbnail == o.thumbnail
|
138
208
|
end
|
139
209
|
|
140
210
|
# @see the `==` method
|
@@ -146,7 +216,7 @@ module Shotstack
|
|
146
216
|
# Calculates hash code according to all attributes.
|
147
217
|
# @return [Integer] Hash code
|
148
218
|
def hash
|
149
|
-
[format, resolution].hash
|
219
|
+
[format, resolution, aspect_ratio, scale_to, poster, thumbnail].hash
|
150
220
|
end
|
151
221
|
|
152
222
|
# Builds the object from hash
|
@@ -235,7 +305,11 @@ module Shotstack
|
|
235
305
|
hash = {}
|
236
306
|
self.class.attribute_map.each_pair do |attr, param|
|
237
307
|
value = self.send(attr)
|
238
|
-
|
308
|
+
if value.nil?
|
309
|
+
is_nullable = self.class.openapi_nullable.include?(attr)
|
310
|
+
next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
|
311
|
+
end
|
312
|
+
|
239
313
|
hash[param] = _to_hash(value)
|
240
314
|
end
|
241
315
|
hash
|
@@ -0,0 +1,213 @@
|
|
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
|
+
|
13
|
+
require 'date'
|
14
|
+
|
15
|
+
module Shotstack
|
16
|
+
# Generate a poster image for the video at a specific point from the timeline. The poster image size will match the size of the output video.
|
17
|
+
class Poster
|
18
|
+
# The point on the timeline in seconds to capture a single frame to use as the poster image.
|
19
|
+
attr_accessor :capture
|
20
|
+
|
21
|
+
# Attribute mapping from ruby-style variable name to JSON key.
|
22
|
+
def self.attribute_map
|
23
|
+
{
|
24
|
+
:'capture' => :'capture'
|
25
|
+
}
|
26
|
+
end
|
27
|
+
|
28
|
+
# Attribute type mapping.
|
29
|
+
def self.openapi_types
|
30
|
+
{
|
31
|
+
:'capture' => :'Float'
|
32
|
+
}
|
33
|
+
end
|
34
|
+
|
35
|
+
# List of attributes with nullable: true
|
36
|
+
def self.openapi_nullable
|
37
|
+
Set.new([
|
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::Poster` 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::Poster`. 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?(:'capture')
|
57
|
+
self.capture = attributes[:'capture']
|
58
|
+
end
|
59
|
+
end
|
60
|
+
|
61
|
+
# Show invalid properties with the reasons. Usually used together with valid?
|
62
|
+
# @return Array for valid properties with the reasons
|
63
|
+
def list_invalid_properties
|
64
|
+
invalid_properties = Array.new
|
65
|
+
if @capture.nil?
|
66
|
+
invalid_properties.push('invalid value for "capture", capture cannot be nil.')
|
67
|
+
end
|
68
|
+
|
69
|
+
invalid_properties
|
70
|
+
end
|
71
|
+
|
72
|
+
# Check to see if the all the properties in the model are valid
|
73
|
+
# @return true if the model is valid
|
74
|
+
def valid?
|
75
|
+
return false if @capture.nil?
|
76
|
+
true
|
77
|
+
end
|
78
|
+
|
79
|
+
# Checks equality by comparing each attribute.
|
80
|
+
# @param [Object] Object to be compared
|
81
|
+
def ==(o)
|
82
|
+
return true if self.equal?(o)
|
83
|
+
self.class == o.class &&
|
84
|
+
capture == o.capture
|
85
|
+
end
|
86
|
+
|
87
|
+
# @see the `==` method
|
88
|
+
# @param [Object] Object to be compared
|
89
|
+
def eql?(o)
|
90
|
+
self == o
|
91
|
+
end
|
92
|
+
|
93
|
+
# Calculates hash code according to all attributes.
|
94
|
+
# @return [Integer] Hash code
|
95
|
+
def hash
|
96
|
+
[capture].hash
|
97
|
+
end
|
98
|
+
|
99
|
+
# Builds the object from hash
|
100
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
101
|
+
# @return [Object] Returns the model itself
|
102
|
+
def self.build_from_hash(attributes)
|
103
|
+
new.build_from_hash(attributes)
|
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 build_from_hash(attributes)
|
110
|
+
return nil unless attributes.is_a?(Hash)
|
111
|
+
self.class.openapi_types.each_pair do |key, type|
|
112
|
+
if type =~ /\AArray<(.*)>/i
|
113
|
+
# check to ensure the input is an array given that the attribute
|
114
|
+
# is documented as an array but the input is not
|
115
|
+
if attributes[self.class.attribute_map[key]].is_a?(Array)
|
116
|
+
self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
|
117
|
+
end
|
118
|
+
elsif !attributes[self.class.attribute_map[key]].nil?
|
119
|
+
self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
|
120
|
+
end # or else data not found in attributes(hash), not an issue as the data can be optional
|
121
|
+
end
|
122
|
+
|
123
|
+
self
|
124
|
+
end
|
125
|
+
|
126
|
+
# Deserializes the data based on type
|
127
|
+
# @param string type Data type
|
128
|
+
# @param string value Value to be deserialized
|
129
|
+
# @return [Object] Deserialized data
|
130
|
+
def _deserialize(type, value)
|
131
|
+
case type.to_sym
|
132
|
+
when :DateTime
|
133
|
+
DateTime.parse(value)
|
134
|
+
when :Date
|
135
|
+
Date.parse(value)
|
136
|
+
when :String
|
137
|
+
value.to_s
|
138
|
+
when :Integer
|
139
|
+
value.to_i
|
140
|
+
when :Float
|
141
|
+
value.to_f
|
142
|
+
when :Boolean
|
143
|
+
if value.to_s =~ /\A(true|t|yes|y|1)\z/i
|
144
|
+
true
|
145
|
+
else
|
146
|
+
false
|
147
|
+
end
|
148
|
+
when :Object
|
149
|
+
# generic object (usually a Hash), return directly
|
150
|
+
value
|
151
|
+
when /\AArray<(?<inner_type>.+)>\z/
|
152
|
+
inner_type = Regexp.last_match[:inner_type]
|
153
|
+
value.map { |v| _deserialize(inner_type, v) }
|
154
|
+
when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
|
155
|
+
k_type = Regexp.last_match[:k_type]
|
156
|
+
v_type = Regexp.last_match[:v_type]
|
157
|
+
{}.tap do |hash|
|
158
|
+
value.each do |k, v|
|
159
|
+
hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
|
160
|
+
end
|
161
|
+
end
|
162
|
+
else # model
|
163
|
+
Shotstack.const_get(type).build_from_hash(value)
|
164
|
+
end
|
165
|
+
end
|
166
|
+
|
167
|
+
# Returns the string representation of the object
|
168
|
+
# @return [String] String presentation of the object
|
169
|
+
def to_s
|
170
|
+
to_hash.to_s
|
171
|
+
end
|
172
|
+
|
173
|
+
# to_body is an alias to to_hash (backward compatibility)
|
174
|
+
# @return [Hash] Returns the object in the form of hash
|
175
|
+
def to_body
|
176
|
+
to_hash
|
177
|
+
end
|
178
|
+
|
179
|
+
# Returns the object in the form of hash
|
180
|
+
# @return [Hash] Returns the object in the form of hash
|
181
|
+
def to_hash
|
182
|
+
hash = {}
|
183
|
+
self.class.attribute_map.each_pair do |attr, param|
|
184
|
+
value = self.send(attr)
|
185
|
+
if value.nil?
|
186
|
+
is_nullable = self.class.openapi_nullable.include?(attr)
|
187
|
+
next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
|
188
|
+
end
|
189
|
+
|
190
|
+
hash[param] = _to_hash(value)
|
191
|
+
end
|
192
|
+
hash
|
193
|
+
end
|
194
|
+
|
195
|
+
# Outputs non-array value in the form of hash
|
196
|
+
# For object, use to_hash. Otherwise, just return the value
|
197
|
+
# @param [Object] value Any valid value
|
198
|
+
# @return [Hash] Returns the value in the form of hash
|
199
|
+
def _to_hash(value)
|
200
|
+
if value.is_a?(Array)
|
201
|
+
value.compact.map { |v| _to_hash(v) }
|
202
|
+
elsif value.is_a?(Hash)
|
203
|
+
{}.tap do |hash|
|
204
|
+
value.each { |k, v| hash[k] = _to_hash(v) }
|
205
|
+
end
|
206
|
+
elsif value.respond_to? :to_hash
|
207
|
+
value.to_hash
|
208
|
+
else
|
209
|
+
value
|
210
|
+
end
|
211
|
+
end
|
212
|
+
end
|
213
|
+
end
|