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