docraptor 2.0.0 → 3.1.0
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 +4 -4
- data/.docker_env.list +5 -0
- data/.docker_mounts.list +4 -0
- data/.generator-language-identifier +1 -0
- data/.generator-revision +1 -0
- data/.github/pull_request_template.txt +17 -0
- data/.gitignore +20 -14
- data/.gitlab-ci.yml +26 -0
- data/.openapi-generator/FILES +32 -0
- data/.openapi-generator/VERSION +1 -0
- data/{.swagger-codegen-ignore → .openapi-generator-ignore} +13 -7
- data/.review/README.md +16 -0
- data/.review/generated_files/.gitignore +39 -0
- data/.review/generated_files/README.md +108 -0
- data/.review/generated_files/docs/AsyncDoc.md +18 -0
- data/.review/generated_files/docs/Doc.md +50 -0
- data/.review/generated_files/docs/DocApi.md +503 -0
- data/.review/generated_files/docs/DocStatus.md +28 -0
- data/.review/generated_files/docs/PrinceOptions.md +82 -0
- data/.review/generated_files/spec/api/doc_api_spec.rb +112 -0
- data/{spec → .review/generated_files/spec}/api_client_spec.rb +6 -21
- data/{spec → .review/generated_files/spec}/configuration_spec.rb +6 -6
- data/.review/generated_files/spec/models/async_doc_spec.rb +34 -0
- data/.review/generated_files/spec/models/doc_spec.rb +138 -0
- data/.review/generated_files/spec/models/doc_status_spec.rb +64 -0
- data/.review/generated_files/spec/models/prince_options_spec.rb +234 -0
- data/{spec → .review/generated_files/spec}/spec_helper.rb +3 -3
- data/.rubocop.yml +148 -0
- data/.runtime-environments +13 -0
- data/.travis.yml +9 -7
- data/CHANGELOG.md +8 -0
- data/Gemfile +3 -1
- data/README.md +8 -8
- data/Rakefile +1 -2
- data/docraptor.gemspec +5 -19
- data/docraptor.yaml +283 -284
- data/examples/async.rb +24 -30
- data/examples/hosted_async.rb +21 -33
- data/examples/hosted_sync.rb +19 -32
- data/examples/sync.rb +20 -26
- data/gemfiles/Gemfile.2.5.lock +70 -0
- data/gemfiles/Gemfile.2.6.lock +70 -0
- data/gemfiles/Gemfile.2.7.lock +70 -0
- data/gemfiles/Gemfile.3.0.lock +70 -0
- data/gemfiles/Gemfile.3.1.lock +72 -0
- data/gemfiles/Gemfile.3.2.lock +72 -0
- data/gemfiles/Gemfile.3.3.lock +72 -0
- data/{swagger-config.json → generator-config.json} +3 -2
- data/lib/docraptor/api/doc_api.rb +180 -85
- data/lib/docraptor/api_client.rb +91 -90
- data/lib/docraptor/api_error.rb +23 -3
- data/lib/docraptor/configuration.rb +101 -15
- data/lib/docraptor/models/async_doc.rb +53 -18
- data/lib/docraptor/models/doc.rb +80 -50
- data/lib/docraptor/models/doc_status.rb +58 -23
- data/lib/docraptor/models/prince_options.rb +149 -75
- data/lib/docraptor/version.rb +4 -4
- data/lib/docraptor.rb +3 -3
- data/script/clean +2 -2
- data/script/console +5 -0
- data/script/docker +56 -0
- data/script/fix_gemspec.rb +3 -18
- data/script/generate_language +43 -4
- data/script/inside_container/README.md +6 -0
- data/script/inside_container/test +87 -0
- data/script/post_generate_language +8 -2
- data/script/release +13 -0
- data/script/setup +25 -14
- data/script/swagger +6 -33
- data/script/test +30 -27
- data/test/async.rb +2 -2
- data/test/expire_hosted.rb +2 -2
- data/test/hosted_async.rb +7 -1
- data/test/hosted_sync.rb +2 -2
- data/test/iframes_default.rb +40 -0
- data/test/iframes_false.rb +40 -0
- data/test/iframes_true.rb +40 -0
- data/test/prince_options.rb +45 -0
- data/test/sync.rb +2 -2
- data/test/xlsx.rb +10 -3
- metadata +52 -214
- data/.swagger-codegen/VERSION +0 -1
- data/.swagger-revision +0 -1
data/lib/docraptor/models/doc.rb
CHANGED
@@ -3,14 +3,15 @@
|
|
3
3
|
|
4
4
|
#A native client library for the DocRaptor HTML to PDF/XLS service.
|
5
5
|
|
6
|
-
OpenAPI
|
6
|
+
The version of the OpenAPI document: 2.0.0
|
7
7
|
|
8
|
-
Generated by: https://
|
9
|
-
|
8
|
+
Generated by: https://openapi-generator.tech
|
9
|
+
OpenAPI Generator version: 6.6.0
|
10
10
|
|
11
11
|
=end
|
12
12
|
|
13
13
|
require 'date'
|
14
|
+
require 'time'
|
14
15
|
|
15
16
|
module DocRaptor
|
16
17
|
class Doc
|
@@ -109,21 +110,26 @@ module DocRaptor
|
|
109
110
|
}
|
110
111
|
end
|
111
112
|
|
113
|
+
# Returns all the JSON keys this model knows about
|
114
|
+
def self.acceptable_attributes
|
115
|
+
attribute_map.values
|
116
|
+
end
|
117
|
+
|
112
118
|
# Attribute type mapping.
|
113
|
-
def self.
|
119
|
+
def self.openapi_types
|
114
120
|
{
|
115
121
|
:'name' => :'String',
|
116
122
|
:'document_type' => :'String',
|
117
123
|
:'document_content' => :'String',
|
118
124
|
:'document_url' => :'String',
|
119
|
-
:'test' => :'
|
125
|
+
:'test' => :'Boolean',
|
120
126
|
:'pipeline' => :'String',
|
121
127
|
:'strict' => :'String',
|
122
|
-
:'ignore_resource_errors' => :'
|
123
|
-
:'ignore_console_messages' => :'
|
128
|
+
:'ignore_resource_errors' => :'Boolean',
|
129
|
+
:'ignore_console_messages' => :'Boolean',
|
124
130
|
:'tag' => :'String',
|
125
|
-
:'help' => :'
|
126
|
-
:'javascript' => :'
|
131
|
+
:'help' => :'Boolean',
|
132
|
+
:'javascript' => :'Boolean',
|
127
133
|
:'referrer' => :'String',
|
128
134
|
:'callback_url' => :'String',
|
129
135
|
:'hosted_download_limit' => :'Integer',
|
@@ -132,89 +138,102 @@ module DocRaptor
|
|
132
138
|
}
|
133
139
|
end
|
134
140
|
|
141
|
+
# List of attributes with nullable: true
|
142
|
+
def self.openapi_nullable
|
143
|
+
Set.new([
|
144
|
+
])
|
145
|
+
end
|
146
|
+
|
135
147
|
# Initializes the object
|
136
148
|
# @param [Hash] attributes Model attributes in the form of hash
|
137
149
|
def initialize(attributes = {})
|
138
|
-
|
150
|
+
if (!attributes.is_a?(Hash))
|
151
|
+
fail ArgumentError, "The input argument (attributes) must be a hash in `DocRaptor::Doc` initialize method"
|
152
|
+
end
|
139
153
|
|
140
|
-
# convert string to symbol for hash key
|
141
|
-
attributes = attributes.each_with_object({}) { |(k, v), h|
|
154
|
+
# check to see if the attribute exists and convert string to symbol for hash key
|
155
|
+
attributes = attributes.each_with_object({}) { |(k, v), h|
|
156
|
+
if (!self.class.attribute_map.key?(k.to_sym))
|
157
|
+
fail ArgumentError, "`#{k}` is not a valid attribute in `DocRaptor::Doc`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
|
158
|
+
end
|
159
|
+
h[k.to_sym] = v
|
160
|
+
}
|
142
161
|
|
143
|
-
if attributes.
|
162
|
+
if attributes.key?(:'name')
|
144
163
|
self.name = attributes[:'name']
|
145
164
|
end
|
146
165
|
|
147
|
-
if attributes.
|
166
|
+
if attributes.key?(:'document_type')
|
148
167
|
self.document_type = attributes[:'document_type']
|
149
168
|
end
|
150
169
|
|
151
|
-
if attributes.
|
170
|
+
if attributes.key?(:'document_content')
|
152
171
|
self.document_content = attributes[:'document_content']
|
153
172
|
end
|
154
173
|
|
155
|
-
if attributes.
|
174
|
+
if attributes.key?(:'document_url')
|
156
175
|
self.document_url = attributes[:'document_url']
|
157
176
|
end
|
158
177
|
|
159
|
-
if attributes.
|
178
|
+
if attributes.key?(:'test')
|
160
179
|
self.test = attributes[:'test']
|
161
180
|
else
|
162
181
|
self.test = true
|
163
182
|
end
|
164
183
|
|
165
|
-
if attributes.
|
184
|
+
if attributes.key?(:'pipeline')
|
166
185
|
self.pipeline = attributes[:'pipeline']
|
167
186
|
end
|
168
187
|
|
169
|
-
if attributes.
|
188
|
+
if attributes.key?(:'strict')
|
170
189
|
self.strict = attributes[:'strict']
|
171
190
|
end
|
172
191
|
|
173
|
-
if attributes.
|
192
|
+
if attributes.key?(:'ignore_resource_errors')
|
174
193
|
self.ignore_resource_errors = attributes[:'ignore_resource_errors']
|
175
194
|
else
|
176
195
|
self.ignore_resource_errors = true
|
177
196
|
end
|
178
197
|
|
179
|
-
if attributes.
|
198
|
+
if attributes.key?(:'ignore_console_messages')
|
180
199
|
self.ignore_console_messages = attributes[:'ignore_console_messages']
|
181
200
|
else
|
182
201
|
self.ignore_console_messages = false
|
183
202
|
end
|
184
203
|
|
185
|
-
if attributes.
|
204
|
+
if attributes.key?(:'tag')
|
186
205
|
self.tag = attributes[:'tag']
|
187
206
|
end
|
188
207
|
|
189
|
-
if attributes.
|
208
|
+
if attributes.key?(:'help')
|
190
209
|
self.help = attributes[:'help']
|
191
210
|
else
|
192
211
|
self.help = false
|
193
212
|
end
|
194
213
|
|
195
|
-
if attributes.
|
214
|
+
if attributes.key?(:'javascript')
|
196
215
|
self.javascript = attributes[:'javascript']
|
197
216
|
else
|
198
217
|
self.javascript = false
|
199
218
|
end
|
200
219
|
|
201
|
-
if attributes.
|
220
|
+
if attributes.key?(:'referrer')
|
202
221
|
self.referrer = attributes[:'referrer']
|
203
222
|
end
|
204
223
|
|
205
|
-
if attributes.
|
224
|
+
if attributes.key?(:'callback_url')
|
206
225
|
self.callback_url = attributes[:'callback_url']
|
207
226
|
end
|
208
227
|
|
209
|
-
if attributes.
|
228
|
+
if attributes.key?(:'hosted_download_limit')
|
210
229
|
self.hosted_download_limit = attributes[:'hosted_download_limit']
|
211
230
|
end
|
212
231
|
|
213
|
-
if attributes.
|
232
|
+
if attributes.key?(:'hosted_expires_at')
|
214
233
|
self.hosted_expires_at = attributes[:'hosted_expires_at']
|
215
234
|
end
|
216
235
|
|
217
|
-
if attributes.
|
236
|
+
if attributes.key?(:'prince_options')
|
218
237
|
self.prince_options = attributes[:'prince_options']
|
219
238
|
end
|
220
239
|
end
|
@@ -231,10 +250,6 @@ module DocRaptor
|
|
231
250
|
invalid_properties.push('invalid value for "document_type", document_type cannot be nil.')
|
232
251
|
end
|
233
252
|
|
234
|
-
if @document_content.nil?
|
235
|
-
invalid_properties.push('invalid value for "document_content", document_content cannot be nil.')
|
236
|
-
end
|
237
|
-
|
238
253
|
invalid_properties
|
239
254
|
end
|
240
255
|
|
@@ -243,10 +258,9 @@ module DocRaptor
|
|
243
258
|
def valid?
|
244
259
|
return false if @name.nil?
|
245
260
|
return false if @document_type.nil?
|
246
|
-
document_type_validator = EnumAttributeValidator.new('String', [
|
261
|
+
document_type_validator = EnumAttributeValidator.new('String', ["pdf", "xls", "xlsx"])
|
247
262
|
return false unless document_type_validator.valid?(@document_type)
|
248
|
-
|
249
|
-
strict_validator = EnumAttributeValidator.new('String', ['none', 'html'])
|
263
|
+
strict_validator = EnumAttributeValidator.new('String', ["none", "html"])
|
250
264
|
return false unless strict_validator.valid?(@strict)
|
251
265
|
true
|
252
266
|
end
|
@@ -254,9 +268,9 @@ module DocRaptor
|
|
254
268
|
# Custom attribute writer method checking allowed values (enum).
|
255
269
|
# @param [Object] document_type Object to be assigned
|
256
270
|
def document_type=(document_type)
|
257
|
-
validator = EnumAttributeValidator.new('String', [
|
271
|
+
validator = EnumAttributeValidator.new('String', ["pdf", "xls", "xlsx"])
|
258
272
|
unless validator.valid?(document_type)
|
259
|
-
fail ArgumentError,
|
273
|
+
fail ArgumentError, "invalid value for \"document_type\", must be one of #{validator.allowable_values}."
|
260
274
|
end
|
261
275
|
@document_type = document_type
|
262
276
|
end
|
@@ -264,9 +278,9 @@ module DocRaptor
|
|
264
278
|
# Custom attribute writer method checking allowed values (enum).
|
265
279
|
# @param [Object] strict Object to be assigned
|
266
280
|
def strict=(strict)
|
267
|
-
validator = EnumAttributeValidator.new('String', [
|
281
|
+
validator = EnumAttributeValidator.new('String', ["none", "html"])
|
268
282
|
unless validator.valid?(strict)
|
269
|
-
fail ArgumentError,
|
283
|
+
fail ArgumentError, "invalid value for \"strict\", must be one of #{validator.allowable_values}."
|
270
284
|
end
|
271
285
|
@strict = strict
|
272
286
|
end
|
@@ -302,18 +316,28 @@ module DocRaptor
|
|
302
316
|
end
|
303
317
|
|
304
318
|
# Calculates hash code according to all attributes.
|
305
|
-
# @return [
|
319
|
+
# @return [Integer] Hash code
|
306
320
|
def hash
|
307
321
|
[name, document_type, document_content, document_url, test, pipeline, strict, ignore_resource_errors, ignore_console_messages, tag, help, javascript, referrer, callback_url, hosted_download_limit, hosted_expires_at, prince_options].hash
|
308
322
|
end
|
309
323
|
|
324
|
+
# Builds the object from hash
|
325
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
326
|
+
# @return [Object] Returns the model itself
|
327
|
+
def self.build_from_hash(attributes)
|
328
|
+
new.build_from_hash(attributes)
|
329
|
+
end
|
330
|
+
|
310
331
|
# Builds the object from hash
|
311
332
|
# @param [Hash] attributes Model attributes in the form of hash
|
312
333
|
# @return [Object] Returns the model itself
|
313
334
|
def build_from_hash(attributes)
|
314
335
|
return nil unless attributes.is_a?(Hash)
|
315
|
-
|
316
|
-
|
336
|
+
attributes = attributes.transform_keys(&:to_sym)
|
337
|
+
self.class.openapi_types.each_pair do |key, type|
|
338
|
+
if attributes[self.class.attribute_map[key]].nil? && self.class.openapi_nullable.include?(key)
|
339
|
+
self.send("#{key}=", nil)
|
340
|
+
elsif type =~ /\AArray<(.*)>/i
|
317
341
|
# check to ensure the input is an array given that the attribute
|
318
342
|
# is documented as an array but the input is not
|
319
343
|
if attributes[self.class.attribute_map[key]].is_a?(Array)
|
@@ -321,7 +345,7 @@ module DocRaptor
|
|
321
345
|
end
|
322
346
|
elsif !attributes[self.class.attribute_map[key]].nil?
|
323
347
|
self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
|
324
|
-
end
|
348
|
+
end
|
325
349
|
end
|
326
350
|
|
327
351
|
self
|
@@ -333,8 +357,8 @@ module DocRaptor
|
|
333
357
|
# @return [Object] Deserialized data
|
334
358
|
def _deserialize(type, value)
|
335
359
|
case type.to_sym
|
336
|
-
when :
|
337
|
-
|
360
|
+
when :Time
|
361
|
+
Time.parse(value)
|
338
362
|
when :Date
|
339
363
|
Date.parse(value)
|
340
364
|
when :String
|
@@ -343,7 +367,7 @@ module DocRaptor
|
|
343
367
|
value.to_i
|
344
368
|
when :Float
|
345
369
|
value.to_f
|
346
|
-
when :
|
370
|
+
when :Boolean
|
347
371
|
if value.to_s =~ /\A(true|t|yes|y|1)\z/i
|
348
372
|
true
|
349
373
|
else
|
@@ -364,8 +388,9 @@ module DocRaptor
|
|
364
388
|
end
|
365
389
|
end
|
366
390
|
else # model
|
367
|
-
|
368
|
-
|
391
|
+
# models (e.g. Pet) or oneOf
|
392
|
+
klass = DocRaptor.const_get(type)
|
393
|
+
klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
|
369
394
|
end
|
370
395
|
end
|
371
396
|
|
@@ -387,7 +412,11 @@ module DocRaptor
|
|
387
412
|
hash = {}
|
388
413
|
self.class.attribute_map.each_pair do |attr, param|
|
389
414
|
value = self.send(attr)
|
390
|
-
|
415
|
+
if value.nil?
|
416
|
+
is_nullable = self.class.openapi_nullable.include?(attr)
|
417
|
+
next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
|
418
|
+
end
|
419
|
+
|
391
420
|
hash[param] = _to_hash(value)
|
392
421
|
end
|
393
422
|
hash
|
@@ -412,4 +441,5 @@ module DocRaptor
|
|
412
441
|
end
|
413
442
|
|
414
443
|
end
|
444
|
+
|
415
445
|
end
|
@@ -3,14 +3,15 @@
|
|
3
3
|
|
4
4
|
#A native client library for the DocRaptor HTML to PDF/XLS service.
|
5
5
|
|
6
|
-
OpenAPI
|
6
|
+
The version of the OpenAPI document: 2.0.0
|
7
7
|
|
8
|
-
Generated by: https://
|
9
|
-
|
8
|
+
Generated by: https://openapi-generator.tech
|
9
|
+
OpenAPI Generator version: 6.6.0
|
10
10
|
|
11
11
|
=end
|
12
12
|
|
13
13
|
require 'date'
|
14
|
+
require 'time'
|
14
15
|
|
15
16
|
module DocRaptor
|
16
17
|
class DocStatus
|
@@ -44,8 +45,13 @@ module DocRaptor
|
|
44
45
|
}
|
45
46
|
end
|
46
47
|
|
48
|
+
# Returns all the JSON keys this model knows about
|
49
|
+
def self.acceptable_attributes
|
50
|
+
attribute_map.values
|
51
|
+
end
|
52
|
+
|
47
53
|
# Attribute type mapping.
|
48
|
-
def self.
|
54
|
+
def self.openapi_types
|
49
55
|
{
|
50
56
|
:'status' => :'String',
|
51
57
|
:'download_url' => :'String',
|
@@ -56,35 +62,48 @@ module DocRaptor
|
|
56
62
|
}
|
57
63
|
end
|
58
64
|
|
65
|
+
# List of attributes with nullable: true
|
66
|
+
def self.openapi_nullable
|
67
|
+
Set.new([
|
68
|
+
])
|
69
|
+
end
|
70
|
+
|
59
71
|
# Initializes the object
|
60
72
|
# @param [Hash] attributes Model attributes in the form of hash
|
61
73
|
def initialize(attributes = {})
|
62
|
-
|
74
|
+
if (!attributes.is_a?(Hash))
|
75
|
+
fail ArgumentError, "The input argument (attributes) must be a hash in `DocRaptor::DocStatus` initialize method"
|
76
|
+
end
|
63
77
|
|
64
|
-
# convert string to symbol for hash key
|
65
|
-
attributes = attributes.each_with_object({}) { |(k, v), h|
|
78
|
+
# check to see if the attribute exists and convert string to symbol for hash key
|
79
|
+
attributes = attributes.each_with_object({}) { |(k, v), h|
|
80
|
+
if (!self.class.attribute_map.key?(k.to_sym))
|
81
|
+
fail ArgumentError, "`#{k}` is not a valid attribute in `DocRaptor::DocStatus`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
|
82
|
+
end
|
83
|
+
h[k.to_sym] = v
|
84
|
+
}
|
66
85
|
|
67
|
-
if attributes.
|
86
|
+
if attributes.key?(:'status')
|
68
87
|
self.status = attributes[:'status']
|
69
88
|
end
|
70
89
|
|
71
|
-
if attributes.
|
90
|
+
if attributes.key?(:'download_url')
|
72
91
|
self.download_url = attributes[:'download_url']
|
73
92
|
end
|
74
93
|
|
75
|
-
if attributes.
|
94
|
+
if attributes.key?(:'download_id')
|
76
95
|
self.download_id = attributes[:'download_id']
|
77
96
|
end
|
78
97
|
|
79
|
-
if attributes.
|
98
|
+
if attributes.key?(:'message')
|
80
99
|
self.message = attributes[:'message']
|
81
100
|
end
|
82
101
|
|
83
|
-
if attributes.
|
102
|
+
if attributes.key?(:'number_of_pages')
|
84
103
|
self.number_of_pages = attributes[:'number_of_pages']
|
85
104
|
end
|
86
105
|
|
87
|
-
if attributes.
|
106
|
+
if attributes.key?(:'validation_errors')
|
88
107
|
self.validation_errors = attributes[:'validation_errors']
|
89
108
|
end
|
90
109
|
end
|
@@ -122,18 +141,28 @@ module DocRaptor
|
|
122
141
|
end
|
123
142
|
|
124
143
|
# Calculates hash code according to all attributes.
|
125
|
-
# @return [
|
144
|
+
# @return [Integer] Hash code
|
126
145
|
def hash
|
127
146
|
[status, download_url, download_id, message, number_of_pages, validation_errors].hash
|
128
147
|
end
|
129
148
|
|
149
|
+
# Builds the object from hash
|
150
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
151
|
+
# @return [Object] Returns the model itself
|
152
|
+
def self.build_from_hash(attributes)
|
153
|
+
new.build_from_hash(attributes)
|
154
|
+
end
|
155
|
+
|
130
156
|
# Builds the object from hash
|
131
157
|
# @param [Hash] attributes Model attributes in the form of hash
|
132
158
|
# @return [Object] Returns the model itself
|
133
159
|
def build_from_hash(attributes)
|
134
160
|
return nil unless attributes.is_a?(Hash)
|
135
|
-
|
136
|
-
|
161
|
+
attributes = attributes.transform_keys(&:to_sym)
|
162
|
+
self.class.openapi_types.each_pair do |key, type|
|
163
|
+
if attributes[self.class.attribute_map[key]].nil? && self.class.openapi_nullable.include?(key)
|
164
|
+
self.send("#{key}=", nil)
|
165
|
+
elsif type =~ /\AArray<(.*)>/i
|
137
166
|
# check to ensure the input is an array given that the attribute
|
138
167
|
# is documented as an array but the input is not
|
139
168
|
if attributes[self.class.attribute_map[key]].is_a?(Array)
|
@@ -141,7 +170,7 @@ module DocRaptor
|
|
141
170
|
end
|
142
171
|
elsif !attributes[self.class.attribute_map[key]].nil?
|
143
172
|
self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
|
144
|
-
end
|
173
|
+
end
|
145
174
|
end
|
146
175
|
|
147
176
|
self
|
@@ -153,8 +182,8 @@ module DocRaptor
|
|
153
182
|
# @return [Object] Deserialized data
|
154
183
|
def _deserialize(type, value)
|
155
184
|
case type.to_sym
|
156
|
-
when :
|
157
|
-
|
185
|
+
when :Time
|
186
|
+
Time.parse(value)
|
158
187
|
when :Date
|
159
188
|
Date.parse(value)
|
160
189
|
when :String
|
@@ -163,7 +192,7 @@ module DocRaptor
|
|
163
192
|
value.to_i
|
164
193
|
when :Float
|
165
194
|
value.to_f
|
166
|
-
when :
|
195
|
+
when :Boolean
|
167
196
|
if value.to_s =~ /\A(true|t|yes|y|1)\z/i
|
168
197
|
true
|
169
198
|
else
|
@@ -184,8 +213,9 @@ module DocRaptor
|
|
184
213
|
end
|
185
214
|
end
|
186
215
|
else # model
|
187
|
-
|
188
|
-
|
216
|
+
# models (e.g. Pet) or oneOf
|
217
|
+
klass = DocRaptor.const_get(type)
|
218
|
+
klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
|
189
219
|
end
|
190
220
|
end
|
191
221
|
|
@@ -207,7 +237,11 @@ module DocRaptor
|
|
207
237
|
hash = {}
|
208
238
|
self.class.attribute_map.each_pair do |attr, param|
|
209
239
|
value = self.send(attr)
|
210
|
-
|
240
|
+
if value.nil?
|
241
|
+
is_nullable = self.class.openapi_nullable.include?(attr)
|
242
|
+
next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
|
243
|
+
end
|
244
|
+
|
211
245
|
hash[param] = _to_hash(value)
|
212
246
|
end
|
213
247
|
hash
|
@@ -232,4 +266,5 @@ module DocRaptor
|
|
232
266
|
end
|
233
267
|
|
234
268
|
end
|
269
|
+
|
235
270
|
end
|