shotstack 0.1.1 → 0.1.6
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +17 -12
- data/lib/shotstack.rb +4 -2
- data/lib/shotstack/api/endpoints_api.rb +21 -12
- data/lib/shotstack/api_client.rb +50 -46
- data/lib/shotstack/api_error.rb +2 -2
- data/lib/shotstack/configuration.rb +36 -9
- data/lib/shotstack/models/audio_asset.rb +71 -13
- data/lib/shotstack/models/clip.rb +25 -11
- data/lib/shotstack/models/crop.rb +346 -0
- data/lib/shotstack/models/edit.rb +71 -13
- data/lib/shotstack/models/font.rb +21 -9
- data/lib/shotstack/models/html_asset.rb +28 -16
- data/lib/shotstack/models/image_asset.rb +35 -14
- data/lib/shotstack/models/luma_asset.rb +21 -9
- data/lib/shotstack/models/offset.rb +24 -8
- data/lib/shotstack/models/output.rb +61 -16
- data/lib/shotstack/models/poster.rb +20 -8
- data/lib/shotstack/models/queued_response.rb +22 -8
- data/lib/shotstack/models/queued_response_data.rb +22 -10
- data/lib/shotstack/models/range.rb +260 -0
- data/lib/shotstack/models/render_response.rb +22 -8
- data/lib/shotstack/models/render_response_data.rb +101 -29
- data/lib/shotstack/models/soundtrack.rb +23 -9
- data/lib/shotstack/models/thumbnail.rb +20 -8
- data/lib/shotstack/models/timeline.rb +36 -12
- data/lib/shotstack/models/title_asset.rb +25 -13
- data/lib/shotstack/models/track.rb +20 -8
- data/lib/shotstack/models/transition.rb +26 -14
- data/lib/shotstack/models/video_asset.rb +34 -13
- data/lib/shotstack/version.rb +3 -3
- data/shotstack.gemspec +8 -9
- metadata +11 -30
- data/shotstack-0.0.11.gem +0 -0
- data/shotstack-0.1.0.gem +0 -0
@@ -1,22 +1,23 @@
|
|
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
|
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:
|
9
|
+
OpenAPI Generator version: 5.0.0
|
10
10
|
|
11
11
|
=end
|
12
12
|
|
13
13
|
require 'date'
|
14
|
+
require 'time'
|
14
15
|
require_relative 'asset'
|
15
16
|
|
16
17
|
module Shotstack
|
17
18
|
# The AudioAsset is used to add sound effects and audio at specific intervals on the timeline. The src must be a publicly accessible URL to an audio resource such as an mp3 file.
|
18
19
|
class AudioAsset < Asset
|
19
|
-
# The type of asset - set to
|
20
|
+
# The type of asset - set to `audio` for audio assets.
|
20
21
|
attr_accessor :type
|
21
22
|
|
22
23
|
# The audio source URL. The URL must be publicly accessible or include credentials.
|
@@ -28,23 +29,55 @@ module Shotstack
|
|
28
29
|
# Set the volume for the audio clip between 0 and 1 where 0 is muted and 1 is full volume (defaults to 1).
|
29
30
|
attr_accessor :volume
|
30
31
|
|
32
|
+
# The effect to apply to the audio asset <ul> <li>`fadeIn` - fade volume in only</li> <li>`fadeOut` - fade volume out only</li> <li>`fadeInFadeOut` - fade volume in and out</li> </ul>
|
33
|
+
attr_accessor :effect
|
34
|
+
|
35
|
+
class EnumAttributeValidator
|
36
|
+
attr_reader :datatype
|
37
|
+
attr_reader :allowable_values
|
38
|
+
|
39
|
+
def initialize(datatype, allowable_values)
|
40
|
+
@allowable_values = allowable_values.map do |value|
|
41
|
+
case datatype.to_s
|
42
|
+
when /Integer/i
|
43
|
+
value.to_i
|
44
|
+
when /Float/i
|
45
|
+
value.to_f
|
46
|
+
else
|
47
|
+
value
|
48
|
+
end
|
49
|
+
end
|
50
|
+
end
|
51
|
+
|
52
|
+
def valid?(value)
|
53
|
+
!value || allowable_values.include?(value)
|
54
|
+
end
|
55
|
+
end
|
56
|
+
|
31
57
|
# Attribute mapping from ruby-style variable name to JSON key.
|
32
58
|
def self.attribute_map
|
33
59
|
{
|
34
60
|
:'type' => :'type',
|
35
61
|
:'src' => :'src',
|
36
62
|
:'trim' => :'trim',
|
37
|
-
:'volume' => :'volume'
|
63
|
+
:'volume' => :'volume',
|
64
|
+
:'effect' => :'effect'
|
38
65
|
}
|
39
66
|
end
|
40
67
|
|
68
|
+
# Returns all the JSON keys this model knows about
|
69
|
+
def self.acceptable_attributes
|
70
|
+
attribute_map.values
|
71
|
+
end
|
72
|
+
|
41
73
|
# Attribute type mapping.
|
42
74
|
def self.openapi_types
|
43
75
|
{
|
44
76
|
:'type' => :'String',
|
45
77
|
:'src' => :'String',
|
46
78
|
:'trim' => :'Float',
|
47
|
-
:'volume' => :'Float'
|
79
|
+
:'volume' => :'Float',
|
80
|
+
:'effect' => :'String'
|
48
81
|
}
|
49
82
|
end
|
50
83
|
|
@@ -85,6 +118,12 @@ module Shotstack
|
|
85
118
|
|
86
119
|
if attributes.key?(:'volume')
|
87
120
|
self.volume = attributes[:'volume']
|
121
|
+
else
|
122
|
+
self.volume = 1
|
123
|
+
end
|
124
|
+
|
125
|
+
if attributes.key?(:'effect')
|
126
|
+
self.effect = attributes[:'effect']
|
88
127
|
end
|
89
128
|
end
|
90
129
|
|
@@ -108,9 +147,21 @@ module Shotstack
|
|
108
147
|
def valid?
|
109
148
|
return false if @type.nil?
|
110
149
|
return false if @src.nil?
|
150
|
+
effect_validator = EnumAttributeValidator.new('String', ["fadeIn", "fadeOut", "fadeInFadeOut"])
|
151
|
+
return false unless effect_validator.valid?(@effect)
|
111
152
|
true
|
112
153
|
end
|
113
154
|
|
155
|
+
# Custom attribute writer method checking allowed values (enum).
|
156
|
+
# @param [Object] effect Object to be assigned
|
157
|
+
def effect=(effect)
|
158
|
+
validator = EnumAttributeValidator.new('String', ["fadeIn", "fadeOut", "fadeInFadeOut"])
|
159
|
+
unless validator.valid?(effect)
|
160
|
+
fail ArgumentError, "invalid value for \"effect\", must be one of #{validator.allowable_values}."
|
161
|
+
end
|
162
|
+
@effect = effect
|
163
|
+
end
|
164
|
+
|
114
165
|
# Checks equality by comparing each attribute.
|
115
166
|
# @param [Object] Object to be compared
|
116
167
|
def ==(o)
|
@@ -119,7 +170,8 @@ module Shotstack
|
|
119
170
|
type == o.type &&
|
120
171
|
src == o.src &&
|
121
172
|
trim == o.trim &&
|
122
|
-
volume == o.volume
|
173
|
+
volume == o.volume &&
|
174
|
+
effect == o.effect
|
123
175
|
end
|
124
176
|
|
125
177
|
# @see the `==` method
|
@@ -131,7 +183,7 @@ module Shotstack
|
|
131
183
|
# Calculates hash code according to all attributes.
|
132
184
|
# @return [Integer] Hash code
|
133
185
|
def hash
|
134
|
-
[type, src, trim, volume].hash
|
186
|
+
[type, src, trim, volume, effect].hash
|
135
187
|
end
|
136
188
|
|
137
189
|
# Builds the object from hash
|
@@ -147,7 +199,9 @@ module Shotstack
|
|
147
199
|
def build_from_hash(attributes)
|
148
200
|
return nil unless attributes.is_a?(Hash)
|
149
201
|
self.class.openapi_types.each_pair do |key, type|
|
150
|
-
if
|
202
|
+
if attributes[self.class.attribute_map[key]].nil? && self.class.openapi_nullable.include?(key)
|
203
|
+
self.send("#{key}=", nil)
|
204
|
+
elsif type =~ /\AArray<(.*)>/i
|
151
205
|
# check to ensure the input is an array given that the attribute
|
152
206
|
# is documented as an array but the input is not
|
153
207
|
if attributes[self.class.attribute_map[key]].is_a?(Array)
|
@@ -155,7 +209,7 @@ module Shotstack
|
|
155
209
|
end
|
156
210
|
elsif !attributes[self.class.attribute_map[key]].nil?
|
157
211
|
self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
|
158
|
-
end
|
212
|
+
end
|
159
213
|
end
|
160
214
|
|
161
215
|
self
|
@@ -167,8 +221,8 @@ module Shotstack
|
|
167
221
|
# @return [Object] Deserialized data
|
168
222
|
def _deserialize(type, value)
|
169
223
|
case type.to_sym
|
170
|
-
when :
|
171
|
-
|
224
|
+
when :Time
|
225
|
+
Time.parse(value)
|
172
226
|
when :Date
|
173
227
|
Date.parse(value)
|
174
228
|
when :String
|
@@ -198,7 +252,9 @@ module Shotstack
|
|
198
252
|
end
|
199
253
|
end
|
200
254
|
else # model
|
201
|
-
|
255
|
+
# models (e.g. Pet) or oneOf
|
256
|
+
klass = Shotstack.const_get(type)
|
257
|
+
klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
|
202
258
|
end
|
203
259
|
end
|
204
260
|
|
@@ -224,7 +280,7 @@ module Shotstack
|
|
224
280
|
is_nullable = self.class.openapi_nullable.include?(attr)
|
225
281
|
next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
|
226
282
|
end
|
227
|
-
|
283
|
+
|
228
284
|
hash[param] = _to_hash(value)
|
229
285
|
end
|
230
286
|
hash
|
@@ -247,5 +303,7 @@ module Shotstack
|
|
247
303
|
value
|
248
304
|
end
|
249
305
|
end
|
306
|
+
|
250
307
|
end
|
308
|
+
|
251
309
|
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
|
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:
|
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 clip is a container for a specific type of asset, i.e. a title, image, video, audio or html. You use a Clip to define when an asset will display on the timeline, how long it will play for and transitions, filters and effects to apply to it.
|
@@ -30,17 +31,17 @@ module Shotstack
|
|
30
31
|
# Scale the asset to a fraction of the viewport size - i.e. setting the scale to 0.5 will scale asset to half the size of the viewport. This is useful for picture-in-picture video and scaling images such as logos and watermarks.
|
31
32
|
attr_accessor :scale
|
32
33
|
|
33
|
-
# Place the asset in one of nine predefined positions of the viewport. This is most effective for when the asset is scaled and you want to position the element to a specific position.
|
34
|
+
# Place the asset in one of nine predefined positions of the viewport. This is most effective for when the asset is scaled and you want to position the element to a specific position. <ul> <li>`top` - top (center)</li> <li>`topRight` - top right</li> <li>`right` - right (center)</li> <li>`bottomRight` - bottom right</li> <li>`bottom` - bottom (center)</li> <li>`bottomLeft` - bottom left</li> <li>`left` - left (center)</li> <li>`topLeft` - top left</li> <li>`center` - center</li> </ul>
|
34
35
|
attr_accessor :position
|
35
36
|
|
36
37
|
attr_accessor :offset
|
37
38
|
|
38
39
|
attr_accessor :transition
|
39
40
|
|
40
|
-
# A motion effect to apply to the Clip.
|
41
|
+
# A motion effect to apply to the Clip. <ul> <li>`zoomIn` - slow zoom in</li> <li>`zoomOut` - slow zoom out</li> <li>`slideLeft` - slow slide (pan) left</li> <li>`slideRight` - slow slide (pan) right</li> <li>`slideUp` - slow slide (pan) up</li> <li>`slideDown` - slow slide (pan) down</li> </ul>
|
41
42
|
attr_accessor :effect
|
42
43
|
|
43
|
-
# A filter effect to apply to the Clip.
|
44
|
+
# A filter effect to apply to the Clip. <ul> <li>`boost` - boost contrast and saturation</li> <li>`contrast` - increase contrast</li> <li>`darken` - darken the scene</li> <li>`greyscale` - remove colour</li> <li>`lighten` - lighten the scene</li> <li>`muted` - reduce saturation and contrast</li> <li>`invert` - invert colors</li> </ul>
|
44
45
|
attr_accessor :filter
|
45
46
|
|
46
47
|
# Sets the opacity of the Clip where 1 is opaque and 0 is transparent.
|
@@ -85,6 +86,11 @@ module Shotstack
|
|
85
86
|
}
|
86
87
|
end
|
87
88
|
|
89
|
+
# Returns all the JSON keys this model knows about
|
90
|
+
def self.acceptable_attributes
|
91
|
+
attribute_map.values
|
92
|
+
end
|
93
|
+
|
88
94
|
# Attribute type mapping.
|
89
95
|
def self.openapi_types
|
90
96
|
{
|
@@ -169,6 +175,8 @@ module Shotstack
|
|
169
175
|
|
170
176
|
if attributes.key?(:'opacity')
|
171
177
|
self.opacity = attributes[:'opacity']
|
178
|
+
else
|
179
|
+
self.opacity = 1
|
172
180
|
end
|
173
181
|
end
|
174
182
|
|
@@ -291,7 +299,9 @@ module Shotstack
|
|
291
299
|
def build_from_hash(attributes)
|
292
300
|
return nil unless attributes.is_a?(Hash)
|
293
301
|
self.class.openapi_types.each_pair do |key, type|
|
294
|
-
if
|
302
|
+
if attributes[self.class.attribute_map[key]].nil? && self.class.openapi_nullable.include?(key)
|
303
|
+
self.send("#{key}=", nil)
|
304
|
+
elsif type =~ /\AArray<(.*)>/i
|
295
305
|
# check to ensure the input is an array given that the attribute
|
296
306
|
# is documented as an array but the input is not
|
297
307
|
if attributes[self.class.attribute_map[key]].is_a?(Array)
|
@@ -299,7 +309,7 @@ module Shotstack
|
|
299
309
|
end
|
300
310
|
elsif !attributes[self.class.attribute_map[key]].nil?
|
301
311
|
self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
|
302
|
-
end
|
312
|
+
end
|
303
313
|
end
|
304
314
|
|
305
315
|
self
|
@@ -311,8 +321,8 @@ module Shotstack
|
|
311
321
|
# @return [Object] Deserialized data
|
312
322
|
def _deserialize(type, value)
|
313
323
|
case type.to_sym
|
314
|
-
when :
|
315
|
-
|
324
|
+
when :Time
|
325
|
+
Time.parse(value)
|
316
326
|
when :Date
|
317
327
|
Date.parse(value)
|
318
328
|
when :String
|
@@ -342,7 +352,9 @@ module Shotstack
|
|
342
352
|
end
|
343
353
|
end
|
344
354
|
else # model
|
345
|
-
|
355
|
+
# models (e.g. Pet) or oneOf
|
356
|
+
klass = Shotstack.const_get(type)
|
357
|
+
klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
|
346
358
|
end
|
347
359
|
end
|
348
360
|
|
@@ -368,7 +380,7 @@ module Shotstack
|
|
368
380
|
is_nullable = self.class.openapi_nullable.include?(attr)
|
369
381
|
next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
|
370
382
|
end
|
371
|
-
|
383
|
+
|
372
384
|
hash[param] = _to_hash(value)
|
373
385
|
end
|
374
386
|
hash
|
@@ -391,5 +403,7 @@ module Shotstack
|
|
391
403
|
value
|
392
404
|
end
|
393
405
|
end
|
406
|
+
|
394
407
|
end
|
408
|
+
|
395
409
|
end
|
@@ -0,0 +1,346 @@
|
|
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
|
+
# Crop the sides of an asset by a relative amount. The size of the crop is specified using a scale between 0 and 1, relative to the screen width - i.e a left crop of 0.5 will crop half of the asset from the left, a top crop of 0.25 will crop the top by quarter of the asset.
|
18
|
+
class Crop
|
19
|
+
# Crop from the top of the asset
|
20
|
+
attr_accessor :top
|
21
|
+
|
22
|
+
# Crop from the bottom of the asset
|
23
|
+
attr_accessor :bottom
|
24
|
+
|
25
|
+
# Crop from the left of the asset
|
26
|
+
attr_accessor :left
|
27
|
+
|
28
|
+
# Crop from the left of the asset
|
29
|
+
attr_accessor :right
|
30
|
+
|
31
|
+
# Attribute mapping from ruby-style variable name to JSON key.
|
32
|
+
def self.attribute_map
|
33
|
+
{
|
34
|
+
:'top' => :'top',
|
35
|
+
:'bottom' => :'bottom',
|
36
|
+
:'left' => :'left',
|
37
|
+
:'right' => :'right'
|
38
|
+
}
|
39
|
+
end
|
40
|
+
|
41
|
+
# Returns all the JSON keys this model knows about
|
42
|
+
def self.acceptable_attributes
|
43
|
+
attribute_map.values
|
44
|
+
end
|
45
|
+
|
46
|
+
# Attribute type mapping.
|
47
|
+
def self.openapi_types
|
48
|
+
{
|
49
|
+
:'top' => :'Float',
|
50
|
+
:'bottom' => :'Float',
|
51
|
+
:'left' => :'Float',
|
52
|
+
:'right' => :'Float'
|
53
|
+
}
|
54
|
+
end
|
55
|
+
|
56
|
+
# List of attributes with nullable: true
|
57
|
+
def self.openapi_nullable
|
58
|
+
Set.new([
|
59
|
+
])
|
60
|
+
end
|
61
|
+
|
62
|
+
# Initializes the object
|
63
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
64
|
+
def initialize(attributes = {})
|
65
|
+
if (!attributes.is_a?(Hash))
|
66
|
+
fail ArgumentError, "The input argument (attributes) must be a hash in `Shotstack::Crop` initialize method"
|
67
|
+
end
|
68
|
+
|
69
|
+
# check to see if the attribute exists and convert string to symbol for hash key
|
70
|
+
attributes = attributes.each_with_object({}) { |(k, v), h|
|
71
|
+
if (!self.class.attribute_map.key?(k.to_sym))
|
72
|
+
fail ArgumentError, "`#{k}` is not a valid attribute in `Shotstack::Crop`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
|
73
|
+
end
|
74
|
+
h[k.to_sym] = v
|
75
|
+
}
|
76
|
+
|
77
|
+
if attributes.key?(:'top')
|
78
|
+
self.top = attributes[:'top']
|
79
|
+
end
|
80
|
+
|
81
|
+
if attributes.key?(:'bottom')
|
82
|
+
self.bottom = attributes[:'bottom']
|
83
|
+
end
|
84
|
+
|
85
|
+
if attributes.key?(:'left')
|
86
|
+
self.left = attributes[:'left']
|
87
|
+
end
|
88
|
+
|
89
|
+
if attributes.key?(:'right')
|
90
|
+
self.right = attributes[:'right']
|
91
|
+
end
|
92
|
+
end
|
93
|
+
|
94
|
+
# Show invalid properties with the reasons. Usually used together with valid?
|
95
|
+
# @return Array for valid properties with the reasons
|
96
|
+
def list_invalid_properties
|
97
|
+
invalid_properties = Array.new
|
98
|
+
if !@top.nil? && @top > 1
|
99
|
+
invalid_properties.push('invalid value for "top", must be smaller than or equal to 1.')
|
100
|
+
end
|
101
|
+
|
102
|
+
if !@top.nil? && @top < 0
|
103
|
+
invalid_properties.push('invalid value for "top", must be greater than or equal to 0.')
|
104
|
+
end
|
105
|
+
|
106
|
+
if !@bottom.nil? && @bottom > 1
|
107
|
+
invalid_properties.push('invalid value for "bottom", must be smaller than or equal to 1.')
|
108
|
+
end
|
109
|
+
|
110
|
+
if !@bottom.nil? && @bottom < 0
|
111
|
+
invalid_properties.push('invalid value for "bottom", must be greater than or equal to 0.')
|
112
|
+
end
|
113
|
+
|
114
|
+
if !@left.nil? && @left > 1
|
115
|
+
invalid_properties.push('invalid value for "left", must be smaller than or equal to 1.')
|
116
|
+
end
|
117
|
+
|
118
|
+
if !@left.nil? && @left < 0
|
119
|
+
invalid_properties.push('invalid value for "left", must be greater than or equal to 0.')
|
120
|
+
end
|
121
|
+
|
122
|
+
if !@right.nil? && @right > 1
|
123
|
+
invalid_properties.push('invalid value for "right", must be smaller than or equal to 1.')
|
124
|
+
end
|
125
|
+
|
126
|
+
if !@right.nil? && @right < 0
|
127
|
+
invalid_properties.push('invalid value for "right", must be greater than or equal to 0.')
|
128
|
+
end
|
129
|
+
|
130
|
+
invalid_properties
|
131
|
+
end
|
132
|
+
|
133
|
+
# Check to see if the all the properties in the model are valid
|
134
|
+
# @return true if the model is valid
|
135
|
+
def valid?
|
136
|
+
return false if !@top.nil? && @top > 1
|
137
|
+
return false if !@top.nil? && @top < 0
|
138
|
+
return false if !@bottom.nil? && @bottom > 1
|
139
|
+
return false if !@bottom.nil? && @bottom < 0
|
140
|
+
return false if !@left.nil? && @left > 1
|
141
|
+
return false if !@left.nil? && @left < 0
|
142
|
+
return false if !@right.nil? && @right > 1
|
143
|
+
return false if !@right.nil? && @right < 0
|
144
|
+
true
|
145
|
+
end
|
146
|
+
|
147
|
+
# Custom attribute writer method with validation
|
148
|
+
# @param [Object] top Value to be assigned
|
149
|
+
def top=(top)
|
150
|
+
if !top.nil? && top > 1
|
151
|
+
fail ArgumentError, 'invalid value for "top", must be smaller than or equal to 1.'
|
152
|
+
end
|
153
|
+
|
154
|
+
if !top.nil? && top < 0
|
155
|
+
fail ArgumentError, 'invalid value for "top", must be greater than or equal to 0.'
|
156
|
+
end
|
157
|
+
|
158
|
+
@top = top
|
159
|
+
end
|
160
|
+
|
161
|
+
# Custom attribute writer method with validation
|
162
|
+
# @param [Object] bottom Value to be assigned
|
163
|
+
def bottom=(bottom)
|
164
|
+
if !bottom.nil? && bottom > 1
|
165
|
+
fail ArgumentError, 'invalid value for "bottom", must be smaller than or equal to 1.'
|
166
|
+
end
|
167
|
+
|
168
|
+
if !bottom.nil? && bottom < 0
|
169
|
+
fail ArgumentError, 'invalid value for "bottom", must be greater than or equal to 0.'
|
170
|
+
end
|
171
|
+
|
172
|
+
@bottom = bottom
|
173
|
+
end
|
174
|
+
|
175
|
+
# Custom attribute writer method with validation
|
176
|
+
# @param [Object] left Value to be assigned
|
177
|
+
def left=(left)
|
178
|
+
if !left.nil? && left > 1
|
179
|
+
fail ArgumentError, 'invalid value for "left", must be smaller than or equal to 1.'
|
180
|
+
end
|
181
|
+
|
182
|
+
if !left.nil? && left < 0
|
183
|
+
fail ArgumentError, 'invalid value for "left", must be greater than or equal to 0.'
|
184
|
+
end
|
185
|
+
|
186
|
+
@left = left
|
187
|
+
end
|
188
|
+
|
189
|
+
# Custom attribute writer method with validation
|
190
|
+
# @param [Object] right Value to be assigned
|
191
|
+
def right=(right)
|
192
|
+
if !right.nil? && right > 1
|
193
|
+
fail ArgumentError, 'invalid value for "right", must be smaller than or equal to 1.'
|
194
|
+
end
|
195
|
+
|
196
|
+
if !right.nil? && right < 0
|
197
|
+
fail ArgumentError, 'invalid value for "right", must be greater than or equal to 0.'
|
198
|
+
end
|
199
|
+
|
200
|
+
@right = right
|
201
|
+
end
|
202
|
+
|
203
|
+
# Checks equality by comparing each attribute.
|
204
|
+
# @param [Object] Object to be compared
|
205
|
+
def ==(o)
|
206
|
+
return true if self.equal?(o)
|
207
|
+
self.class == o.class &&
|
208
|
+
top == o.top &&
|
209
|
+
bottom == o.bottom &&
|
210
|
+
left == o.left &&
|
211
|
+
right == o.right
|
212
|
+
end
|
213
|
+
|
214
|
+
# @see the `==` method
|
215
|
+
# @param [Object] Object to be compared
|
216
|
+
def eql?(o)
|
217
|
+
self == o
|
218
|
+
end
|
219
|
+
|
220
|
+
# Calculates hash code according to all attributes.
|
221
|
+
# @return [Integer] Hash code
|
222
|
+
def hash
|
223
|
+
[top, bottom, left, right].hash
|
224
|
+
end
|
225
|
+
|
226
|
+
# Builds the object from hash
|
227
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
228
|
+
# @return [Object] Returns the model itself
|
229
|
+
def self.build_from_hash(attributes)
|
230
|
+
new.build_from_hash(attributes)
|
231
|
+
end
|
232
|
+
|
233
|
+
# Builds the object from hash
|
234
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
235
|
+
# @return [Object] Returns the model itself
|
236
|
+
def build_from_hash(attributes)
|
237
|
+
return nil unless attributes.is_a?(Hash)
|
238
|
+
self.class.openapi_types.each_pair do |key, type|
|
239
|
+
if attributes[self.class.attribute_map[key]].nil? && self.class.openapi_nullable.include?(key)
|
240
|
+
self.send("#{key}=", nil)
|
241
|
+
elsif type =~ /\AArray<(.*)>/i
|
242
|
+
# check to ensure the input is an array given that the attribute
|
243
|
+
# is documented as an array but the input is not
|
244
|
+
if attributes[self.class.attribute_map[key]].is_a?(Array)
|
245
|
+
self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
|
246
|
+
end
|
247
|
+
elsif !attributes[self.class.attribute_map[key]].nil?
|
248
|
+
self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
|
249
|
+
end
|
250
|
+
end
|
251
|
+
|
252
|
+
self
|
253
|
+
end
|
254
|
+
|
255
|
+
# Deserializes the data based on type
|
256
|
+
# @param string type Data type
|
257
|
+
# @param string value Value to be deserialized
|
258
|
+
# @return [Object] Deserialized data
|
259
|
+
def _deserialize(type, value)
|
260
|
+
case type.to_sym
|
261
|
+
when :Time
|
262
|
+
Time.parse(value)
|
263
|
+
when :Date
|
264
|
+
Date.parse(value)
|
265
|
+
when :String
|
266
|
+
value.to_s
|
267
|
+
when :Integer
|
268
|
+
value.to_i
|
269
|
+
when :Float
|
270
|
+
value.to_f
|
271
|
+
when :Boolean
|
272
|
+
if value.to_s =~ /\A(true|t|yes|y|1)\z/i
|
273
|
+
true
|
274
|
+
else
|
275
|
+
false
|
276
|
+
end
|
277
|
+
when :Object
|
278
|
+
# generic object (usually a Hash), return directly
|
279
|
+
value
|
280
|
+
when /\AArray<(?<inner_type>.+)>\z/
|
281
|
+
inner_type = Regexp.last_match[:inner_type]
|
282
|
+
value.map { |v| _deserialize(inner_type, v) }
|
283
|
+
when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
|
284
|
+
k_type = Regexp.last_match[:k_type]
|
285
|
+
v_type = Regexp.last_match[:v_type]
|
286
|
+
{}.tap do |hash|
|
287
|
+
value.each do |k, v|
|
288
|
+
hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
|
289
|
+
end
|
290
|
+
end
|
291
|
+
else # model
|
292
|
+
# models (e.g. Pet) or oneOf
|
293
|
+
klass = Shotstack.const_get(type)
|
294
|
+
klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
|
295
|
+
end
|
296
|
+
end
|
297
|
+
|
298
|
+
# Returns the string representation of the object
|
299
|
+
# @return [String] String presentation of the object
|
300
|
+
def to_s
|
301
|
+
to_hash.to_s
|
302
|
+
end
|
303
|
+
|
304
|
+
# to_body is an alias to to_hash (backward compatibility)
|
305
|
+
# @return [Hash] Returns the object in the form of hash
|
306
|
+
def to_body
|
307
|
+
to_hash
|
308
|
+
end
|
309
|
+
|
310
|
+
# Returns the object in the form of hash
|
311
|
+
# @return [Hash] Returns the object in the form of hash
|
312
|
+
def to_hash
|
313
|
+
hash = {}
|
314
|
+
self.class.attribute_map.each_pair do |attr, param|
|
315
|
+
value = self.send(attr)
|
316
|
+
if value.nil?
|
317
|
+
is_nullable = self.class.openapi_nullable.include?(attr)
|
318
|
+
next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
|
319
|
+
end
|
320
|
+
|
321
|
+
hash[param] = _to_hash(value)
|
322
|
+
end
|
323
|
+
hash
|
324
|
+
end
|
325
|
+
|
326
|
+
# Outputs non-array value in the form of hash
|
327
|
+
# For object, use to_hash. Otherwise, just return the value
|
328
|
+
# @param [Object] value Any valid value
|
329
|
+
# @return [Hash] Returns the value in the form of hash
|
330
|
+
def _to_hash(value)
|
331
|
+
if value.is_a?(Array)
|
332
|
+
value.compact.map { |v| _to_hash(v) }
|
333
|
+
elsif value.is_a?(Hash)
|
334
|
+
{}.tap do |hash|
|
335
|
+
value.each { |k, v| hash[k] = _to_hash(v) }
|
336
|
+
end
|
337
|
+
elsif value.respond_to? :to_hash
|
338
|
+
value.to_hash
|
339
|
+
else
|
340
|
+
value
|
341
|
+
end
|
342
|
+
end
|
343
|
+
|
344
|
+
end
|
345
|
+
|
346
|
+
end
|