shotstack 0.1.4 → 0.1.5
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 +3 -1
- data/lib/shotstack/api/endpoints_api.rb +9 -7
- data/lib/shotstack/api_client.rb +49 -45
- data/lib/shotstack/api_error.rb +1 -1
- data/lib/shotstack/configuration.rb +35 -8
- data/lib/shotstack/models/audio_asset.rb +67 -11
- data/lib/shotstack/models/clip.rb +20 -8
- data/lib/shotstack/models/crop.rb +346 -0
- data/lib/shotstack/models/edit.rb +19 -7
- data/lib/shotstack/models/font.rb +19 -7
- data/lib/shotstack/models/html_asset.rb +23 -11
- data/lib/shotstack/models/image_asset.rb +33 -12
- data/lib/shotstack/models/luma_asset.rb +20 -8
- data/lib/shotstack/models/offset.rb +19 -7
- data/lib/shotstack/models/output.rb +60 -15
- data/lib/shotstack/models/poster.rb +19 -7
- data/lib/shotstack/models/queued_response.rb +19 -7
- data/lib/shotstack/models/queued_response_data.rb +19 -7
- data/lib/shotstack/models/range.rb +260 -0
- data/lib/shotstack/models/render_response.rb +19 -7
- data/lib/shotstack/models/render_response_data.rb +19 -7
- data/lib/shotstack/models/soundtrack.rb +19 -7
- data/lib/shotstack/models/thumbnail.rb +19 -7
- data/lib/shotstack/models/timeline.rb +19 -7
- data/lib/shotstack/models/title_asset.rb +19 -7
- data/lib/shotstack/models/track.rb +19 -7
- data/lib/shotstack/models/transition.rb +19 -7
- data/lib/shotstack/models/video_asset.rb +32 -11
- data/lib/shotstack/version.rb +2 -2
- data/shotstack.gemspec +2 -3
- metadata +5 -23
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: fbe23e5f4a04895111959fadb1ae057a20d64b47b3015f4ac8cad2481b83f077
|
4
|
+
data.tar.gz: da6e99e80bea597ef2e65a5bf09bafcecd4923015fcc3ba1dbffda46306006c0
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 69581b3a2c839530874857f0964f62cb01adb0a28c8dd04bfd65f142d172eb6465ddddf43d1fc80d55108301c7ab60a7b3939ee9903868842c5241e6314bf904
|
7
|
+
data.tar.gz: 1106311ee9c828f029679471cc02899342c3054927176e0c6e9b2b2cb7b433afa21f1dd997ef787df1cfbd9e9dddf3868f1497fcae89313bb6a25120c4829e00
|
data/lib/shotstack.rb
CHANGED
@@ -6,7 +6,7 @@
|
|
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
|
|
@@ -19,6 +19,7 @@ require 'shotstack/configuration'
|
|
19
19
|
# Models
|
20
20
|
require 'shotstack/models/audio_asset'
|
21
21
|
require 'shotstack/models/clip'
|
22
|
+
require 'shotstack/models/crop'
|
22
23
|
require 'shotstack/models/edit'
|
23
24
|
require 'shotstack/models/font'
|
24
25
|
require 'shotstack/models/html_asset'
|
@@ -29,6 +30,7 @@ require 'shotstack/models/output'
|
|
29
30
|
require 'shotstack/models/poster'
|
30
31
|
require 'shotstack/models/queued_response'
|
31
32
|
require 'shotstack/models/queued_response_data'
|
33
|
+
require 'shotstack/models/range'
|
32
34
|
require 'shotstack/models/render_response'
|
33
35
|
require 'shotstack/models/render_response_data'
|
34
36
|
require 'shotstack/models/soundtrack'
|
@@ -6,7 +6,7 @@
|
|
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
|
|
@@ -62,15 +62,16 @@ module Shotstack
|
|
62
62
|
form_params = opts[:form_params] || {}
|
63
63
|
|
64
64
|
# http body (model)
|
65
|
-
post_body = opts[:
|
65
|
+
post_body = opts[:debug_body]
|
66
66
|
|
67
67
|
# return_type
|
68
|
-
return_type = opts[:
|
68
|
+
return_type = opts[:debug_return_type] || 'RenderResponse'
|
69
69
|
|
70
70
|
# auth_names
|
71
|
-
auth_names = opts[:
|
71
|
+
auth_names = opts[:debug_auth_names] || ['DeveloperKey']
|
72
72
|
|
73
73
|
new_options = opts.merge(
|
74
|
+
:operation => :"EndpointsApi.get_render",
|
74
75
|
:header_params => header_params,
|
75
76
|
:query_params => query_params,
|
76
77
|
:form_params => form_params,
|
@@ -129,15 +130,16 @@ module Shotstack
|
|
129
130
|
form_params = opts[:form_params] || {}
|
130
131
|
|
131
132
|
# http body (model)
|
132
|
-
post_body = opts[:
|
133
|
+
post_body = opts[:debug_body] || @api_client.object_to_http_body(edit)
|
133
134
|
|
134
135
|
# return_type
|
135
|
-
return_type = opts[:
|
136
|
+
return_type = opts[:debug_return_type] || 'QueuedResponse'
|
136
137
|
|
137
138
|
# auth_names
|
138
|
-
auth_names = opts[:
|
139
|
+
auth_names = opts[:debug_auth_names] || ['DeveloperKey']
|
139
140
|
|
140
141
|
new_options = opts.merge(
|
142
|
+
:operation => :"EndpointsApi.post_render",
|
141
143
|
:header_params => header_params,
|
142
144
|
:query_params => query_params,
|
143
145
|
:form_params => form_params,
|
data/lib/shotstack/api_client.rb
CHANGED
@@ -6,7 +6,7 @@
|
|
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
|
|
@@ -14,6 +14,7 @@ require 'date'
|
|
14
14
|
require 'json'
|
15
15
|
require 'logger'
|
16
16
|
require 'tempfile'
|
17
|
+
require 'time'
|
17
18
|
require 'typhoeus'
|
18
19
|
|
19
20
|
module Shotstack
|
@@ -86,7 +87,7 @@ module Shotstack
|
|
86
87
|
# @option opts [Object] :body HTTP body (JSON/XML)
|
87
88
|
# @return [Typhoeus::Request] A Typhoeus Request
|
88
89
|
def build_request(http_method, path, opts = {})
|
89
|
-
url = build_request_url(path)
|
90
|
+
url = build_request_url(path, opts)
|
90
91
|
http_method = http_method.to_sym.downcase
|
91
92
|
|
92
93
|
header_params = @default_headers.merge(opts[:header_params] || {})
|
@@ -155,6 +156,44 @@ module Shotstack
|
|
155
156
|
data
|
156
157
|
end
|
157
158
|
|
159
|
+
# Save response body into a file in (the defined) temporary folder, using the filename
|
160
|
+
# from the "Content-Disposition" header if provided, otherwise a random filename.
|
161
|
+
# The response body is written to the file in chunks in order to handle files which
|
162
|
+
# size is larger than maximum Ruby String or even larger than the maximum memory a Ruby
|
163
|
+
# process can use.
|
164
|
+
#
|
165
|
+
# @see Configuration#temp_folder_path
|
166
|
+
def download_file(request)
|
167
|
+
tempfile = nil
|
168
|
+
encoding = nil
|
169
|
+
request.on_headers do |response|
|
170
|
+
content_disposition = response.headers['Content-Disposition']
|
171
|
+
if content_disposition && content_disposition =~ /filename=/i
|
172
|
+
filename = content_disposition[/filename=['"]?([^'"\s]+)['"]?/, 1]
|
173
|
+
prefix = sanitize_filename(filename)
|
174
|
+
else
|
175
|
+
prefix = 'download-'
|
176
|
+
end
|
177
|
+
prefix = prefix + '-' unless prefix.end_with?('-')
|
178
|
+
encoding = response.body.encoding
|
179
|
+
tempfile = Tempfile.open(prefix, @config.temp_folder_path, encoding: encoding)
|
180
|
+
@tempfile = tempfile
|
181
|
+
end
|
182
|
+
request.on_body do |chunk|
|
183
|
+
chunk.force_encoding(encoding)
|
184
|
+
tempfile.write(chunk)
|
185
|
+
end
|
186
|
+
request.on_complete do |response|
|
187
|
+
if tempfile
|
188
|
+
tempfile.close
|
189
|
+
@config.logger.info "Temp file written to #{tempfile.path}, please copy the file to a proper folder "\
|
190
|
+
"with e.g. `FileUtils.cp(tempfile.path, '/new/file/path')` otherwise the temp file "\
|
191
|
+
"will be deleted automatically with GC. It's also recommended to delete the temp file "\
|
192
|
+
"explicitly with `tempfile.delete`"
|
193
|
+
end
|
194
|
+
end
|
195
|
+
end
|
196
|
+
|
158
197
|
# Check if the given MIME is a JSON MIME.
|
159
198
|
# JSON MIME examples:
|
160
199
|
# application/json
|
@@ -191,7 +230,7 @@ module Shotstack
|
|
191
230
|
begin
|
192
231
|
data = JSON.parse("[#{body}]", :symbolize_names => true)[0]
|
193
232
|
rescue JSON::ParserError => e
|
194
|
-
if %w(String Date
|
233
|
+
if %w(String Date Time).include?(return_type)
|
195
234
|
data = body
|
196
235
|
else
|
197
236
|
raise e
|
@@ -216,9 +255,9 @@ module Shotstack
|
|
216
255
|
data.to_f
|
217
256
|
when 'Boolean'
|
218
257
|
data == true
|
219
|
-
when '
|
258
|
+
when 'Time'
|
220
259
|
# parse date time (expecting ISO 8601 format)
|
221
|
-
|
260
|
+
Time.parse data
|
222
261
|
when 'Date'
|
223
262
|
# parse date time (expecting ISO 8601 format)
|
224
263
|
Date.parse data
|
@@ -236,44 +275,9 @@ module Shotstack
|
|
236
275
|
data.each { |k, v| hash[k] = convert_to_type(v, sub_type) }
|
237
276
|
end
|
238
277
|
else
|
239
|
-
# models
|
240
|
-
Shotstack.const_get(return_type)
|
241
|
-
|
242
|
-
end
|
243
|
-
|
244
|
-
# Save response body into a file in (the defined) temporary folder, using the filename
|
245
|
-
# from the "Content-Disposition" header if provided, otherwise a random filename.
|
246
|
-
# The response body is written to the file in chunks in order to handle files which
|
247
|
-
# size is larger than maximum Ruby String or even larger than the maximum memory a Ruby
|
248
|
-
# process can use.
|
249
|
-
#
|
250
|
-
# @see Configuration#temp_folder_path
|
251
|
-
def download_file(request)
|
252
|
-
tempfile = nil
|
253
|
-
encoding = nil
|
254
|
-
request.on_headers do |response|
|
255
|
-
content_disposition = response.headers['Content-Disposition']
|
256
|
-
if content_disposition && content_disposition =~ /filename=/i
|
257
|
-
filename = content_disposition[/filename=['"]?([^'"\s]+)['"]?/, 1]
|
258
|
-
prefix = sanitize_filename(filename)
|
259
|
-
else
|
260
|
-
prefix = 'download-'
|
261
|
-
end
|
262
|
-
prefix = prefix + '-' unless prefix.end_with?('-')
|
263
|
-
encoding = response.body.encoding
|
264
|
-
tempfile = Tempfile.open(prefix, @config.temp_folder_path, encoding: encoding)
|
265
|
-
@tempfile = tempfile
|
266
|
-
end
|
267
|
-
request.on_body do |chunk|
|
268
|
-
chunk.force_encoding(encoding)
|
269
|
-
tempfile.write(chunk)
|
270
|
-
end
|
271
|
-
request.on_complete do |response|
|
272
|
-
tempfile.close if tempfile
|
273
|
-
@config.logger.info "Temp file written to #{tempfile.path}, please copy the file to a proper folder "\
|
274
|
-
"with e.g. `FileUtils.cp(tempfile.path, '/new/file/path')` otherwise the temp file "\
|
275
|
-
"will be deleted automatically with GC. It's also recommended to delete the temp file "\
|
276
|
-
"explicitly with `tempfile.delete`"
|
278
|
+
# models (e.g. Pet) or oneOf
|
279
|
+
klass = Shotstack.const_get(return_type)
|
280
|
+
klass.respond_to?(:openapi_one_of) ? klass.build(data) : klass.build_from_hash(data)
|
277
281
|
end
|
278
282
|
end
|
279
283
|
|
@@ -286,10 +290,10 @@ module Shotstack
|
|
286
290
|
filename.gsub(/.*[\/\\]/, '')
|
287
291
|
end
|
288
292
|
|
289
|
-
def build_request_url(path)
|
293
|
+
def build_request_url(path, opts = {})
|
290
294
|
# Add leading and trailing slashes to path
|
291
295
|
path = "/#{path}".gsub(/\/+/, '/')
|
292
|
-
@config.base_url + path
|
296
|
+
@config.base_url(opts[:operation]) + path
|
293
297
|
end
|
294
298
|
|
295
299
|
# Update hearder and query params based on authentication settings.
|
data/lib/shotstack/api_error.rb
CHANGED
@@ -6,7 +6,7 @@
|
|
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
|
|
@@ -21,6 +21,18 @@ module Shotstack
|
|
21
21
|
# Defines url base path
|
22
22
|
attr_accessor :base_path
|
23
23
|
|
24
|
+
# Define server configuration index
|
25
|
+
attr_accessor :server_index
|
26
|
+
|
27
|
+
# Define server operation configuration index
|
28
|
+
attr_accessor :server_operation_index
|
29
|
+
|
30
|
+
# Default server variables
|
31
|
+
attr_accessor :server_variables
|
32
|
+
|
33
|
+
# Default server operation variables
|
34
|
+
attr_accessor :server_operation_variables
|
35
|
+
|
24
36
|
# Defines API keys used with API Key authentications.
|
25
37
|
#
|
26
38
|
# @return [Hash] key: parameter name, value: parameter value (API key)
|
@@ -129,6 +141,10 @@ module Shotstack
|
|
129
141
|
@scheme = 'https'
|
130
142
|
@host = 'api.shotstack.io'
|
131
143
|
@base_path = '/v1'
|
144
|
+
@server_index = 0
|
145
|
+
@server_operation_index = {}
|
146
|
+
@server_variables = {}
|
147
|
+
@server_operation_variables = {}
|
132
148
|
@api_key = {}
|
133
149
|
@api_key_prefix = {}
|
134
150
|
@timeout = 0
|
@@ -171,8 +187,12 @@ module Shotstack
|
|
171
187
|
@base_path = '' if @base_path == '/'
|
172
188
|
end
|
173
189
|
|
174
|
-
|
175
|
-
|
190
|
+
# Returns base URL for specified operation based on server settings
|
191
|
+
def base_url(operation = nil)
|
192
|
+
index = server_operation_index.fetch(operation, server_index)
|
193
|
+
return "#{scheme}://#{[host, base_path].join('/').gsub(/\/+/, '/')}".sub(/\/+\z/, '') # if index == nil
|
194
|
+
|
195
|
+
#server_url(index, server_operation_variables.fetch(operation, server_variables), operation_server_settings[operation])
|
176
196
|
end
|
177
197
|
|
178
198
|
# Gets API key (with prefix if set).
|
@@ -208,10 +228,10 @@ module Shotstack
|
|
208
228
|
[
|
209
229
|
{
|
210
230
|
url: "https://api.shotstack.io/{version}",
|
211
|
-
description: "No
|
231
|
+
description: "No description provided",
|
212
232
|
variables: {
|
213
233
|
version: {
|
214
|
-
description: "No
|
234
|
+
description: "No description provided",
|
215
235
|
default_value: "v1",
|
216
236
|
enum_values: [
|
217
237
|
"v1",
|
@@ -223,12 +243,17 @@ module Shotstack
|
|
223
243
|
]
|
224
244
|
end
|
225
245
|
|
246
|
+
def operation_server_settings
|
247
|
+
{
|
248
|
+
}
|
249
|
+
end
|
250
|
+
|
226
251
|
# Returns URL based on server settings
|
227
252
|
#
|
228
253
|
# @param index array index of the server settings
|
229
254
|
# @param variables hash of variable and the corresponding value
|
230
|
-
def server_url(index, variables = {})
|
231
|
-
servers = server_settings
|
255
|
+
def server_url(index, variables = {}, servers = nil)
|
256
|
+
servers = server_settings if servers == nil
|
232
257
|
|
233
258
|
# check array index out of bound
|
234
259
|
if (index < 0 || index >= servers.size)
|
@@ -238,10 +263,12 @@ module Shotstack
|
|
238
263
|
server = servers[index]
|
239
264
|
url = server[:url]
|
240
265
|
|
266
|
+
return url unless server.key? :variables
|
267
|
+
|
241
268
|
# go through variable and assign a value
|
242
269
|
server[:variables].each do |name, variable|
|
243
270
|
if variables.key?(name)
|
244
|
-
if (server[:variables][name][:enum_values].include?
|
271
|
+
if (!server[:variables][name].key?(:enum_values) || server[:variables][name][:enum_values].include?(variables[name]))
|
245
272
|
url.gsub! "{" + name.to_s + "}", variables[name]
|
246
273
|
else
|
247
274
|
fail ArgumentError, "The variable `#{name}` in the server URL has invalid value #{variables[name]}. Must be #{server[:variables][name][:enum_values]}."
|
@@ -6,11 +6,12 @@
|
|
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
|
@@ -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
|
|
@@ -88,6 +121,10 @@ module Shotstack
|
|
88
121
|
else
|
89
122
|
self.volume = 1
|
90
123
|
end
|
124
|
+
|
125
|
+
if attributes.key?(:'effect')
|
126
|
+
self.effect = attributes[:'effect']
|
127
|
+
end
|
91
128
|
end
|
92
129
|
|
93
130
|
# Show invalid properties with the reasons. Usually used together with valid?
|
@@ -110,9 +147,21 @@ module Shotstack
|
|
110
147
|
def valid?
|
111
148
|
return false if @type.nil?
|
112
149
|
return false if @src.nil?
|
150
|
+
effect_validator = EnumAttributeValidator.new('String', ["fadeIn", "fadeOut", "fadeInFadeOut"])
|
151
|
+
return false unless effect_validator.valid?(@effect)
|
113
152
|
true
|
114
153
|
end
|
115
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
|
+
|
116
165
|
# Checks equality by comparing each attribute.
|
117
166
|
# @param [Object] Object to be compared
|
118
167
|
def ==(o)
|
@@ -121,7 +170,8 @@ module Shotstack
|
|
121
170
|
type == o.type &&
|
122
171
|
src == o.src &&
|
123
172
|
trim == o.trim &&
|
124
|
-
volume == o.volume
|
173
|
+
volume == o.volume &&
|
174
|
+
effect == o.effect
|
125
175
|
end
|
126
176
|
|
127
177
|
# @see the `==` method
|
@@ -133,7 +183,7 @@ module Shotstack
|
|
133
183
|
# Calculates hash code according to all attributes.
|
134
184
|
# @return [Integer] Hash code
|
135
185
|
def hash
|
136
|
-
[type, src, trim, volume].hash
|
186
|
+
[type, src, trim, volume, effect].hash
|
137
187
|
end
|
138
188
|
|
139
189
|
# Builds the object from hash
|
@@ -149,7 +199,9 @@ module Shotstack
|
|
149
199
|
def build_from_hash(attributes)
|
150
200
|
return nil unless attributes.is_a?(Hash)
|
151
201
|
self.class.openapi_types.each_pair do |key, type|
|
152
|
-
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
|
153
205
|
# check to ensure the input is an array given that the attribute
|
154
206
|
# is documented as an array but the input is not
|
155
207
|
if attributes[self.class.attribute_map[key]].is_a?(Array)
|
@@ -157,7 +209,7 @@ module Shotstack
|
|
157
209
|
end
|
158
210
|
elsif !attributes[self.class.attribute_map[key]].nil?
|
159
211
|
self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
|
160
|
-
end
|
212
|
+
end
|
161
213
|
end
|
162
214
|
|
163
215
|
self
|
@@ -169,8 +221,8 @@ module Shotstack
|
|
169
221
|
# @return [Object] Deserialized data
|
170
222
|
def _deserialize(type, value)
|
171
223
|
case type.to_sym
|
172
|
-
when :
|
173
|
-
|
224
|
+
when :Time
|
225
|
+
Time.parse(value)
|
174
226
|
when :Date
|
175
227
|
Date.parse(value)
|
176
228
|
when :String
|
@@ -200,7 +252,9 @@ module Shotstack
|
|
200
252
|
end
|
201
253
|
end
|
202
254
|
else # model
|
203
|
-
|
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)
|
204
258
|
end
|
205
259
|
end
|
206
260
|
|
@@ -226,7 +280,7 @@ module Shotstack
|
|
226
280
|
is_nullable = self.class.openapi_nullable.include?(attr)
|
227
281
|
next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
|
228
282
|
end
|
229
|
-
|
283
|
+
|
230
284
|
hash[param] = _to_hash(value)
|
231
285
|
end
|
232
286
|
hash
|
@@ -249,5 +303,7 @@ module Shotstack
|
|
249
303
|
value
|
250
304
|
end
|
251
305
|
end
|
306
|
+
|
252
307
|
end
|
308
|
+
|
253
309
|
end
|