docspring 1.1.0 → 1.2.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +4 -0
- data/Gemfile.lock +1 -1
- data/README.md +20 -15
- data/docs/AddFieldsData.md +8 -0
- data/docs/AddFieldsTemplateResponse.md +10 -0
- data/docs/CreateHtmlTemplateData.md +8 -0
- data/docs/CreateTemplateFromUploadData.md +8 -0
- data/docs/{TemplatesdesccachedUploadTemplate.md → HtmlTemplateData.md} +1 -2
- data/docs/PDFApi.md +60 -8
- data/docs/PendingTemplate.md +1 -0
- data/docs/Submission.md +1 -0
- data/docs/Template.md +1 -0
- data/docs/{TemplatestemplateIdTemplate.md → TemplateData.md} +1 -1
- data/docs/TemplatestemplateIdaddFieldsFields.md +92 -0
- data/docs/UpdateTemplateData.md +1 -1
- data/docs/UploadTemplateData.md +25 -0
- data/docs/UploadTemplateDataDocument.md +10 -0
- data/docs/{TemplatesdesccachedUploadTemplateDocumentMetadata.md → UploadTemplateDataDocumentMetadata.md} +1 -1
- data/lib/docspring.rb +10 -6
- data/lib/docspring/api/pdf_api.rb +77 -18
- data/lib/docspring/models/add_fields_data.rb +190 -0
- data/lib/docspring/models/add_fields_template_response.rb +239 -0
- data/lib/docspring/models/{create_template_data.rb → create_html_template_data.rb} +2 -2
- data/lib/docspring/models/{create_template_data1.rb → create_template_from_upload_data.rb} +2 -2
- data/lib/docspring/models/html_template_data.rb +373 -0
- data/lib/docspring/models/pending_template.rb +10 -1
- data/lib/docspring/models/submission.rb +10 -1
- data/lib/docspring/models/template.rb +10 -1
- data/lib/docspring/models/{templatestemplate_id_template.rb → template_data.rb} +1 -1
- data/lib/docspring/models/templatestemplate_idadd_fields_fields.rb +1306 -0
- data/lib/docspring/models/update_template_data.rb +1 -1
- data/lib/docspring/models/{templatesdesccached_upload_template.rb → upload_template_data.rb} +2 -2
- data/lib/docspring/models/{templatesdesccached_upload_template_document.rb → upload_template_data_document.rb} +2 -2
- data/lib/docspring/models/{templatesdesccached_upload_template_document_metadata.rb → upload_template_data_document_metadata.rb} +1 -1
- data/lib/docspring/version.rb +1 -1
- data/spec/api/pdf_api_integration_spec.rb +49 -18
- data/spec/api/pdf_api_spec_original.skipped.rb +20 -6
- data/spec/models/add_fields_data_spec.rb +41 -0
- data/spec/models/add_fields_template_response_spec.rb +57 -0
- data/spec/models/{create_template_data_spec.rb → create_html_template_data_spec.rb} +6 -6
- data/spec/models/{create_template_data1_spec.rb → create_template_from_upload_data_spec.rb} +6 -6
- data/spec/models/html_template_data_spec.rb +145 -0
- data/spec/models/pending_template_spec.rb +6 -0
- data/spec/models/submission_spec.rb +6 -0
- data/spec/models/{templatestemplate_id_template_spec.rb → template_data_spec.rb} +6 -6
- data/spec/models/template_spec.rb +6 -0
- data/spec/models/templatestemplate_idadd_fields_fields_spec.rb +589 -0
- data/spec/models/{templatesdesccached_upload_template_document_metadata_spec.rb → upload_template_data_document_metadata_spec.rb} +6 -6
- data/spec/models/{templatesdesccached_upload_template_document_spec.rb → upload_template_data_document_spec.rb} +6 -6
- data/spec/models/{templatesdesccached_upload_template_spec.rb → upload_template_data_spec.rb} +6 -6
- metadata +42 -26
- data/docs/CreateTemplateData.md +0 -8
- data/docs/CreateTemplateData1.md +0 -8
- data/docs/TemplatesdesccachedUploadTemplateDocument.md +0 -10
@@ -0,0 +1,25 @@
|
|
1
|
+
# DocSpring::UploadTemplateData
|
2
|
+
|
3
|
+
## Properties
|
4
|
+
Name | Type | Description | Notes
|
5
|
+
------------ | ------------- | ------------- | -------------
|
6
|
+
**expiration_interval** | **String** | | [optional]
|
7
|
+
**webhook_url** | **String** | | [optional]
|
8
|
+
**scss** | **String** | | [optional]
|
9
|
+
**expire_after** | **Float** | | [optional]
|
10
|
+
**allow_additional_properties** | **BOOLEAN** | | [optional]
|
11
|
+
**document** | [**UploadTemplateDataDocument**](UploadTemplateDataDocument.md) | | [optional]
|
12
|
+
**description** | **String** | | [optional]
|
13
|
+
**public_submissions** | **BOOLEAN** | | [optional]
|
14
|
+
**slack_webhook_url** | **String** | | [optional]
|
15
|
+
**header_html** | **String** | | [optional]
|
16
|
+
**public_web_form** | **BOOLEAN** | | [optional]
|
17
|
+
**editable_submissions** | **BOOLEAN** | | [optional]
|
18
|
+
**expire_submissions** | **BOOLEAN** | | [optional]
|
19
|
+
**name** | **String** | | [optional]
|
20
|
+
**html** | **String** | | [optional]
|
21
|
+
**footer_html** | **String** | | [optional]
|
22
|
+
**template_type** | **String** | | [optional]
|
23
|
+
**redirect_url** | **String** | | [optional]
|
24
|
+
|
25
|
+
|
@@ -0,0 +1,10 @@
|
|
1
|
+
# DocSpring::UploadTemplateDataDocument
|
2
|
+
|
3
|
+
## Properties
|
4
|
+
Name | Type | Description | Notes
|
5
|
+
------------ | ------------- | ------------- | -------------
|
6
|
+
**metadata** | [**UploadTemplateDataDocumentMetadata**](UploadTemplateDataDocumentMetadata.md) | | [optional]
|
7
|
+
**id** | **String** | | [optional]
|
8
|
+
**storage** | **String** | | [optional]
|
9
|
+
|
10
|
+
|
data/lib/docspring.rb
CHANGED
@@ -17,6 +17,8 @@ require 'docspring/version'
|
|
17
17
|
require 'docspring/configuration'
|
18
18
|
|
19
19
|
# Models
|
20
|
+
require 'docspring/models/add_fields_data'
|
21
|
+
require 'docspring/models/add_fields_template_response'
|
20
22
|
require 'docspring/models/authentication_error'
|
21
23
|
require 'docspring/models/authentication_success_response'
|
22
24
|
require 'docspring/models/combine_pdfs_data'
|
@@ -27,18 +29,19 @@ require 'docspring/models/create_combined_submission_response'
|
|
27
29
|
require 'docspring/models/create_custom_file_data'
|
28
30
|
require 'docspring/models/create_custom_file_response'
|
29
31
|
require 'docspring/models/create_folder_data'
|
32
|
+
require 'docspring/models/create_html_template_data'
|
30
33
|
require 'docspring/models/create_submission_batch_response'
|
31
34
|
require 'docspring/models/create_submission_batch_submissions_response'
|
32
35
|
require 'docspring/models/create_submission_data_request_data'
|
33
36
|
require 'docspring/models/create_submission_data_request_token_response'
|
34
37
|
require 'docspring/models/create_submission_data_request_token_response_token'
|
35
38
|
require 'docspring/models/create_submission_response'
|
36
|
-
require 'docspring/models/
|
37
|
-
require 'docspring/models/create_template_data1'
|
39
|
+
require 'docspring/models/create_template_from_upload_data'
|
38
40
|
require 'docspring/models/custom_file'
|
39
41
|
require 'docspring/models/error'
|
40
42
|
require 'docspring/models/folder'
|
41
43
|
require 'docspring/models/folders_folder'
|
44
|
+
require 'docspring/models/html_template_data'
|
42
45
|
require 'docspring/models/invalid_request'
|
43
46
|
require 'docspring/models/move_folder_data'
|
44
47
|
require 'docspring/models/move_template_data'
|
@@ -52,14 +55,15 @@ require 'docspring/models/submission_data'
|
|
52
55
|
require 'docspring/models/submission_data_batch_request'
|
53
56
|
require 'docspring/models/submission_data_request'
|
54
57
|
require 'docspring/models/template'
|
55
|
-
require 'docspring/models/
|
56
|
-
require 'docspring/models/
|
57
|
-
require 'docspring/models/templatesdesccached_upload_template_document_metadata'
|
58
|
-
require 'docspring/models/templatestemplate_id_template'
|
58
|
+
require 'docspring/models/template_data'
|
59
|
+
require 'docspring/models/templatestemplate_idadd_fields_fields'
|
59
60
|
require 'docspring/models/update_data_request_response'
|
60
61
|
require 'docspring/models/update_submission_data_request_data'
|
61
62
|
require 'docspring/models/update_template_data'
|
62
63
|
require 'docspring/models/update_template_response'
|
64
|
+
require 'docspring/models/upload_template_data'
|
65
|
+
require 'docspring/models/upload_template_data_document'
|
66
|
+
require 'docspring/models/upload_template_data_document_metadata'
|
63
67
|
|
64
68
|
# APIs
|
65
69
|
require 'docspring/api/pdf_api'
|
@@ -19,6 +19,65 @@ module DocSpring
|
|
19
19
|
def initialize(api_client = ApiClient.default)
|
20
20
|
@api_client = api_client
|
21
21
|
end
|
22
|
+
# Add new fields to a Template
|
23
|
+
# @param template_id
|
24
|
+
# @param add_fields_data
|
25
|
+
# @param [Hash] opts the optional parameters
|
26
|
+
# @return [AddFieldsTemplateResponse]
|
27
|
+
def add_fields_to_template(template_id, add_fields_data, opts = {})
|
28
|
+
data, _status_code, _headers = add_fields_to_template_with_http_info(template_id, add_fields_data, opts)
|
29
|
+
data
|
30
|
+
end
|
31
|
+
|
32
|
+
# Add new fields to a Template
|
33
|
+
# @param template_id
|
34
|
+
# @param add_fields_data
|
35
|
+
# @param [Hash] opts the optional parameters
|
36
|
+
# @return [Array<(AddFieldsTemplateResponse, Fixnum, Hash)>] AddFieldsTemplateResponse data, response status code and response headers
|
37
|
+
def add_fields_to_template_with_http_info(template_id, add_fields_data, opts = {})
|
38
|
+
if @api_client.config.debugging
|
39
|
+
@api_client.config.logger.debug 'Calling API: PDFApi.add_fields_to_template ...'
|
40
|
+
end
|
41
|
+
# verify the required parameter 'template_id' is set
|
42
|
+
if @api_client.config.client_side_validation && template_id.nil?
|
43
|
+
fail ArgumentError, "Missing the required parameter 'template_id' when calling PDFApi.add_fields_to_template"
|
44
|
+
end
|
45
|
+
# verify the required parameter 'add_fields_data' is set
|
46
|
+
if @api_client.config.client_side_validation && add_fields_data.nil?
|
47
|
+
fail ArgumentError, "Missing the required parameter 'add_fields_data' when calling PDFApi.add_fields_to_template"
|
48
|
+
end
|
49
|
+
# resource path
|
50
|
+
local_var_path = '/templates/{template_id}/add_fields'.sub('{' + 'template_id' + '}', template_id.to_s)
|
51
|
+
|
52
|
+
# query parameters
|
53
|
+
query_params = {}
|
54
|
+
|
55
|
+
# header parameters
|
56
|
+
header_params = {}
|
57
|
+
# HTTP header 'Accept' (if needed)
|
58
|
+
header_params['Accept'] = @api_client.select_header_accept(['application/json'])
|
59
|
+
# HTTP header 'Content-Type'
|
60
|
+
header_params['Content-Type'] = @api_client.select_header_content_type(['application/json'])
|
61
|
+
|
62
|
+
# form parameters
|
63
|
+
form_params = {}
|
64
|
+
|
65
|
+
# http body (model)
|
66
|
+
post_body = @api_client.object_to_http_body(add_fields_data)
|
67
|
+
auth_names = ['api_token_basic']
|
68
|
+
data, status_code, headers = @api_client.call_api(:PUT, local_var_path,
|
69
|
+
:header_params => header_params,
|
70
|
+
:query_params => query_params,
|
71
|
+
:form_params => form_params,
|
72
|
+
:body => post_body,
|
73
|
+
:auth_names => auth_names,
|
74
|
+
:return_type => 'AddFieldsTemplateResponse')
|
75
|
+
if @api_client.config.debugging
|
76
|
+
@api_client.config.logger.debug "API called: PDFApi#add_fields_to_template\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
|
77
|
+
end
|
78
|
+
return data, status_code, headers
|
79
|
+
end
|
80
|
+
|
22
81
|
# Generates multiple PDFs
|
23
82
|
# @param template_id
|
24
83
|
# @param request_body
|
@@ -395,25 +454,25 @@ module DocSpring
|
|
395
454
|
end
|
396
455
|
|
397
456
|
# Create a new HTML template
|
398
|
-
# @param
|
457
|
+
# @param create_html_template_data
|
399
458
|
# @param [Hash] opts the optional parameters
|
400
459
|
# @return [PendingTemplate]
|
401
|
-
def create_html_template(
|
402
|
-
data, _status_code, _headers = create_html_template_with_http_info(
|
460
|
+
def create_html_template(create_html_template_data, opts = {})
|
461
|
+
data, _status_code, _headers = create_html_template_with_http_info(create_html_template_data, opts)
|
403
462
|
data
|
404
463
|
end
|
405
464
|
|
406
465
|
# Create a new HTML template
|
407
|
-
# @param
|
466
|
+
# @param create_html_template_data
|
408
467
|
# @param [Hash] opts the optional parameters
|
409
468
|
# @return [Array<(PendingTemplate, Fixnum, Hash)>] PendingTemplate data, response status code and response headers
|
410
|
-
def create_html_template_with_http_info(
|
469
|
+
def create_html_template_with_http_info(create_html_template_data, opts = {})
|
411
470
|
if @api_client.config.debugging
|
412
471
|
@api_client.config.logger.debug 'Calling API: PDFApi.create_html_template ...'
|
413
472
|
end
|
414
|
-
# verify the required parameter '
|
415
|
-
if @api_client.config.client_side_validation &&
|
416
|
-
fail ArgumentError, "Missing the required parameter '
|
473
|
+
# verify the required parameter 'create_html_template_data' is set
|
474
|
+
if @api_client.config.client_side_validation && create_html_template_data.nil?
|
475
|
+
fail ArgumentError, "Missing the required parameter 'create_html_template_data' when calling PDFApi.create_html_template"
|
417
476
|
end
|
418
477
|
# resource path
|
419
478
|
local_var_path = '/templates?desc=html'
|
@@ -432,7 +491,7 @@ module DocSpring
|
|
432
491
|
form_params = {}
|
433
492
|
|
434
493
|
# http body (model)
|
435
|
-
post_body = @api_client.object_to_http_body(
|
494
|
+
post_body = @api_client.object_to_http_body(create_html_template_data)
|
436
495
|
auth_names = ['api_token_basic']
|
437
496
|
data, status_code, headers = @api_client.call_api(:POST, local_var_path,
|
438
497
|
:header_params => header_params,
|
@@ -512,25 +571,25 @@ module DocSpring
|
|
512
571
|
end
|
513
572
|
|
514
573
|
# Create a new PDF template from a cached presign upload
|
515
|
-
# @param
|
574
|
+
# @param create_template_from_upload_data
|
516
575
|
# @param [Hash] opts the optional parameters
|
517
576
|
# @return [PendingTemplate]
|
518
|
-
def create_pdf_template_from_upload(
|
519
|
-
data, _status_code, _headers = create_pdf_template_from_upload_with_http_info(
|
577
|
+
def create_pdf_template_from_upload(create_template_from_upload_data, opts = {})
|
578
|
+
data, _status_code, _headers = create_pdf_template_from_upload_with_http_info(create_template_from_upload_data, opts)
|
520
579
|
data
|
521
580
|
end
|
522
581
|
|
523
582
|
# Create a new PDF template from a cached presign upload
|
524
|
-
# @param
|
583
|
+
# @param create_template_from_upload_data
|
525
584
|
# @param [Hash] opts the optional parameters
|
526
585
|
# @return [Array<(PendingTemplate, Fixnum, Hash)>] PendingTemplate data, response status code and response headers
|
527
|
-
def create_pdf_template_from_upload_with_http_info(
|
586
|
+
def create_pdf_template_from_upload_with_http_info(create_template_from_upload_data, opts = {})
|
528
587
|
if @api_client.config.debugging
|
529
588
|
@api_client.config.logger.debug 'Calling API: PDFApi.create_pdf_template_from_upload ...'
|
530
589
|
end
|
531
|
-
# verify the required parameter '
|
532
|
-
if @api_client.config.client_side_validation &&
|
533
|
-
fail ArgumentError, "Missing the required parameter '
|
590
|
+
# verify the required parameter 'create_template_from_upload_data' is set
|
591
|
+
if @api_client.config.client_side_validation && create_template_from_upload_data.nil?
|
592
|
+
fail ArgumentError, "Missing the required parameter 'create_template_from_upload_data' when calling PDFApi.create_pdf_template_from_upload"
|
534
593
|
end
|
535
594
|
# resource path
|
536
595
|
local_var_path = '/templates?desc=cached_upload'
|
@@ -549,7 +608,7 @@ module DocSpring
|
|
549
608
|
form_params = {}
|
550
609
|
|
551
610
|
# http body (model)
|
552
|
-
post_body = @api_client.object_to_http_body(
|
611
|
+
post_body = @api_client.object_to_http_body(create_template_from_upload_data)
|
553
612
|
auth_names = ['api_token_basic']
|
554
613
|
data, status_code, headers = @api_client.call_api(:POST, local_var_path,
|
555
614
|
:header_params => header_params,
|
@@ -0,0 +1,190 @@
|
|
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-SNAPSHOT
|
10
|
+
|
11
|
+
=end
|
12
|
+
|
13
|
+
require 'date'
|
14
|
+
|
15
|
+
module DocSpring
|
16
|
+
class AddFieldsData
|
17
|
+
attr_accessor :fields
|
18
|
+
|
19
|
+
# Attribute mapping from ruby-style variable name to JSON key.
|
20
|
+
def self.attribute_map
|
21
|
+
{
|
22
|
+
:'fields' => :'fields'
|
23
|
+
}
|
24
|
+
end
|
25
|
+
|
26
|
+
# Attribute type mapping.
|
27
|
+
def self.openapi_types
|
28
|
+
{
|
29
|
+
:'fields' => :'Array<TemplatestemplateIdaddFieldsFields>'
|
30
|
+
}
|
31
|
+
end
|
32
|
+
|
33
|
+
# Initializes the object
|
34
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
35
|
+
def initialize(attributes = {})
|
36
|
+
return unless attributes.is_a?(Hash)
|
37
|
+
|
38
|
+
# convert string to symbol for hash key
|
39
|
+
attributes = attributes.each_with_object({}) { |(k, v), h| h[k.to_sym] = v }
|
40
|
+
|
41
|
+
if attributes.has_key?(:'fields')
|
42
|
+
if (value = attributes[:'fields']).is_a?(Array)
|
43
|
+
self.fields = value
|
44
|
+
end
|
45
|
+
end
|
46
|
+
end
|
47
|
+
|
48
|
+
# Show invalid properties with the reasons. Usually used together with valid?
|
49
|
+
# @return Array for valid properties with the reasons
|
50
|
+
def list_invalid_properties
|
51
|
+
invalid_properties = Array.new
|
52
|
+
if @fields.nil?
|
53
|
+
invalid_properties.push('invalid value for "fields", fields cannot be nil.')
|
54
|
+
end
|
55
|
+
|
56
|
+
invalid_properties
|
57
|
+
end
|
58
|
+
|
59
|
+
# Check to see if the all the properties in the model are valid
|
60
|
+
# @return true if the model is valid
|
61
|
+
def valid?
|
62
|
+
return false if @fields.nil?
|
63
|
+
true
|
64
|
+
end
|
65
|
+
|
66
|
+
# Checks equality by comparing each attribute.
|
67
|
+
# @param [Object] Object to be compared
|
68
|
+
def ==(o)
|
69
|
+
return true if self.equal?(o)
|
70
|
+
self.class == o.class &&
|
71
|
+
fields == o.fields
|
72
|
+
end
|
73
|
+
|
74
|
+
# @see the `==` method
|
75
|
+
# @param [Object] Object to be compared
|
76
|
+
def eql?(o)
|
77
|
+
self == o
|
78
|
+
end
|
79
|
+
|
80
|
+
# Calculates hash code according to all attributes.
|
81
|
+
# @return [Fixnum] Hash code
|
82
|
+
def hash
|
83
|
+
[fields].hash
|
84
|
+
end
|
85
|
+
|
86
|
+
# Builds the object from hash
|
87
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
88
|
+
# @return [Object] Returns the model itself
|
89
|
+
def build_from_hash(attributes)
|
90
|
+
return nil unless attributes.is_a?(Hash)
|
91
|
+
self.class.openapi_types.each_pair do |key, type|
|
92
|
+
if type =~ /\AArray<(.*)>/i
|
93
|
+
# check to ensure the input is an array given that the the attribute
|
94
|
+
# is documented as an array but the input is not
|
95
|
+
if attributes[self.class.attribute_map[key]].is_a?(Array)
|
96
|
+
self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
|
97
|
+
end
|
98
|
+
elsif !attributes[self.class.attribute_map[key]].nil?
|
99
|
+
self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
|
100
|
+
end # or else data not found in attributes(hash), not an issue as the data can be optional
|
101
|
+
end
|
102
|
+
|
103
|
+
self
|
104
|
+
end
|
105
|
+
|
106
|
+
# Deserializes the data based on type
|
107
|
+
# @param string type Data type
|
108
|
+
# @param string value Value to be deserialized
|
109
|
+
# @return [Object] Deserialized data
|
110
|
+
def _deserialize(type, value)
|
111
|
+
case type.to_sym
|
112
|
+
when :DateTime
|
113
|
+
DateTime.parse(value)
|
114
|
+
when :Date
|
115
|
+
Date.parse(value)
|
116
|
+
when :String
|
117
|
+
value.to_s
|
118
|
+
when :Integer
|
119
|
+
value.to_i
|
120
|
+
when :Float
|
121
|
+
value.to_f
|
122
|
+
when :BOOLEAN
|
123
|
+
if value.to_s =~ /\A(true|t|yes|y|1)\z/i
|
124
|
+
true
|
125
|
+
else
|
126
|
+
false
|
127
|
+
end
|
128
|
+
when :Object
|
129
|
+
# generic object (usually a Hash), return directly
|
130
|
+
value
|
131
|
+
when /\AArray<(?<inner_type>.+)>\z/
|
132
|
+
inner_type = Regexp.last_match[:inner_type]
|
133
|
+
value.map { |v| _deserialize(inner_type, v) }
|
134
|
+
when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
|
135
|
+
k_type = Regexp.last_match[:k_type]
|
136
|
+
v_type = Regexp.last_match[:v_type]
|
137
|
+
{}.tap do |hash|
|
138
|
+
value.each do |k, v|
|
139
|
+
hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
|
140
|
+
end
|
141
|
+
end
|
142
|
+
else # model
|
143
|
+
temp_model = DocSpring.const_get(type).new
|
144
|
+
temp_model.build_from_hash(value)
|
145
|
+
end
|
146
|
+
end
|
147
|
+
|
148
|
+
# Returns the string representation of the object
|
149
|
+
# @return [String] String presentation of the object
|
150
|
+
def to_s
|
151
|
+
to_hash.to_s
|
152
|
+
end
|
153
|
+
|
154
|
+
# to_body is an alias to to_hash (backward compatibility)
|
155
|
+
# @return [Hash] Returns the object in the form of hash
|
156
|
+
def to_body
|
157
|
+
to_hash
|
158
|
+
end
|
159
|
+
|
160
|
+
# Returns the object in the form of hash
|
161
|
+
# @return [Hash] Returns the object in the form of hash
|
162
|
+
def to_hash
|
163
|
+
hash = {}
|
164
|
+
self.class.attribute_map.each_pair do |attr, param|
|
165
|
+
value = self.send(attr)
|
166
|
+
next if value.nil?
|
167
|
+
hash[param] = _to_hash(value)
|
168
|
+
end
|
169
|
+
hash
|
170
|
+
end
|
171
|
+
|
172
|
+
# Outputs non-array value in the form of hash
|
173
|
+
# For object, use to_hash. Otherwise, just return the value
|
174
|
+
# @param [Object] value Any valid value
|
175
|
+
# @return [Hash] Returns the value in the form of hash
|
176
|
+
def _to_hash(value)
|
177
|
+
if value.is_a?(Array)
|
178
|
+
value.compact.map { |v| _to_hash(v) }
|
179
|
+
elsif value.is_a?(Hash)
|
180
|
+
{}.tap do |hash|
|
181
|
+
value.each { |k, v| hash[k] = _to_hash(v) }
|
182
|
+
end
|
183
|
+
elsif value.respond_to? :to_hash
|
184
|
+
value.to_hash
|
185
|
+
else
|
186
|
+
value
|
187
|
+
end
|
188
|
+
end
|
189
|
+
end
|
190
|
+
end
|
@@ -0,0 +1,239 @@
|
|
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-SNAPSHOT
|
10
|
+
|
11
|
+
=end
|
12
|
+
|
13
|
+
require 'date'
|
14
|
+
|
15
|
+
module DocSpring
|
16
|
+
class AddFieldsTemplateResponse
|
17
|
+
attr_accessor :new_field_ids
|
18
|
+
|
19
|
+
attr_accessor :errors
|
20
|
+
|
21
|
+
attr_accessor :status
|
22
|
+
|
23
|
+
class EnumAttributeValidator
|
24
|
+
attr_reader :datatype
|
25
|
+
attr_reader :allowable_values
|
26
|
+
|
27
|
+
def initialize(datatype, allowable_values)
|
28
|
+
@allowable_values = allowable_values.map do |value|
|
29
|
+
case datatype.to_s
|
30
|
+
when /Integer/i
|
31
|
+
value.to_i
|
32
|
+
when /Float/i
|
33
|
+
value.to_f
|
34
|
+
else
|
35
|
+
value
|
36
|
+
end
|
37
|
+
end
|
38
|
+
end
|
39
|
+
|
40
|
+
def valid?(value)
|
41
|
+
!value || allowable_values.include?(value)
|
42
|
+
end
|
43
|
+
end
|
44
|
+
|
45
|
+
# Attribute mapping from ruby-style variable name to JSON key.
|
46
|
+
def self.attribute_map
|
47
|
+
{
|
48
|
+
:'new_field_ids' => :'new_field_ids',
|
49
|
+
:'errors' => :'errors',
|
50
|
+
:'status' => :'status'
|
51
|
+
}
|
52
|
+
end
|
53
|
+
|
54
|
+
# Attribute type mapping.
|
55
|
+
def self.openapi_types
|
56
|
+
{
|
57
|
+
:'new_field_ids' => :'Array<Integer>',
|
58
|
+
:'errors' => :'Array<String>',
|
59
|
+
:'status' => :'String'
|
60
|
+
}
|
61
|
+
end
|
62
|
+
|
63
|
+
# Initializes the object
|
64
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
65
|
+
def initialize(attributes = {})
|
66
|
+
return unless attributes.is_a?(Hash)
|
67
|
+
|
68
|
+
# convert string to symbol for hash key
|
69
|
+
attributes = attributes.each_with_object({}) { |(k, v), h| h[k.to_sym] = v }
|
70
|
+
|
71
|
+
if attributes.has_key?(:'new_field_ids')
|
72
|
+
if (value = attributes[:'new_field_ids']).is_a?(Array)
|
73
|
+
self.new_field_ids = value
|
74
|
+
end
|
75
|
+
end
|
76
|
+
|
77
|
+
if attributes.has_key?(:'errors')
|
78
|
+
if (value = attributes[:'errors']).is_a?(Array)
|
79
|
+
self.errors = value
|
80
|
+
end
|
81
|
+
end
|
82
|
+
|
83
|
+
if attributes.has_key?(:'status')
|
84
|
+
self.status = attributes[:'status']
|
85
|
+
end
|
86
|
+
end
|
87
|
+
|
88
|
+
# Show invalid properties with the reasons. Usually used together with valid?
|
89
|
+
# @return Array for valid properties with the reasons
|
90
|
+
def list_invalid_properties
|
91
|
+
invalid_properties = Array.new
|
92
|
+
invalid_properties
|
93
|
+
end
|
94
|
+
|
95
|
+
# Check to see if the all the properties in the model are valid
|
96
|
+
# @return true if the model is valid
|
97
|
+
def valid?
|
98
|
+
status_validator = EnumAttributeValidator.new('String', ['success', 'error'])
|
99
|
+
return false unless status_validator.valid?(@status)
|
100
|
+
true
|
101
|
+
end
|
102
|
+
|
103
|
+
# Custom attribute writer method checking allowed values (enum).
|
104
|
+
# @param [Object] status Object to be assigned
|
105
|
+
def status=(status)
|
106
|
+
validator = EnumAttributeValidator.new('String', ['success', 'error'])
|
107
|
+
unless validator.valid?(status)
|
108
|
+
fail ArgumentError, 'invalid value for "status", must be one of #{validator.allowable_values}.'
|
109
|
+
end
|
110
|
+
@status = status
|
111
|
+
end
|
112
|
+
|
113
|
+
# Checks equality by comparing each attribute.
|
114
|
+
# @param [Object] Object to be compared
|
115
|
+
def ==(o)
|
116
|
+
return true if self.equal?(o)
|
117
|
+
self.class == o.class &&
|
118
|
+
new_field_ids == o.new_field_ids &&
|
119
|
+
errors == o.errors &&
|
120
|
+
status == o.status
|
121
|
+
end
|
122
|
+
|
123
|
+
# @see the `==` method
|
124
|
+
# @param [Object] Object to be compared
|
125
|
+
def eql?(o)
|
126
|
+
self == o
|
127
|
+
end
|
128
|
+
|
129
|
+
# Calculates hash code according to all attributes.
|
130
|
+
# @return [Fixnum] Hash code
|
131
|
+
def hash
|
132
|
+
[new_field_ids, errors, status].hash
|
133
|
+
end
|
134
|
+
|
135
|
+
# Builds the object from hash
|
136
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
137
|
+
# @return [Object] Returns the model itself
|
138
|
+
def build_from_hash(attributes)
|
139
|
+
return nil unless attributes.is_a?(Hash)
|
140
|
+
self.class.openapi_types.each_pair do |key, type|
|
141
|
+
if type =~ /\AArray<(.*)>/i
|
142
|
+
# check to ensure the input is an array given that the the attribute
|
143
|
+
# is documented as an array but the input is not
|
144
|
+
if attributes[self.class.attribute_map[key]].is_a?(Array)
|
145
|
+
self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
|
146
|
+
end
|
147
|
+
elsif !attributes[self.class.attribute_map[key]].nil?
|
148
|
+
self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
|
149
|
+
end # or else data not found in attributes(hash), not an issue as the data can be optional
|
150
|
+
end
|
151
|
+
|
152
|
+
self
|
153
|
+
end
|
154
|
+
|
155
|
+
# Deserializes the data based on type
|
156
|
+
# @param string type Data type
|
157
|
+
# @param string value Value to be deserialized
|
158
|
+
# @return [Object] Deserialized data
|
159
|
+
def _deserialize(type, value)
|
160
|
+
case type.to_sym
|
161
|
+
when :DateTime
|
162
|
+
DateTime.parse(value)
|
163
|
+
when :Date
|
164
|
+
Date.parse(value)
|
165
|
+
when :String
|
166
|
+
value.to_s
|
167
|
+
when :Integer
|
168
|
+
value.to_i
|
169
|
+
when :Float
|
170
|
+
value.to_f
|
171
|
+
when :BOOLEAN
|
172
|
+
if value.to_s =~ /\A(true|t|yes|y|1)\z/i
|
173
|
+
true
|
174
|
+
else
|
175
|
+
false
|
176
|
+
end
|
177
|
+
when :Object
|
178
|
+
# generic object (usually a Hash), return directly
|
179
|
+
value
|
180
|
+
when /\AArray<(?<inner_type>.+)>\z/
|
181
|
+
inner_type = Regexp.last_match[:inner_type]
|
182
|
+
value.map { |v| _deserialize(inner_type, v) }
|
183
|
+
when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
|
184
|
+
k_type = Regexp.last_match[:k_type]
|
185
|
+
v_type = Regexp.last_match[:v_type]
|
186
|
+
{}.tap do |hash|
|
187
|
+
value.each do |k, v|
|
188
|
+
hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
|
189
|
+
end
|
190
|
+
end
|
191
|
+
else # model
|
192
|
+
temp_model = DocSpring.const_get(type).new
|
193
|
+
temp_model.build_from_hash(value)
|
194
|
+
end
|
195
|
+
end
|
196
|
+
|
197
|
+
# Returns the string representation of the object
|
198
|
+
# @return [String] String presentation of the object
|
199
|
+
def to_s
|
200
|
+
to_hash.to_s
|
201
|
+
end
|
202
|
+
|
203
|
+
# to_body is an alias to to_hash (backward compatibility)
|
204
|
+
# @return [Hash] Returns the object in the form of hash
|
205
|
+
def to_body
|
206
|
+
to_hash
|
207
|
+
end
|
208
|
+
|
209
|
+
# Returns the object in the form of hash
|
210
|
+
# @return [Hash] Returns the object in the form of hash
|
211
|
+
def to_hash
|
212
|
+
hash = {}
|
213
|
+
self.class.attribute_map.each_pair do |attr, param|
|
214
|
+
value = self.send(attr)
|
215
|
+
next if value.nil?
|
216
|
+
hash[param] = _to_hash(value)
|
217
|
+
end
|
218
|
+
hash
|
219
|
+
end
|
220
|
+
|
221
|
+
# Outputs non-array value in the form of hash
|
222
|
+
# For object, use to_hash. Otherwise, just return the value
|
223
|
+
# @param [Object] value Any valid value
|
224
|
+
# @return [Hash] Returns the value in the form of hash
|
225
|
+
def _to_hash(value)
|
226
|
+
if value.is_a?(Array)
|
227
|
+
value.compact.map { |v| _to_hash(v) }
|
228
|
+
elsif value.is_a?(Hash)
|
229
|
+
{}.tap do |hash|
|
230
|
+
value.each { |k, v| hash[k] = _to_hash(v) }
|
231
|
+
end
|
232
|
+
elsif value.respond_to? :to_hash
|
233
|
+
value.to_hash
|
234
|
+
else
|
235
|
+
value
|
236
|
+
end
|
237
|
+
end
|
238
|
+
end
|
239
|
+
end
|