docspring 1.3.0 → 1.4.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (44) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +16 -0
  3. data/Gemfile.lock +3 -8
  4. data/LICENSE +1 -1
  5. data/README.md +13 -5
  6. data/docs/CombinePdfsData.md +1 -0
  7. data/docs/CombinedSubmission.md +1 -0
  8. data/docs/CombinedSubmissionData.md +1 -0
  9. data/docs/CopyTemplateData.md +9 -0
  10. data/docs/ListSubmissionsResponse.md +10 -0
  11. data/docs/MoveTemplateData.md +1 -1
  12. data/docs/PDFApi.md +232 -4
  13. data/docs/SubmissionData.md +1 -0
  14. data/docs/SubmissionDataRequest.md +1 -0
  15. data/docs/Template1.md +46 -0
  16. data/docs/Template1Defaults.md +10 -0
  17. data/docspring.gemspec +1 -2
  18. data/lib/docspring/api/pdf_api.rb +244 -2
  19. data/lib/docspring/api_client.rb +1 -1
  20. data/lib/docspring/configuration.rb +1 -2
  21. data/lib/docspring/models/combine_pdfs_data.rb +10 -1
  22. data/lib/docspring/models/combined_submission.rb +10 -1
  23. data/lib/docspring/models/combined_submission_data.rb +10 -1
  24. data/lib/docspring/models/copy_template_data.rb +197 -0
  25. data/lib/docspring/models/list_submissions_response.rb +203 -0
  26. data/lib/docspring/models/move_template_data.rb +5 -0
  27. data/lib/docspring/models/submission_data.rb +10 -1
  28. data/lib/docspring/models/submission_data_request.rb +15 -1
  29. data/lib/docspring/models/template1.rb +565 -0
  30. data/lib/docspring/models/template1_defaults.rb +201 -0
  31. data/lib/docspring/version.rb +1 -1
  32. data/lib/docspring.rb +4 -0
  33. data/spec/api/client_integration_spec.rb +1 -1
  34. data/spec/api/pdf_api_spec_original.skipped.rb +78 -2
  35. data/spec/models/combine_pdfs_data_spec.rb +6 -0
  36. data/spec/models/combined_submission_data_spec.rb +6 -0
  37. data/spec/models/combined_submission_spec.rb +6 -0
  38. data/spec/models/copy_template_data_spec.rb +47 -0
  39. data/spec/models/list_submissions_response_spec.rb +53 -0
  40. data/spec/models/submission_data_request_spec.rb +6 -0
  41. data/spec/models/submission_data_spec.rb +6 -0
  42. data/spec/models/template1_defaults_spec.rb +53 -0
  43. data/spec/models/template1_spec.rb +273 -0
  44. metadata +23 -27
@@ -296,6 +296,65 @@ module DocSpring
296
296
  return data, status_code, headers
297
297
  end
298
298
 
299
+ # Copy a Template
300
+ # @param template_id
301
+ # @param copy_template_data
302
+ # @param [Hash] opts the optional parameters
303
+ # @return [Template]
304
+ def copy_template(template_id, copy_template_data, opts = {})
305
+ data, _status_code, _headers = copy_template_with_http_info(template_id, copy_template_data, opts)
306
+ data
307
+ end
308
+
309
+ # Copy a Template
310
+ # @param template_id
311
+ # @param copy_template_data
312
+ # @param [Hash] opts the optional parameters
313
+ # @return [Array<(Template, Fixnum, Hash)>] Template data, response status code and response headers
314
+ def copy_template_with_http_info(template_id, copy_template_data, opts = {})
315
+ if @api_client.config.debugging
316
+ @api_client.config.logger.debug 'Calling API: PDFApi.copy_template ...'
317
+ end
318
+ # verify the required parameter 'template_id' is set
319
+ if @api_client.config.client_side_validation && template_id.nil?
320
+ fail ArgumentError, "Missing the required parameter 'template_id' when calling PDFApi.copy_template"
321
+ end
322
+ # verify the required parameter 'copy_template_data' is set
323
+ if @api_client.config.client_side_validation && copy_template_data.nil?
324
+ fail ArgumentError, "Missing the required parameter 'copy_template_data' when calling PDFApi.copy_template"
325
+ end
326
+ # resource path
327
+ local_var_path = '/templates/{template_id}/copy'.sub('{' + 'template_id' + '}', template_id.to_s)
328
+
329
+ # query parameters
330
+ query_params = {}
331
+
332
+ # header parameters
333
+ header_params = {}
334
+ # HTTP header 'Accept' (if needed)
335
+ header_params['Accept'] = @api_client.select_header_accept(['application/json'])
336
+ # HTTP header 'Content-Type'
337
+ header_params['Content-Type'] = @api_client.select_header_content_type(['application/json'])
338
+
339
+ # form parameters
340
+ form_params = {}
341
+
342
+ # http body (model)
343
+ post_body = @api_client.object_to_http_body(copy_template_data)
344
+ auth_names = ['api_token_basic']
345
+ data, status_code, headers = @api_client.call_api(:POST, local_var_path,
346
+ :header_params => header_params,
347
+ :query_params => query_params,
348
+ :form_params => form_params,
349
+ :body => post_body,
350
+ :auth_names => auth_names,
351
+ :return_type => 'Template')
352
+ if @api_client.config.debugging
353
+ @api_client.config.logger.debug "API called: PDFApi#copy_template\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
354
+ end
355
+ return data, status_code, headers
356
+ end
357
+
299
358
  # Create a new custom file from a cached presign upload
300
359
  # @param create_custom_file_data
301
360
  # @param [Hash] opts the optional parameters
@@ -937,6 +996,57 @@ module DocSpring
937
996
  return data, status_code, headers
938
997
  end
939
998
 
999
+ # Fetch the full template attributes
1000
+ # @param template_id
1001
+ # @param [Hash] opts the optional parameters
1002
+ # @return [Template1]
1003
+ def get_full_template(template_id, opts = {})
1004
+ data, _status_code, _headers = get_full_template_with_http_info(template_id, opts)
1005
+ data
1006
+ end
1007
+
1008
+ # Fetch the full template attributes
1009
+ # @param template_id
1010
+ # @param [Hash] opts the optional parameters
1011
+ # @return [Array<(Template1, Fixnum, Hash)>] Template1 data, response status code and response headers
1012
+ def get_full_template_with_http_info(template_id, opts = {})
1013
+ if @api_client.config.debugging
1014
+ @api_client.config.logger.debug 'Calling API: PDFApi.get_full_template ...'
1015
+ end
1016
+ # verify the required parameter 'template_id' is set
1017
+ if @api_client.config.client_side_validation && template_id.nil?
1018
+ fail ArgumentError, "Missing the required parameter 'template_id' when calling PDFApi.get_full_template"
1019
+ end
1020
+ # resource path
1021
+ local_var_path = '/templates/{template_id}?full=true'.sub('{' + 'template_id' + '}', template_id.to_s)
1022
+
1023
+ # query parameters
1024
+ query_params = {}
1025
+
1026
+ # header parameters
1027
+ header_params = {}
1028
+ # HTTP header 'Accept' (if needed)
1029
+ header_params['Accept'] = @api_client.select_header_accept(['application/json'])
1030
+
1031
+ # form parameters
1032
+ form_params = {}
1033
+
1034
+ # http body (model)
1035
+ post_body = nil
1036
+ auth_names = ['api_token_basic']
1037
+ data, status_code, headers = @api_client.call_api(:GET, local_var_path,
1038
+ :header_params => header_params,
1039
+ :query_params => query_params,
1040
+ :form_params => form_params,
1041
+ :body => post_body,
1042
+ :auth_names => auth_names,
1043
+ :return_type => 'Template1')
1044
+ if @api_client.config.debugging
1045
+ @api_client.config.logger.debug "API called: PDFApi#get_full_template\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
1046
+ end
1047
+ return data, status_code, headers
1048
+ end
1049
+
940
1050
  # Get a presigned URL so that you can upload a file to our AWS S3 bucket
941
1051
  # @param [Hash] opts the optional parameters
942
1052
  # @return [Hash<String, Object>]
@@ -1090,7 +1200,7 @@ module DocSpring
1090
1200
  return data, status_code, headers
1091
1201
  end
1092
1202
 
1093
- # Get a single template
1203
+ # Check the status of an uploaded template
1094
1204
  # @param template_id
1095
1205
  # @param [Hash] opts the optional parameters
1096
1206
  # @return [Template]
@@ -1099,7 +1209,7 @@ module DocSpring
1099
1209
  data
1100
1210
  end
1101
1211
 
1102
- # Get a single template
1212
+ # Check the status of an uploaded template
1103
1213
  # @param template_id
1104
1214
  # @param [Hash] opts the optional parameters
1105
1215
  # @return [Array<(Template, Fixnum, Hash)>] Template data, response status code and response headers
@@ -1240,6 +1350,138 @@ module DocSpring
1240
1350
  return data, status_code, headers
1241
1351
  end
1242
1352
 
1353
+ # List all submissions
1354
+ # @param [Hash] opts the optional parameters
1355
+ # @option opts [String] :cursor
1356
+ # @option opts [Float] :limit
1357
+ # @option opts [String] :created_after
1358
+ # @option opts [String] :created_before
1359
+ # @option opts [String] :type
1360
+ # @option opts [BOOLEAN] :include_data
1361
+ # @return [ListSubmissionsResponse]
1362
+ def list_submissions(opts = {})
1363
+ data, _status_code, _headers = list_submissions_with_http_info(opts)
1364
+ data
1365
+ end
1366
+
1367
+ # List all submissions
1368
+ # @param [Hash] opts the optional parameters
1369
+ # @option opts [String] :cursor
1370
+ # @option opts [Float] :limit
1371
+ # @option opts [String] :created_after
1372
+ # @option opts [String] :created_before
1373
+ # @option opts [String] :type
1374
+ # @option opts [BOOLEAN] :include_data
1375
+ # @return [Array<(ListSubmissionsResponse, Fixnum, Hash)>] ListSubmissionsResponse data, response status code and response headers
1376
+ def list_submissions_with_http_info(opts = {})
1377
+ if @api_client.config.debugging
1378
+ @api_client.config.logger.debug 'Calling API: PDFApi.list_submissions ...'
1379
+ end
1380
+ # resource path
1381
+ local_var_path = '/submissions'
1382
+
1383
+ # query parameters
1384
+ query_params = {}
1385
+ query_params[:'cursor'] = opts[:'cursor'] if !opts[:'cursor'].nil?
1386
+ query_params[:'limit'] = opts[:'limit'] if !opts[:'limit'].nil?
1387
+ query_params[:'created_after'] = opts[:'created_after'] if !opts[:'created_after'].nil?
1388
+ query_params[:'created_before'] = opts[:'created_before'] if !opts[:'created_before'].nil?
1389
+ query_params[:'type'] = opts[:'type'] if !opts[:'type'].nil?
1390
+ query_params[:'include_data'] = opts[:'include_data'] if !opts[:'include_data'].nil?
1391
+
1392
+ # header parameters
1393
+ header_params = {}
1394
+ # HTTP header 'Accept' (if needed)
1395
+ header_params['Accept'] = @api_client.select_header_accept(['application/json'])
1396
+
1397
+ # form parameters
1398
+ form_params = {}
1399
+
1400
+ # http body (model)
1401
+ post_body = nil
1402
+ auth_names = ['api_token_basic']
1403
+ data, status_code, headers = @api_client.call_api(:GET, local_var_path,
1404
+ :header_params => header_params,
1405
+ :query_params => query_params,
1406
+ :form_params => form_params,
1407
+ :body => post_body,
1408
+ :auth_names => auth_names,
1409
+ :return_type => 'ListSubmissionsResponse')
1410
+ if @api_client.config.debugging
1411
+ @api_client.config.logger.debug "API called: PDFApi#list_submissions\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
1412
+ end
1413
+ return data, status_code, headers
1414
+ end
1415
+
1416
+ # List all submissions for a given template
1417
+ # @param template_id
1418
+ # @param [Hash] opts the optional parameters
1419
+ # @option opts [String] :cursor
1420
+ # @option opts [Float] :limit
1421
+ # @option opts [String] :created_after
1422
+ # @option opts [String] :created_before
1423
+ # @option opts [String] :type
1424
+ # @option opts [BOOLEAN] :include_data
1425
+ # @return [ListSubmissionsResponse]
1426
+ def list_submissions_0(template_id, opts = {})
1427
+ data, _status_code, _headers = list_submissions_0_with_http_info(template_id, opts)
1428
+ data
1429
+ end
1430
+
1431
+ # List all submissions for a given template
1432
+ # @param template_id
1433
+ # @param [Hash] opts the optional parameters
1434
+ # @option opts [String] :cursor
1435
+ # @option opts [Float] :limit
1436
+ # @option opts [String] :created_after
1437
+ # @option opts [String] :created_before
1438
+ # @option opts [String] :type
1439
+ # @option opts [BOOLEAN] :include_data
1440
+ # @return [Array<(ListSubmissionsResponse, Fixnum, Hash)>] ListSubmissionsResponse data, response status code and response headers
1441
+ def list_submissions_0_with_http_info(template_id, opts = {})
1442
+ if @api_client.config.debugging
1443
+ @api_client.config.logger.debug 'Calling API: PDFApi.list_submissions_0 ...'
1444
+ end
1445
+ # verify the required parameter 'template_id' is set
1446
+ if @api_client.config.client_side_validation && template_id.nil?
1447
+ fail ArgumentError, "Missing the required parameter 'template_id' when calling PDFApi.list_submissions_0"
1448
+ end
1449
+ # resource path
1450
+ local_var_path = '/templates/{template_id}/submissions'.sub('{' + 'template_id' + '}', template_id.to_s)
1451
+
1452
+ # query parameters
1453
+ query_params = {}
1454
+ query_params[:'cursor'] = opts[:'cursor'] if !opts[:'cursor'].nil?
1455
+ query_params[:'limit'] = opts[:'limit'] if !opts[:'limit'].nil?
1456
+ query_params[:'created_after'] = opts[:'created_after'] if !opts[:'created_after'].nil?
1457
+ query_params[:'created_before'] = opts[:'created_before'] if !opts[:'created_before'].nil?
1458
+ query_params[:'type'] = opts[:'type'] if !opts[:'type'].nil?
1459
+ query_params[:'include_data'] = opts[:'include_data'] if !opts[:'include_data'].nil?
1460
+
1461
+ # header parameters
1462
+ header_params = {}
1463
+ # HTTP header 'Accept' (if needed)
1464
+ header_params['Accept'] = @api_client.select_header_accept(['application/json'])
1465
+
1466
+ # form parameters
1467
+ form_params = {}
1468
+
1469
+ # http body (model)
1470
+ post_body = nil
1471
+ auth_names = ['api_token_basic']
1472
+ data, status_code, headers = @api_client.call_api(:GET, local_var_path,
1473
+ :header_params => header_params,
1474
+ :query_params => query_params,
1475
+ :form_params => form_params,
1476
+ :body => post_body,
1477
+ :auth_names => auth_names,
1478
+ :return_type => 'ListSubmissionsResponse')
1479
+ if @api_client.config.debugging
1480
+ @api_client.config.logger.debug "API called: PDFApi#list_submissions_0\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
1481
+ end
1482
+ return data, status_code, headers
1483
+ end
1484
+
1243
1485
  # Get a list of all templates
1244
1486
  # @param [Hash] opts the optional parameters
1245
1487
  # @option opts [String] :query Search By Name
@@ -281,7 +281,7 @@ module DocSpring
281
281
  def build_request_url(path)
282
282
  # Add leading and trailing slashes to path
283
283
  path = "/#{path}".gsub(/\/+/, '/')
284
- URI.encode(@config.base_url + path)
284
+ @config.base_url + path
285
285
  end
286
286
 
287
287
  # Builds the HTTP request body
@@ -195,8 +195,7 @@ module DocSpring
195
195
  end
196
196
 
197
197
  def base_url
198
- url = "#{scheme}://#{[host, base_path].join('/').gsub(/\/+/, '/')}".sub(/\/+\z/, '')
199
- URI.encode(url)
198
+ "#{scheme}://#{[host, base_path].join('/').gsub(/\/+/, '/')}".sub(/\/+\z/, '')
200
199
  end
201
200
 
202
201
  # Gets API key (with prefix if set).
@@ -20,6 +20,8 @@ module DocSpring
20
20
 
21
21
  attr_accessor :metadata
22
22
 
23
+ attr_accessor :password
24
+
23
25
  attr_accessor :source_pdfs
24
26
 
25
27
  attr_accessor :test
@@ -30,6 +32,7 @@ module DocSpring
30
32
  :'delete_custom_files' => :'delete_custom_files',
31
33
  :'expires_in' => :'expires_in',
32
34
  :'metadata' => :'metadata',
35
+ :'password' => :'password',
33
36
  :'source_pdfs' => :'source_pdfs',
34
37
  :'test' => :'test'
35
38
  }
@@ -41,6 +44,7 @@ module DocSpring
41
44
  :'delete_custom_files' => :'BOOLEAN',
42
45
  :'expires_in' => :'Integer',
43
46
  :'metadata' => :'Object',
47
+ :'password' => :'String',
44
48
  :'source_pdfs' => :'Array<Object>',
45
49
  :'test' => :'BOOLEAN'
46
50
  }
@@ -66,6 +70,10 @@ module DocSpring
66
70
  self.metadata = attributes[:'metadata']
67
71
  end
68
72
 
73
+ if attributes.has_key?(:'password')
74
+ self.password = attributes[:'password']
75
+ end
76
+
69
77
  if attributes.has_key?(:'source_pdfs')
70
78
  if (value = attributes[:'source_pdfs']).is_a?(Array)
71
79
  self.source_pdfs = value
@@ -103,6 +111,7 @@ module DocSpring
103
111
  delete_custom_files == o.delete_custom_files &&
104
112
  expires_in == o.expires_in &&
105
113
  metadata == o.metadata &&
114
+ password == o.password &&
106
115
  source_pdfs == o.source_pdfs &&
107
116
  test == o.test
108
117
  end
@@ -116,7 +125,7 @@ module DocSpring
116
125
  # Calculates hash code according to all attributes.
117
126
  # @return [Fixnum] Hash code
118
127
  def hash
119
- [delete_custom_files, expires_in, metadata, source_pdfs, test].hash
128
+ [delete_custom_files, expires_in, metadata, password, source_pdfs, test].hash
120
129
  end
121
130
 
122
131
  # Builds the object from hash
@@ -16,6 +16,8 @@ module DocSpring
16
16
  class CombinedSubmission
17
17
  attr_accessor :metadata
18
18
 
19
+ attr_accessor :password
20
+
19
21
  attr_accessor :expired
20
22
 
21
23
  attr_accessor :expires_at
@@ -60,6 +62,7 @@ module DocSpring
60
62
  def self.attribute_map
61
63
  {
62
64
  :'metadata' => :'metadata',
65
+ :'password' => :'password',
63
66
  :'expired' => :'expired',
64
67
  :'expires_at' => :'expires_at',
65
68
  :'source_pdfs' => :'source_pdfs',
@@ -76,6 +79,7 @@ module DocSpring
76
79
  def self.openapi_types
77
80
  {
78
81
  :'metadata' => :'Object',
82
+ :'password' => :'String',
79
83
  :'expired' => :'BOOLEAN',
80
84
  :'expires_at' => :'String',
81
85
  :'source_pdfs' => :'Array<Object>',
@@ -100,6 +104,10 @@ module DocSpring
100
104
  self.metadata = attributes[:'metadata']
101
105
  end
102
106
 
107
+ if attributes.has_key?(:'password')
108
+ self.password = attributes[:'password']
109
+ end
110
+
103
111
  if attributes.has_key?(:'expired')
104
112
  self.expired = attributes[:'expired']
105
113
  end
@@ -174,6 +182,7 @@ module DocSpring
174
182
  return true if self.equal?(o)
175
183
  self.class == o.class &&
176
184
  metadata == o.metadata &&
185
+ password == o.password &&
177
186
  expired == o.expired &&
178
187
  expires_at == o.expires_at &&
179
188
  source_pdfs == o.source_pdfs &&
@@ -194,7 +203,7 @@ module DocSpring
194
203
  # Calculates hash code according to all attributes.
195
204
  # @return [Fixnum] Hash code
196
205
  def hash
197
- [metadata, expired, expires_at, source_pdfs, pdf_hash, download_url, submission_ids, id, state, actions].hash
206
+ [metadata, password, expired, expires_at, source_pdfs, pdf_hash, download_url, submission_ids, id, state, actions].hash
198
207
  end
199
208
 
200
209
  # Builds the object from hash
@@ -18,6 +18,8 @@ module DocSpring
18
18
 
19
19
  attr_accessor :metadata
20
20
 
21
+ attr_accessor :password
22
+
21
23
  attr_accessor :submission_ids
22
24
 
23
25
  attr_accessor :test
@@ -27,6 +29,7 @@ module DocSpring
27
29
  {
28
30
  :'expires_in' => :'expires_in',
29
31
  :'metadata' => :'metadata',
32
+ :'password' => :'password',
30
33
  :'submission_ids' => :'submission_ids',
31
34
  :'test' => :'test'
32
35
  }
@@ -37,6 +40,7 @@ module DocSpring
37
40
  {
38
41
  :'expires_in' => :'Integer',
39
42
  :'metadata' => :'Object',
43
+ :'password' => :'String',
40
44
  :'submission_ids' => :'Array<String>',
41
45
  :'test' => :'BOOLEAN'
42
46
  }
@@ -58,6 +62,10 @@ module DocSpring
58
62
  self.metadata = attributes[:'metadata']
59
63
  end
60
64
 
65
+ if attributes.has_key?(:'password')
66
+ self.password = attributes[:'password']
67
+ end
68
+
61
69
  if attributes.has_key?(:'submission_ids')
62
70
  if (value = attributes[:'submission_ids']).is_a?(Array)
63
71
  self.submission_ids = value
@@ -94,6 +102,7 @@ module DocSpring
94
102
  self.class == o.class &&
95
103
  expires_in == o.expires_in &&
96
104
  metadata == o.metadata &&
105
+ password == o.password &&
97
106
  submission_ids == o.submission_ids &&
98
107
  test == o.test
99
108
  end
@@ -107,7 +116,7 @@ module DocSpring
107
116
  # Calculates hash code according to all attributes.
108
117
  # @return [Fixnum] Hash code
109
118
  def hash
110
- [expires_in, metadata, submission_ids, test].hash
119
+ [expires_in, metadata, password, submission_ids, test].hash
111
120
  end
112
121
 
113
122
  # Builds the object from hash
@@ -0,0 +1,197 @@
1
+ =begin
2
+ #API v1
3
+
4
+ #DocSpring is a service that helps you fill out and sign PDF templates.
5
+
6
+ OpenAPI spec version: v1
7
+
8
+ Generated by: https://openapi-generator.tech
9
+ OpenAPI Generator version: 3.3.0
10
+
11
+ =end
12
+
13
+ require 'date'
14
+
15
+ module DocSpring
16
+ class CopyTemplateData
17
+ attr_accessor :name
18
+
19
+ attr_accessor :parent_folder_id
20
+
21
+ # Attribute mapping from ruby-style variable name to JSON key.
22
+ def self.attribute_map
23
+ {
24
+ :'name' => :'name',
25
+ :'parent_folder_id' => :'parent_folder_id'
26
+ }
27
+ end
28
+
29
+ # Attribute type mapping.
30
+ def self.openapi_types
31
+ {
32
+ :'name' => :'String',
33
+ :'parent_folder_id' => :'String'
34
+ }
35
+ end
36
+
37
+ # Initializes the object
38
+ # @param [Hash] attributes Model attributes in the form of hash
39
+ def initialize(attributes = {})
40
+ return unless attributes.is_a?(Hash)
41
+
42
+ # convert string to symbol for hash key
43
+ attributes = attributes.each_with_object({}) { |(k, v), h| h[k.to_sym] = v }
44
+
45
+ if attributes.has_key?(:'name')
46
+ self.name = attributes[:'name']
47
+ end
48
+
49
+ if attributes.has_key?(:'parent_folder_id')
50
+ self.parent_folder_id = attributes[:'parent_folder_id']
51
+ end
52
+ end
53
+
54
+ # Show invalid properties with the reasons. Usually used together with valid?
55
+ # @return Array for valid properties with the reasons
56
+ def list_invalid_properties
57
+ invalid_properties = Array.new
58
+ if @parent_folder_id.nil?
59
+ invalid_properties.push('invalid value for "parent_folder_id", parent_folder_id cannot be nil.')
60
+ end
61
+
62
+ invalid_properties
63
+ end
64
+
65
+ # Check to see if the all the properties in the model are valid
66
+ # @return true if the model is valid
67
+ def valid?
68
+ return false if @parent_folder_id.nil?
69
+ true
70
+ end
71
+
72
+ # Checks equality by comparing each attribute.
73
+ # @param [Object] Object to be compared
74
+ def ==(o)
75
+ return true if self.equal?(o)
76
+ self.class == o.class &&
77
+ name == o.name &&
78
+ parent_folder_id == o.parent_folder_id
79
+ end
80
+
81
+ # @see the `==` method
82
+ # @param [Object] Object to be compared
83
+ def eql?(o)
84
+ self == o
85
+ end
86
+
87
+ # Calculates hash code according to all attributes.
88
+ # @return [Fixnum] Hash code
89
+ def hash
90
+ [name, parent_folder_id].hash
91
+ end
92
+
93
+ # Builds the object from hash
94
+ # @param [Hash] attributes Model attributes in the form of hash
95
+ # @return [Object] Returns the model itself
96
+ def build_from_hash(attributes)
97
+ return nil unless attributes.is_a?(Hash)
98
+ self.class.openapi_types.each_pair do |key, type|
99
+ if type =~ /\AArray<(.*)>/i
100
+ # check to ensure the input is an array given that the the attribute
101
+ # is documented as an array but the input is not
102
+ if attributes[self.class.attribute_map[key]].is_a?(Array)
103
+ self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
104
+ end
105
+ elsif !attributes[self.class.attribute_map[key]].nil?
106
+ self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
107
+ end # or else data not found in attributes(hash), not an issue as the data can be optional
108
+ end
109
+
110
+ self
111
+ end
112
+
113
+ # Deserializes the data based on type
114
+ # @param string type Data type
115
+ # @param string value Value to be deserialized
116
+ # @return [Object] Deserialized data
117
+ def _deserialize(type, value)
118
+ case type.to_sym
119
+ when :DateTime
120
+ DateTime.parse(value)
121
+ when :Date
122
+ Date.parse(value)
123
+ when :String
124
+ value.to_s
125
+ when :Integer
126
+ value.to_i
127
+ when :Float
128
+ value.to_f
129
+ when :BOOLEAN
130
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
131
+ true
132
+ else
133
+ false
134
+ end
135
+ when :Object
136
+ # generic object (usually a Hash), return directly
137
+ value
138
+ when /\AArray<(?<inner_type>.+)>\z/
139
+ inner_type = Regexp.last_match[:inner_type]
140
+ value.map { |v| _deserialize(inner_type, v) }
141
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
142
+ k_type = Regexp.last_match[:k_type]
143
+ v_type = Regexp.last_match[:v_type]
144
+ {}.tap do |hash|
145
+ value.each do |k, v|
146
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
147
+ end
148
+ end
149
+ else # model
150
+ temp_model = DocSpring.const_get(type).new
151
+ temp_model.build_from_hash(value)
152
+ end
153
+ end
154
+
155
+ # Returns the string representation of the object
156
+ # @return [String] String presentation of the object
157
+ def to_s
158
+ to_hash.to_s
159
+ end
160
+
161
+ # to_body is an alias to to_hash (backward compatibility)
162
+ # @return [Hash] Returns the object in the form of hash
163
+ def to_body
164
+ to_hash
165
+ end
166
+
167
+ # Returns the object in the form of hash
168
+ # @return [Hash] Returns the object in the form of hash
169
+ def to_hash
170
+ hash = {}
171
+ self.class.attribute_map.each_pair do |attr, param|
172
+ value = self.send(attr)
173
+ next if value.nil?
174
+ hash[param] = _to_hash(value)
175
+ end
176
+ hash
177
+ end
178
+
179
+ # Outputs non-array value in the form of hash
180
+ # For object, use to_hash. Otherwise, just return the value
181
+ # @param [Object] value Any valid value
182
+ # @return [Hash] Returns the value in the form of hash
183
+ def _to_hash(value)
184
+ if value.is_a?(Array)
185
+ value.compact.map { |v| _to_hash(v) }
186
+ elsif value.is_a?(Hash)
187
+ {}.tap do |hash|
188
+ value.each { |k, v| hash[k] = _to_hash(v) }
189
+ end
190
+ elsif value.respond_to? :to_hash
191
+ value.to_hash
192
+ else
193
+ value
194
+ end
195
+ end
196
+ end
197
+ end