docspring 4.0.0 → 4.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/.openapi-generator/FILES +84 -0
- data/.travis.yml +1 -1
- data/CHANGELOG.md +24 -0
- data/Gemfile.lock +2 -2
- data/README.md +10 -1
- data/docs/AddTemplateFieldsRequest.md +18 -0
- data/docs/Client.md +704 -33
- data/docs/CreateSubmissionBatchRequest.md +2 -0
- data/docs/CreateSubmissionRequest.md +2 -0
- data/docs/CreateTemplateRequest.md +10 -2
- data/docs/Field.md +198 -0
- data/docs/FieldDependency.md +22 -0
- data/docs/FieldDependencyInput.md +22 -0
- data/docs/FieldGroup.md +32 -0
- data/docs/FieldGroupInput.md +30 -0
- data/docs/FieldGroupType.md +15 -0
- data/docs/FieldInput.md +196 -0
- data/docs/FieldType.md +15 -0
- data/docs/GenerateFilesFormat.md +15 -0
- data/docs/GenerateSubmissionFilesRequest.md +18 -0
- data/docs/OutputFormat.md +15 -0
- data/docs/PageImage.md +34 -0
- data/docs/PageImages.md +24 -0
- data/docs/PredefinedField.md +30 -0
- data/docs/PredefinedFieldInput.md +30 -0
- data/docs/RemoveTemplateFieldsRequest.md +18 -0
- data/docs/ReorderTemplateFieldsRequest.md +18 -0
- data/docs/Submission.md +3 -1
- data/docs/SubmissionFiles.md +3 -1
- data/docs/SubmissionInput.md +2 -0
- data/docs/SubmissionValidation.md +24 -0
- data/docs/Template.md +6 -0
- data/docs/TemplateDiff.md +30 -0
- data/docs/TemplateDiffSummary.md +28 -0
- data/docs/TemplateDocument.md +3 -3
- data/docs/TemplateFieldChange.md +24 -0
- data/docs/TemplateFieldChanges.md +24 -0
- data/docs/TemplateFieldDependency.md +1 -1
- data/docs/TemplateFieldDependencyInput.md +1 -1
- data/docs/TemplateFieldMove.md +22 -0
- data/docs/TemplateFields.md +22 -0
- data/docs/TemplatePageImages.md +24 -0
- data/docs/UpdateTemplateDocumentRequest.md +6 -2
- data/docs/UpdateTemplateFieldsRequest.md +18 -0
- data/docs/UpdateTemplateRequest.md +6 -0
- data/docs/ValidateSubmissionRequest.md +38 -0
- data/lib/docspring/api/client.rb +666 -18
- data/lib/docspring/api_client.rb +1 -1
- data/lib/docspring/models/add_template_fields_request.rb +187 -0
- data/lib/docspring/models/create_submission_batch_request.rb +23 -1
- data/lib/docspring/models/create_submission_request.rb +23 -1
- data/lib/docspring/models/create_template_request.rb +48 -3
- data/lib/docspring/models/field.rb +2217 -0
- data/lib/docspring/models/field_dependency.rb +246 -0
- data/lib/docspring/models/field_dependency_input.rb +246 -0
- data/lib/docspring/models/field_group.rb +368 -0
- data/lib/docspring/models/field_group_input.rb +247 -0
- data/lib/docspring/models/field_group_type.rb +41 -0
- data/lib/docspring/models/field_input.rb +1109 -0
- data/lib/docspring/models/field_type.rb +54 -0
- data/lib/docspring/models/generate_files_format.rb +40 -0
- data/lib/docspring/models/generate_submission_files_request.rb +187 -0
- data/lib/docspring/models/output_format.rb +41 -0
- data/lib/docspring/models/page_image.rb +359 -0
- data/lib/docspring/models/page_images.rb +248 -0
- data/lib/docspring/models/predefined_field.rb +287 -0
- data/lib/docspring/models/predefined_field_input.rb +287 -0
- data/lib/docspring/models/remove_template_fields_request.rb +187 -0
- data/lib/docspring/models/reorder_template_fields_request.rb +187 -0
- data/lib/docspring/models/submission.rb +31 -2
- data/lib/docspring/models/submission_files.rb +13 -4
- data/lib/docspring/models/submission_input.rb +23 -1
- data/lib/docspring/models/submission_validation.rb +234 -0
- data/lib/docspring/models/template.rb +74 -1
- data/lib/docspring/models/template_diff.rb +321 -0
- data/lib/docspring/models/template_diff_summary.rb +320 -0
- data/lib/docspring/models/template_document.rb +3 -3
- data/lib/docspring/models/template_document_state.rb +3 -1
- data/lib/docspring/models/template_field_change.rb +266 -0
- data/lib/docspring/models/template_field_changes.rb +274 -0
- data/lib/docspring/models/template_field_dependency.rb +1 -1
- data/lib/docspring/models/template_field_dependency_input.rb +1 -1
- data/lib/docspring/models/template_field_move.rb +239 -0
- data/lib/docspring/models/template_fields.rb +227 -0
- data/lib/docspring/models/template_page_images.rb +254 -0
- data/lib/docspring/models/update_template_document_request.rb +23 -20
- data/lib/docspring/models/update_template_fields_request.rb +187 -0
- data/lib/docspring/models/update_template_request.rb +38 -1
- data/lib/docspring/models/validate_submission_request.rb +288 -0
- data/lib/docspring/request_schemas.json +3364 -1584
- data/lib/docspring/version.rb +1 -1
- data/lib/docspring.rb +28 -0
- data/spec/api/client_spec.rb +128 -9
- data/spec/models/add_template_fields_request_spec.rb +36 -0
- data/spec/models/create_submission_batch_request_spec.rb +6 -0
- data/spec/models/create_submission_request_spec.rb +6 -0
- data/spec/models/create_template_request_spec.rb +24 -0
- data/spec/models/field_dependency_input_spec.rb +48 -0
- data/spec/models/field_dependency_spec.rb +48 -0
- data/spec/models/field_group_input_spec.rb +72 -0
- data/spec/models/field_group_spec.rb +78 -0
- data/spec/models/field_group_type_spec.rb +30 -0
- data/spec/models/field_input_spec.rb +570 -0
- data/spec/models/field_spec.rb +576 -0
- data/spec/models/field_type_spec.rb +30 -0
- data/spec/models/generate_files_format_spec.rb +30 -0
- data/spec/models/generate_submission_files_request_spec.rb +36 -0
- data/spec/models/output_format_spec.rb +30 -0
- data/spec/models/page_image_spec.rb +84 -0
- data/spec/models/page_images_spec.rb +54 -0
- data/spec/models/predefined_field_input_spec.rb +72 -0
- data/spec/models/predefined_field_spec.rb +72 -0
- data/spec/models/remove_template_fields_request_spec.rb +36 -0
- data/spec/models/reorder_template_fields_request_spec.rb +36 -0
- data/spec/models/submission_files_spec.rb +6 -0
- data/spec/models/submission_input_spec.rb +6 -0
- data/spec/models/submission_spec.rb +6 -0
- data/spec/models/submission_validation_spec.rb +54 -0
- data/spec/models/template_diff_spec.rb +72 -0
- data/spec/models/template_diff_summary_spec.rb +66 -0
- data/spec/models/template_field_change_spec.rb +54 -0
- data/spec/models/template_field_changes_spec.rb +54 -0
- data/spec/models/template_field_move_spec.rb +48 -0
- data/spec/models/template_fields_spec.rb +48 -0
- data/spec/models/template_page_images_spec.rb +54 -0
- data/spec/models/template_spec.rb +18 -0
- data/spec/models/update_template_document_request_spec.rb +12 -0
- data/spec/models/update_template_fields_request_spec.rb +36 -0
- data/spec/models/update_template_request_spec.rb +18 -0
- data/spec/models/validate_submission_request_spec.rb +96 -0
- metadata +113 -1
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
=begin
|
|
2
|
+
#DocSpring API
|
|
3
|
+
|
|
4
|
+
#Use DocSpring's API to programmatically fill out PDF forms, convert HTML to PDFs, merge PDFs, or request legally binding e-signatures.
|
|
5
|
+
|
|
6
|
+
The version of the OpenAPI document: v2
|
|
7
|
+
|
|
8
|
+
Generated by: https://openapi-generator.tech
|
|
9
|
+
Generator version: 7.26.0-DOCSPRING
|
|
10
|
+
|
|
11
|
+
=end
|
|
12
|
+
|
|
13
|
+
require 'date'
|
|
14
|
+
require 'time'
|
|
15
|
+
|
|
16
|
+
module DocSpring
|
|
17
|
+
class FieldType
|
|
18
|
+
STRING = "string".freeze
|
|
19
|
+
NUMBER = "number".freeze
|
|
20
|
+
BOOLEAN = "boolean".freeze
|
|
21
|
+
DATE = "date".freeze
|
|
22
|
+
ADDRESS = "address".freeze
|
|
23
|
+
COUNTRY = "country".freeze
|
|
24
|
+
EMAIL = "email".freeze
|
|
25
|
+
URL = "url".freeze
|
|
26
|
+
IMAGE = "image".freeze
|
|
27
|
+
SIGNATURE = "signature".freeze
|
|
28
|
+
INITIALS = "initials".freeze
|
|
29
|
+
BARCODE = "barcode".freeze
|
|
30
|
+
COMBINED = "combined".freeze
|
|
31
|
+
OBJECT = "object".freeze
|
|
32
|
+
ARRAY = "array".freeze
|
|
33
|
+
|
|
34
|
+
def self.all_vars
|
|
35
|
+
@all_vars ||= [STRING, NUMBER, BOOLEAN, DATE, ADDRESS, COUNTRY, EMAIL, URL, IMAGE, SIGNATURE, INITIALS, BARCODE, COMBINED, OBJECT, ARRAY].freeze
|
|
36
|
+
end
|
|
37
|
+
|
|
38
|
+
# Builds the enum from string
|
|
39
|
+
# @param [String] The enum value in the form of the string
|
|
40
|
+
# @return [String] The enum value
|
|
41
|
+
def self.build_from_hash(value)
|
|
42
|
+
new.build_from_hash(value)
|
|
43
|
+
end
|
|
44
|
+
|
|
45
|
+
# Builds the enum from string
|
|
46
|
+
# @param [String] The enum value in the form of the string
|
|
47
|
+
# @return [String] The enum value
|
|
48
|
+
def build_from_hash(value)
|
|
49
|
+
# Only responses are built from hashes, and a value added to the API after this client was released is kept as it
|
|
50
|
+
# is: the constants are the values this client knows
|
|
51
|
+
value
|
|
52
|
+
end
|
|
53
|
+
end
|
|
54
|
+
end
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
=begin
|
|
2
|
+
#DocSpring API
|
|
3
|
+
|
|
4
|
+
#Use DocSpring's API to programmatically fill out PDF forms, convert HTML to PDFs, merge PDFs, or request legally binding e-signatures.
|
|
5
|
+
|
|
6
|
+
The version of the OpenAPI document: v2
|
|
7
|
+
|
|
8
|
+
Generated by: https://openapi-generator.tech
|
|
9
|
+
Generator version: 7.26.0-DOCSPRING
|
|
10
|
+
|
|
11
|
+
=end
|
|
12
|
+
|
|
13
|
+
require 'date'
|
|
14
|
+
require 'time'
|
|
15
|
+
|
|
16
|
+
module DocSpring
|
|
17
|
+
class GenerateFilesFormat
|
|
18
|
+
PNG = "png".freeze
|
|
19
|
+
|
|
20
|
+
def self.all_vars
|
|
21
|
+
@all_vars ||= [PNG].freeze
|
|
22
|
+
end
|
|
23
|
+
|
|
24
|
+
# Builds the enum from string
|
|
25
|
+
# @param [String] The enum value in the form of the string
|
|
26
|
+
# @return [String] The enum value
|
|
27
|
+
def self.build_from_hash(value)
|
|
28
|
+
new.build_from_hash(value)
|
|
29
|
+
end
|
|
30
|
+
|
|
31
|
+
# Builds the enum from string
|
|
32
|
+
# @param [String] The enum value in the form of the string
|
|
33
|
+
# @return [String] The enum value
|
|
34
|
+
def build_from_hash(value)
|
|
35
|
+
# Only responses are built from hashes, and a value added to the API after this client was released is kept as it
|
|
36
|
+
# is: the constants are the values this client knows
|
|
37
|
+
value
|
|
38
|
+
end
|
|
39
|
+
end
|
|
40
|
+
end
|
|
@@ -0,0 +1,187 @@
|
|
|
1
|
+
=begin
|
|
2
|
+
#DocSpring API
|
|
3
|
+
|
|
4
|
+
#Use DocSpring's API to programmatically fill out PDF forms, convert HTML to PDFs, merge PDFs, or request legally binding e-signatures.
|
|
5
|
+
|
|
6
|
+
The version of the OpenAPI document: v2
|
|
7
|
+
|
|
8
|
+
Generated by: https://openapi-generator.tech
|
|
9
|
+
Generator version: 7.26.0-DOCSPRING
|
|
10
|
+
|
|
11
|
+
=end
|
|
12
|
+
|
|
13
|
+
require 'date'
|
|
14
|
+
require 'time'
|
|
15
|
+
|
|
16
|
+
module DocSpring
|
|
17
|
+
# The formats to make.
|
|
18
|
+
class GenerateSubmissionFilesRequest < ApiModelBase
|
|
19
|
+
# The formats to add to the submission's files: `png`, an image of each page of the submission's PDF (up to 100 pages). A format the submission already has (or is making) is left as it is.
|
|
20
|
+
attr_accessor :formats
|
|
21
|
+
|
|
22
|
+
# Attribute mapping from ruby-style variable name to JSON key.
|
|
23
|
+
def self.attribute_map
|
|
24
|
+
{
|
|
25
|
+
:'formats' => :'formats'
|
|
26
|
+
}
|
|
27
|
+
end
|
|
28
|
+
|
|
29
|
+
# Returns attribute mapping this model knows about
|
|
30
|
+
def self.acceptable_attribute_map
|
|
31
|
+
attribute_map
|
|
32
|
+
end
|
|
33
|
+
|
|
34
|
+
# Returns all the JSON keys this model knows about
|
|
35
|
+
def self.acceptable_attributes
|
|
36
|
+
acceptable_attribute_map.values
|
|
37
|
+
end
|
|
38
|
+
|
|
39
|
+
# Attribute type mapping.
|
|
40
|
+
def self.openapi_types
|
|
41
|
+
{
|
|
42
|
+
:'formats' => :'Array<GenerateFilesFormat>'
|
|
43
|
+
}
|
|
44
|
+
end
|
|
45
|
+
|
|
46
|
+
# List of attributes with nullable: true
|
|
47
|
+
def self.openapi_nullable
|
|
48
|
+
Set.new([
|
|
49
|
+
])
|
|
50
|
+
end
|
|
51
|
+
|
|
52
|
+
# Returns attribute type mapping
|
|
53
|
+
def self.acceptable_openapi_types
|
|
54
|
+
openapi_types
|
|
55
|
+
end
|
|
56
|
+
|
|
57
|
+
# Returns the nullable attributes
|
|
58
|
+
def self.acceptable_openapi_nullable
|
|
59
|
+
openapi_nullable
|
|
60
|
+
end
|
|
61
|
+
|
|
62
|
+
# Initializes the object
|
|
63
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
|
64
|
+
def initialize(attributes = {})
|
|
65
|
+
if (!attributes.is_a?(Hash))
|
|
66
|
+
fail ArgumentError, "The input argument (attributes) must be a hash in `DocSpring::GenerateSubmissionFilesRequest` initialize method"
|
|
67
|
+
end
|
|
68
|
+
|
|
69
|
+
# check to see if the attribute exists and convert string to symbol for hash key
|
|
70
|
+
acceptable_attribute_map = self.class.acceptable_attribute_map
|
|
71
|
+
attributes = attributes.each_with_object({}) { |(k, v), h|
|
|
72
|
+
if (!acceptable_attribute_map.key?(k.to_sym))
|
|
73
|
+
fail ArgumentError, "`#{k}` is not a valid attribute in `DocSpring::GenerateSubmissionFilesRequest`. Please check the name to make sure it's valid. List of attributes: " + acceptable_attribute_map.keys.inspect
|
|
74
|
+
end
|
|
75
|
+
h[k.to_sym] = v
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
if attributes.key?(:'formats')
|
|
79
|
+
if (value = attributes[:'formats']).is_a?(Array)
|
|
80
|
+
self.formats = value
|
|
81
|
+
end
|
|
82
|
+
else
|
|
83
|
+
self.formats = nil
|
|
84
|
+
end
|
|
85
|
+
end
|
|
86
|
+
|
|
87
|
+
# Show invalid properties with the reasons. Usually used together with valid?
|
|
88
|
+
# @return Array for valid properties with the reasons
|
|
89
|
+
def list_invalid_properties
|
|
90
|
+
warn '[DEPRECATED] the `list_invalid_properties` method is obsolete'
|
|
91
|
+
invalid_properties = Array.new
|
|
92
|
+
if @formats.nil?
|
|
93
|
+
invalid_properties.push('invalid value for "formats", formats cannot be nil.')
|
|
94
|
+
end
|
|
95
|
+
|
|
96
|
+
invalid_properties
|
|
97
|
+
end
|
|
98
|
+
|
|
99
|
+
# Check to see if the all the properties in the model are valid
|
|
100
|
+
# @return true if the model is valid
|
|
101
|
+
def valid?
|
|
102
|
+
warn '[DEPRECATED] the `valid?` method is obsolete'
|
|
103
|
+
return false if @formats.nil?
|
|
104
|
+
true
|
|
105
|
+
end
|
|
106
|
+
|
|
107
|
+
# Custom attribute writer method with validation
|
|
108
|
+
# @param [Object] formats Value to be assigned
|
|
109
|
+
def formats=(formats)
|
|
110
|
+
if formats.nil?
|
|
111
|
+
fail ArgumentError, 'formats cannot be nil'
|
|
112
|
+
end
|
|
113
|
+
|
|
114
|
+
@formats = formats
|
|
115
|
+
end
|
|
116
|
+
|
|
117
|
+
# Checks equality by comparing each attribute.
|
|
118
|
+
# @param [Object] Object to be compared
|
|
119
|
+
def ==(o)
|
|
120
|
+
return true if self.equal?(o)
|
|
121
|
+
self.class == o.class &&
|
|
122
|
+
formats == o.formats
|
|
123
|
+
end
|
|
124
|
+
|
|
125
|
+
# @see the `==` method
|
|
126
|
+
# @param [Object] Object to be compared
|
|
127
|
+
def eql?(o)
|
|
128
|
+
self == o
|
|
129
|
+
end
|
|
130
|
+
|
|
131
|
+
# Calculates hash code according to all attributes.
|
|
132
|
+
# @return [Integer] Hash code
|
|
133
|
+
def hash
|
|
134
|
+
[formats].hash
|
|
135
|
+
end
|
|
136
|
+
|
|
137
|
+
# Builds the object from hash
|
|
138
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
|
139
|
+
# @return [Object] Returns the model itself
|
|
140
|
+
def self.build_from_hash(attributes)
|
|
141
|
+
return nil unless attributes.is_a?(Hash)
|
|
142
|
+
attributes = attributes.transform_keys(&:to_sym)
|
|
143
|
+
# include attributes inherited from allOf parents (the nearest declaration wins)
|
|
144
|
+
map = acceptable_attribute_map
|
|
145
|
+
transformed_hash = {}
|
|
146
|
+
acceptable_openapi_types.each_pair do |key, type|
|
|
147
|
+
if attributes.key?(map[key]) && attributes[map[key]].nil?
|
|
148
|
+
transformed_hash["#{key}"] = nil
|
|
149
|
+
elsif type =~ /\AArray<(.*)>/i
|
|
150
|
+
# check to ensure the input is an array given that the attribute
|
|
151
|
+
# is documented as an array but the input is not
|
|
152
|
+
if attributes[map[key]].is_a?(Array)
|
|
153
|
+
transformed_hash["#{key}"] = attributes[map[key]].map { |v| _deserialize($1, v) }
|
|
154
|
+
end
|
|
155
|
+
elsif !attributes[map[key]].nil?
|
|
156
|
+
transformed_hash["#{key}"] = _deserialize(type, attributes[map[key]])
|
|
157
|
+
end
|
|
158
|
+
end
|
|
159
|
+
# Responses can include enum values added after this client was released, so the enum setters
|
|
160
|
+
# accept any value while the model is built from a response
|
|
161
|
+
allocate.tap do |model|
|
|
162
|
+
model.instance_variable_set(:@_skip_enum_validation, true)
|
|
163
|
+
model.send(:initialize, transformed_hash)
|
|
164
|
+
model.remove_instance_variable(:@_skip_enum_validation)
|
|
165
|
+
end
|
|
166
|
+
end
|
|
167
|
+
|
|
168
|
+
# Returns the object in the form of hash
|
|
169
|
+
# @return [Hash] Returns the object in the form of hash
|
|
170
|
+
def to_hash
|
|
171
|
+
hash = {}
|
|
172
|
+
# include attributes inherited from allOf parents (the nearest declaration wins)
|
|
173
|
+
self.class.acceptable_attribute_map.each_pair do |attr, param|
|
|
174
|
+
value = self.send(attr)
|
|
175
|
+
if value.nil?
|
|
176
|
+
is_nullable = self.class.acceptable_openapi_nullable.include?(attr)
|
|
177
|
+
next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
|
|
178
|
+
end
|
|
179
|
+
|
|
180
|
+
hash[param] = _to_hash(value)
|
|
181
|
+
end
|
|
182
|
+
hash
|
|
183
|
+
end
|
|
184
|
+
|
|
185
|
+
end
|
|
186
|
+
|
|
187
|
+
end
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
=begin
|
|
2
|
+
#DocSpring API
|
|
3
|
+
|
|
4
|
+
#Use DocSpring's API to programmatically fill out PDF forms, convert HTML to PDFs, merge PDFs, or request legally binding e-signatures.
|
|
5
|
+
|
|
6
|
+
The version of the OpenAPI document: v2
|
|
7
|
+
|
|
8
|
+
Generated by: https://openapi-generator.tech
|
|
9
|
+
Generator version: 7.26.0-DOCSPRING
|
|
10
|
+
|
|
11
|
+
=end
|
|
12
|
+
|
|
13
|
+
require 'date'
|
|
14
|
+
require 'time'
|
|
15
|
+
|
|
16
|
+
module DocSpring
|
|
17
|
+
class OutputFormat
|
|
18
|
+
PDF = "pdf".freeze
|
|
19
|
+
PNG = "png".freeze
|
|
20
|
+
|
|
21
|
+
def self.all_vars
|
|
22
|
+
@all_vars ||= [PDF, PNG].freeze
|
|
23
|
+
end
|
|
24
|
+
|
|
25
|
+
# Builds the enum from string
|
|
26
|
+
# @param [String] The enum value in the form of the string
|
|
27
|
+
# @return [String] The enum value
|
|
28
|
+
def self.build_from_hash(value)
|
|
29
|
+
new.build_from_hash(value)
|
|
30
|
+
end
|
|
31
|
+
|
|
32
|
+
# Builds the enum from string
|
|
33
|
+
# @param [String] The enum value in the form of the string
|
|
34
|
+
# @return [String] The enum value
|
|
35
|
+
def build_from_hash(value)
|
|
36
|
+
# Only responses are built from hashes, and a value added to the API after this client was released is kept as it
|
|
37
|
+
# is: the constants are the values this client knows
|
|
38
|
+
value
|
|
39
|
+
end
|
|
40
|
+
end
|
|
41
|
+
end
|
|
@@ -0,0 +1,359 @@
|
|
|
1
|
+
=begin
|
|
2
|
+
#DocSpring API
|
|
3
|
+
|
|
4
|
+
#Use DocSpring's API to programmatically fill out PDF forms, convert HTML to PDFs, merge PDFs, or request legally binding e-signatures.
|
|
5
|
+
|
|
6
|
+
The version of the OpenAPI document: v2
|
|
7
|
+
|
|
8
|
+
Generated by: https://openapi-generator.tech
|
|
9
|
+
Generator version: 7.26.0-DOCSPRING
|
|
10
|
+
|
|
11
|
+
=end
|
|
12
|
+
|
|
13
|
+
require 'date'
|
|
14
|
+
require 'time'
|
|
15
|
+
|
|
16
|
+
module DocSpring
|
|
17
|
+
# An image of one page of a PDF, a PNG of a submission's page or a JPEG of a template's.
|
|
18
|
+
class PageImage < ApiModelBase
|
|
19
|
+
# The page number, from 1.
|
|
20
|
+
attr_accessor :page
|
|
21
|
+
|
|
22
|
+
# The image's width in pixels.
|
|
23
|
+
attr_accessor :width
|
|
24
|
+
|
|
25
|
+
# The image's height in pixels.
|
|
26
|
+
attr_accessor :height
|
|
27
|
+
|
|
28
|
+
# A temporary link to download the image. A submission's is null when your account turns off download links for submissions.
|
|
29
|
+
attr_accessor :download_url
|
|
30
|
+
|
|
31
|
+
# A link to download a submission's image that doesn't expire: it redirects to a new temporary link. It needs your API token or a signed-in session, except for a submission of a template that makes its submissions public. Null for a template's page images.
|
|
32
|
+
attr_accessor :permanent_url
|
|
33
|
+
|
|
34
|
+
# The image's file name, such as `sub_123_page_1.png`.
|
|
35
|
+
attr_accessor :filename
|
|
36
|
+
|
|
37
|
+
# The image's media type, `image/png` for a submission's pages or `image/jpeg` for a template's.
|
|
38
|
+
attr_accessor :content_type
|
|
39
|
+
|
|
40
|
+
# The image's size in bytes.
|
|
41
|
+
attr_accessor :size
|
|
42
|
+
|
|
43
|
+
# The SHA-256 hash of the image. Null for a template's page images.
|
|
44
|
+
attr_accessor :sha256
|
|
45
|
+
|
|
46
|
+
# Attribute mapping from ruby-style variable name to JSON key.
|
|
47
|
+
def self.attribute_map
|
|
48
|
+
{
|
|
49
|
+
:'page' => :'page',
|
|
50
|
+
:'width' => :'width',
|
|
51
|
+
:'height' => :'height',
|
|
52
|
+
:'download_url' => :'download_url',
|
|
53
|
+
:'permanent_url' => :'permanent_url',
|
|
54
|
+
:'filename' => :'filename',
|
|
55
|
+
:'content_type' => :'content_type',
|
|
56
|
+
:'size' => :'size',
|
|
57
|
+
:'sha256' => :'sha256'
|
|
58
|
+
}
|
|
59
|
+
end
|
|
60
|
+
|
|
61
|
+
# Returns attribute mapping this model knows about
|
|
62
|
+
def self.acceptable_attribute_map
|
|
63
|
+
attribute_map
|
|
64
|
+
end
|
|
65
|
+
|
|
66
|
+
# Returns all the JSON keys this model knows about
|
|
67
|
+
def self.acceptable_attributes
|
|
68
|
+
acceptable_attribute_map.values
|
|
69
|
+
end
|
|
70
|
+
|
|
71
|
+
# Attribute type mapping.
|
|
72
|
+
def self.openapi_types
|
|
73
|
+
{
|
|
74
|
+
:'page' => :'Integer',
|
|
75
|
+
:'width' => :'Integer',
|
|
76
|
+
:'height' => :'Integer',
|
|
77
|
+
:'download_url' => :'String',
|
|
78
|
+
:'permanent_url' => :'String',
|
|
79
|
+
:'filename' => :'String',
|
|
80
|
+
:'content_type' => :'String',
|
|
81
|
+
:'size' => :'Integer',
|
|
82
|
+
:'sha256' => :'String'
|
|
83
|
+
}
|
|
84
|
+
end
|
|
85
|
+
|
|
86
|
+
# List of attributes with nullable: true
|
|
87
|
+
def self.openapi_nullable
|
|
88
|
+
Set.new([
|
|
89
|
+
:'download_url',
|
|
90
|
+
:'permanent_url',
|
|
91
|
+
:'sha256'
|
|
92
|
+
])
|
|
93
|
+
end
|
|
94
|
+
|
|
95
|
+
# Returns attribute type mapping
|
|
96
|
+
def self.acceptable_openapi_types
|
|
97
|
+
openapi_types
|
|
98
|
+
end
|
|
99
|
+
|
|
100
|
+
# Returns the nullable attributes
|
|
101
|
+
def self.acceptable_openapi_nullable
|
|
102
|
+
openapi_nullable
|
|
103
|
+
end
|
|
104
|
+
|
|
105
|
+
# Initializes the object
|
|
106
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
|
107
|
+
def initialize(attributes = {})
|
|
108
|
+
if (!attributes.is_a?(Hash))
|
|
109
|
+
fail ArgumentError, "The input argument (attributes) must be a hash in `DocSpring::PageImage` initialize method"
|
|
110
|
+
end
|
|
111
|
+
|
|
112
|
+
# check to see if the attribute exists and convert string to symbol for hash key
|
|
113
|
+
acceptable_attribute_map = self.class.acceptable_attribute_map
|
|
114
|
+
attributes = attributes.each_with_object({}) { |(k, v), h|
|
|
115
|
+
if (!acceptable_attribute_map.key?(k.to_sym))
|
|
116
|
+
fail ArgumentError, "`#{k}` is not a valid attribute in `DocSpring::PageImage`. Please check the name to make sure it's valid. List of attributes: " + acceptable_attribute_map.keys.inspect
|
|
117
|
+
end
|
|
118
|
+
h[k.to_sym] = v
|
|
119
|
+
}
|
|
120
|
+
|
|
121
|
+
if attributes.key?(:'page')
|
|
122
|
+
self.page = attributes[:'page']
|
|
123
|
+
else
|
|
124
|
+
self.page = nil
|
|
125
|
+
end
|
|
126
|
+
|
|
127
|
+
if attributes.key?(:'width')
|
|
128
|
+
self.width = attributes[:'width']
|
|
129
|
+
else
|
|
130
|
+
self.width = nil
|
|
131
|
+
end
|
|
132
|
+
|
|
133
|
+
if attributes.key?(:'height')
|
|
134
|
+
self.height = attributes[:'height']
|
|
135
|
+
else
|
|
136
|
+
self.height = nil
|
|
137
|
+
end
|
|
138
|
+
|
|
139
|
+
if attributes.key?(:'download_url')
|
|
140
|
+
self.download_url = attributes[:'download_url']
|
|
141
|
+
else
|
|
142
|
+
self.download_url = nil
|
|
143
|
+
end
|
|
144
|
+
|
|
145
|
+
if attributes.key?(:'permanent_url')
|
|
146
|
+
self.permanent_url = attributes[:'permanent_url']
|
|
147
|
+
else
|
|
148
|
+
self.permanent_url = nil
|
|
149
|
+
end
|
|
150
|
+
|
|
151
|
+
if attributes.key?(:'filename')
|
|
152
|
+
self.filename = attributes[:'filename']
|
|
153
|
+
else
|
|
154
|
+
self.filename = nil
|
|
155
|
+
end
|
|
156
|
+
|
|
157
|
+
if attributes.key?(:'content_type')
|
|
158
|
+
self.content_type = attributes[:'content_type']
|
|
159
|
+
else
|
|
160
|
+
self.content_type = nil
|
|
161
|
+
end
|
|
162
|
+
|
|
163
|
+
if attributes.key?(:'size')
|
|
164
|
+
self.size = attributes[:'size']
|
|
165
|
+
else
|
|
166
|
+
self.size = nil
|
|
167
|
+
end
|
|
168
|
+
|
|
169
|
+
if attributes.key?(:'sha256')
|
|
170
|
+
self.sha256 = attributes[:'sha256']
|
|
171
|
+
else
|
|
172
|
+
self.sha256 = nil
|
|
173
|
+
end
|
|
174
|
+
end
|
|
175
|
+
|
|
176
|
+
# Show invalid properties with the reasons. Usually used together with valid?
|
|
177
|
+
# @return Array for valid properties with the reasons
|
|
178
|
+
def list_invalid_properties
|
|
179
|
+
warn '[DEPRECATED] the `list_invalid_properties` method is obsolete'
|
|
180
|
+
invalid_properties = Array.new
|
|
181
|
+
if @page.nil?
|
|
182
|
+
invalid_properties.push('invalid value for "page", page cannot be nil.')
|
|
183
|
+
end
|
|
184
|
+
|
|
185
|
+
if @width.nil?
|
|
186
|
+
invalid_properties.push('invalid value for "width", width cannot be nil.')
|
|
187
|
+
end
|
|
188
|
+
|
|
189
|
+
if @height.nil?
|
|
190
|
+
invalid_properties.push('invalid value for "height", height cannot be nil.')
|
|
191
|
+
end
|
|
192
|
+
|
|
193
|
+
if @filename.nil?
|
|
194
|
+
invalid_properties.push('invalid value for "filename", filename cannot be nil.')
|
|
195
|
+
end
|
|
196
|
+
|
|
197
|
+
if @content_type.nil?
|
|
198
|
+
invalid_properties.push('invalid value for "content_type", content_type cannot be nil.')
|
|
199
|
+
end
|
|
200
|
+
|
|
201
|
+
if @size.nil?
|
|
202
|
+
invalid_properties.push('invalid value for "size", size cannot be nil.')
|
|
203
|
+
end
|
|
204
|
+
|
|
205
|
+
invalid_properties
|
|
206
|
+
end
|
|
207
|
+
|
|
208
|
+
# Check to see if the all the properties in the model are valid
|
|
209
|
+
# @return true if the model is valid
|
|
210
|
+
def valid?
|
|
211
|
+
warn '[DEPRECATED] the `valid?` method is obsolete'
|
|
212
|
+
return false if @page.nil?
|
|
213
|
+
return false if @width.nil?
|
|
214
|
+
return false if @height.nil?
|
|
215
|
+
return false if @filename.nil?
|
|
216
|
+
return false if @content_type.nil?
|
|
217
|
+
return false if @size.nil?
|
|
218
|
+
true
|
|
219
|
+
end
|
|
220
|
+
|
|
221
|
+
# Custom attribute writer method with validation
|
|
222
|
+
# @param [Object] page Value to be assigned
|
|
223
|
+
def page=(page)
|
|
224
|
+
if page.nil?
|
|
225
|
+
fail ArgumentError, 'page cannot be nil'
|
|
226
|
+
end
|
|
227
|
+
|
|
228
|
+
@page = page
|
|
229
|
+
end
|
|
230
|
+
|
|
231
|
+
# Custom attribute writer method with validation
|
|
232
|
+
# @param [Object] width Value to be assigned
|
|
233
|
+
def width=(width)
|
|
234
|
+
if width.nil?
|
|
235
|
+
fail ArgumentError, 'width cannot be nil'
|
|
236
|
+
end
|
|
237
|
+
|
|
238
|
+
@width = width
|
|
239
|
+
end
|
|
240
|
+
|
|
241
|
+
# Custom attribute writer method with validation
|
|
242
|
+
# @param [Object] height Value to be assigned
|
|
243
|
+
def height=(height)
|
|
244
|
+
if height.nil?
|
|
245
|
+
fail ArgumentError, 'height cannot be nil'
|
|
246
|
+
end
|
|
247
|
+
|
|
248
|
+
@height = height
|
|
249
|
+
end
|
|
250
|
+
|
|
251
|
+
# Custom attribute writer method with validation
|
|
252
|
+
# @param [Object] filename Value to be assigned
|
|
253
|
+
def filename=(filename)
|
|
254
|
+
if filename.nil?
|
|
255
|
+
fail ArgumentError, 'filename cannot be nil'
|
|
256
|
+
end
|
|
257
|
+
|
|
258
|
+
@filename = filename
|
|
259
|
+
end
|
|
260
|
+
|
|
261
|
+
# Custom attribute writer method with validation
|
|
262
|
+
# @param [Object] content_type Value to be assigned
|
|
263
|
+
def content_type=(content_type)
|
|
264
|
+
if content_type.nil?
|
|
265
|
+
fail ArgumentError, 'content_type cannot be nil'
|
|
266
|
+
end
|
|
267
|
+
|
|
268
|
+
@content_type = content_type
|
|
269
|
+
end
|
|
270
|
+
|
|
271
|
+
# Custom attribute writer method with validation
|
|
272
|
+
# @param [Object] size Value to be assigned
|
|
273
|
+
def size=(size)
|
|
274
|
+
if size.nil?
|
|
275
|
+
fail ArgumentError, 'size cannot be nil'
|
|
276
|
+
end
|
|
277
|
+
|
|
278
|
+
@size = size
|
|
279
|
+
end
|
|
280
|
+
|
|
281
|
+
# Checks equality by comparing each attribute.
|
|
282
|
+
# @param [Object] Object to be compared
|
|
283
|
+
def ==(o)
|
|
284
|
+
return true if self.equal?(o)
|
|
285
|
+
self.class == o.class &&
|
|
286
|
+
page == o.page &&
|
|
287
|
+
width == o.width &&
|
|
288
|
+
height == o.height &&
|
|
289
|
+
download_url == o.download_url &&
|
|
290
|
+
permanent_url == o.permanent_url &&
|
|
291
|
+
filename == o.filename &&
|
|
292
|
+
content_type == o.content_type &&
|
|
293
|
+
size == o.size &&
|
|
294
|
+
sha256 == o.sha256
|
|
295
|
+
end
|
|
296
|
+
|
|
297
|
+
# @see the `==` method
|
|
298
|
+
# @param [Object] Object to be compared
|
|
299
|
+
def eql?(o)
|
|
300
|
+
self == o
|
|
301
|
+
end
|
|
302
|
+
|
|
303
|
+
# Calculates hash code according to all attributes.
|
|
304
|
+
# @return [Integer] Hash code
|
|
305
|
+
def hash
|
|
306
|
+
[page, width, height, download_url, permanent_url, filename, content_type, size, sha256].hash
|
|
307
|
+
end
|
|
308
|
+
|
|
309
|
+
# Builds the object from hash
|
|
310
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
|
311
|
+
# @return [Object] Returns the model itself
|
|
312
|
+
def self.build_from_hash(attributes)
|
|
313
|
+
return nil unless attributes.is_a?(Hash)
|
|
314
|
+
attributes = attributes.transform_keys(&:to_sym)
|
|
315
|
+
# include attributes inherited from allOf parents (the nearest declaration wins)
|
|
316
|
+
map = acceptable_attribute_map
|
|
317
|
+
transformed_hash = {}
|
|
318
|
+
acceptable_openapi_types.each_pair do |key, type|
|
|
319
|
+
if attributes.key?(map[key]) && attributes[map[key]].nil?
|
|
320
|
+
transformed_hash["#{key}"] = nil
|
|
321
|
+
elsif type =~ /\AArray<(.*)>/i
|
|
322
|
+
# check to ensure the input is an array given that the attribute
|
|
323
|
+
# is documented as an array but the input is not
|
|
324
|
+
if attributes[map[key]].is_a?(Array)
|
|
325
|
+
transformed_hash["#{key}"] = attributes[map[key]].map { |v| _deserialize($1, v) }
|
|
326
|
+
end
|
|
327
|
+
elsif !attributes[map[key]].nil?
|
|
328
|
+
transformed_hash["#{key}"] = _deserialize(type, attributes[map[key]])
|
|
329
|
+
end
|
|
330
|
+
end
|
|
331
|
+
# Responses can include enum values added after this client was released, so the enum setters
|
|
332
|
+
# accept any value while the model is built from a response
|
|
333
|
+
allocate.tap do |model|
|
|
334
|
+
model.instance_variable_set(:@_skip_enum_validation, true)
|
|
335
|
+
model.send(:initialize, transformed_hash)
|
|
336
|
+
model.remove_instance_variable(:@_skip_enum_validation)
|
|
337
|
+
end
|
|
338
|
+
end
|
|
339
|
+
|
|
340
|
+
# Returns the object in the form of hash
|
|
341
|
+
# @return [Hash] Returns the object in the form of hash
|
|
342
|
+
def to_hash
|
|
343
|
+
hash = {}
|
|
344
|
+
# include attributes inherited from allOf parents (the nearest declaration wins)
|
|
345
|
+
self.class.acceptable_attribute_map.each_pair do |attr, param|
|
|
346
|
+
value = self.send(attr)
|
|
347
|
+
if value.nil?
|
|
348
|
+
is_nullable = self.class.acceptable_openapi_nullable.include?(attr)
|
|
349
|
+
next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
|
|
350
|
+
end
|
|
351
|
+
|
|
352
|
+
hash[param] = _to_hash(value)
|
|
353
|
+
end
|
|
354
|
+
hash
|
|
355
|
+
end
|
|
356
|
+
|
|
357
|
+
end
|
|
358
|
+
|
|
359
|
+
end
|