pdf4me 1.0.1 → 2.0.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/{LICENSE → LICENSE.txt} +6 -6
- data/README.md +124 -395
- data/lib/pdf4me.rb +40 -110
- data/lib/pdf4me/actions/complex_action.rb +64 -0
- data/lib/pdf4me/actions/convert_file_to_pdf.rb +30 -0
- data/lib/pdf4me/actions/convert_to_pdf.rb +14 -0
- data/lib/pdf4me/actions/create_pdf_a.rb +29 -0
- data/lib/pdf4me/actions/create_thumbnail.rb +55 -0
- data/lib/pdf4me/actions/extract_pages.rb +49 -0
- data/lib/pdf4me/actions/merge_two_pdfs.rb +34 -0
- data/lib/pdf4me/actions/optimize.rb +10 -0
- data/lib/pdf4me/actions/optimize_by_profile.rb +42 -0
- data/lib/pdf4me/actions/split_by_page_nr.rb +55 -0
- data/lib/pdf4me/actions/text_stamp.rb +63 -0
- data/lib/pdf4me/actions/wrapper_action.rb +65 -0
- data/lib/pdf4me/client.rb +87 -0
- data/lib/pdf4me/configuration.rb +9 -88
- data/lib/pdf4me/exceptions.rb +26 -0
- data/lib/pdf4me/models/base.rb +26 -0
- data/lib/pdf4me/models/convert_to_pdf_action.rb +26 -246
- data/lib/pdf4me/models/convert_to_pdf_res.rb +5 -185
- data/lib/pdf4me/models/doc_log.rb +12 -257
- data/lib/pdf4me/models/doc_metadata.rb +13 -282
- data/lib/pdf4me/models/document.rb +14 -282
- data/lib/pdf4me/models/notification.rb +8 -191
- data/lib/pdf4me/models/optimize_action.rb +72 -508
- data/lib/pdf4me/models/optimize_res.rb +5 -195
- data/lib/pdf4me/models/page.rb +12 -254
- data/lib/pdf4me/utils/assigner.rb +10 -0
- data/lib/pdf4me/utils/serializer.rb +43 -0
- data/lib/pdf4me/version.rb +1 -13
- data/spec/actions/create_pdf_a_spec.rb +21 -0
- data/spec/actions/wrapper_action_spec.rb +24 -0
- data/spec/files/4.pdf +0 -0
- data/spec/spec_helper.rb +17 -100
- metadata +70 -421
- data/Gemfile +0 -7
- data/Rakefile +0 -8
- data/docs/ActionFlow.md +0 -8
- data/docs/ApiUsageRes.md +0 -11
- data/docs/ArchiveConfig.md +0 -11
- data/docs/ArchiveJobReq.md +0 -12
- data/docs/ArchiveJobRes.md +0 -9
- data/docs/Color.md +0 -10
- data/docs/ConvertApi.md +0 -102
- data/docs/ConvertToPdf.md +0 -10
- data/docs/ConvertToPdfAction.md +0 -10
- data/docs/ConvertToPdfRes.md +0 -8
- data/docs/CreateImages.md +0 -10
- data/docs/CreateImagesRes.md +0 -8
- data/docs/CreatePdfA.md +0 -10
- data/docs/CreatePdfARes.md +0 -8
- data/docs/CustomCMSConfig.md +0 -23
- data/docs/DocAction.md +0 -8
- data/docs/DocLog.md +0 -12
- data/docs/DocMetadata.md +0 -16
- data/docs/Document.md +0 -16
- data/docs/DocumentApi.md +0 -203
- data/docs/DropDocumentReq.md +0 -20
- data/docs/DropDocumentRes.md +0 -15
- data/docs/ExecutionTrigger.md +0 -10
- data/docs/Extract.md +0 -10
- data/docs/ExtractAction.md +0 -9
- data/docs/ExtractApi.md +0 -102
- data/docs/ExtractRes.md +0 -8
- data/docs/GetDocumentListRes.md +0 -13
- data/docs/GetDocumentReq.md +0 -14
- data/docs/GetDocumentRes.md +0 -14
- data/docs/IFormFile.md +0 -13
- data/docs/Image.md +0 -15
- data/docs/ImageAction.md +0 -30
- data/docs/ImageApi.md +0 -107
- data/docs/Job.md +0 -10
- data/docs/JobApi.md +0 -197
- data/docs/JobConfig.md +0 -18
- data/docs/JobConfigRes.md +0 -8
- data/docs/KeyValuePairStringObject.md +0 -9
- data/docs/KeyValuePairStringString.md +0 -9
- data/docs/ManagementApi.md +0 -92
- data/docs/Merge.md +0 -10
- data/docs/MergeAction.md +0 -8
- data/docs/MergeApi.md +0 -102
- data/docs/MergeRes.md +0 -8
- data/docs/Notification.md +0 -9
- data/docs/OcrAction.md +0 -12
- data/docs/OcrApi.md +0 -57
- data/docs/Optimize.md +0 -10
- data/docs/OptimizeAction.md +0 -35
- data/docs/OptimizeApi.md +0 -103
- data/docs/OptimizeRes.md +0 -9
- data/docs/Page.md +0 -14
- data/docs/PageSelection.md +0 -10
- data/docs/Pdf4meAction.md +0 -12
- data/docs/Pdf4meDocument.md +0 -32
- data/docs/Pdf4meException.md +0 -8
- data/docs/PdfAAction.md +0 -14
- data/docs/PdfAApi.md +0 -102
- data/docs/PdfFont.md +0 -9
- data/docs/Pricing.md +0 -13
- data/docs/ProduceDocuments.md +0 -14
- data/docs/ProduceDocumentsRes.md +0 -8
- data/docs/ProduceOutput.md +0 -8
- data/docs/RGBSet.md +0 -10
- data/docs/RecognizeDocument.md +0 -10
- data/docs/RecognizeDocumentRes.md +0 -9
- data/docs/Rectangle.md +0 -11
- data/docs/Rotate.md +0 -10
- data/docs/RunJobRes.md +0 -10
- data/docs/SignatureConfig.md +0 -7
- data/docs/Split.md +0 -10
- data/docs/SplitAction.md +0 -11
- data/docs/SplitApi.md +0 -103
- data/docs/SplitRes.md +0 -8
- data/docs/Stamp.md +0 -10
- data/docs/StampAction.md +0 -22
- data/docs/StampApi.md +0 -110
- data/docs/StampRes.md +0 -8
- data/docs/StorageFolder.md +0 -10
- data/docs/Text.md +0 -17
- data/docs/Transform.md +0 -13
- data/docs/Translate.md +0 -9
- data/docs/UserFingerprint.md +0 -9
- data/docs/VersionRes.md +0 -8
- data/docs/java.md +0 -425
- data/lib/pdf4me/api/convert_api.rb +0 -130
- data/lib/pdf4me/api/document_api.rb +0 -218
- data/lib/pdf4me/api/extract_api.rb +0 -131
- data/lib/pdf4me/api/image_api.rb +0 -139
- data/lib/pdf4me/api/job_api.rb +0 -223
- data/lib/pdf4me/api/management_api.rb +0 -117
- data/lib/pdf4me/api/merge_api.rb +0 -131
- data/lib/pdf4me/api/ocr_api.rb +0 -74
- data/lib/pdf4me/api/optimize_api.rb +0 -139
- data/lib/pdf4me/api/pdf_a_api.rb +0 -134
- data/lib/pdf4me/api/split_api.rb +0 -135
- data/lib/pdf4me/api/stamp_api.rb +0 -159
- data/lib/pdf4me/api_client.rb +0 -380
- data/lib/pdf4me/api_error.rb +0 -38
- data/lib/pdf4me/models/action_flow.rb +0 -190
- data/lib/pdf4me/models/api_usage_res.rb +0 -219
- data/lib/pdf4me/models/archive_config.rb +0 -226
- data/lib/pdf4me/models/archive_job_req.rb +0 -249
- data/lib/pdf4me/models/archive_job_res.rb +0 -207
- data/lib/pdf4me/models/color.rb +0 -206
- data/lib/pdf4me/models/convert_to_pdf.rb +0 -209
- data/lib/pdf4me/models/create_images.rb +0 -209
- data/lib/pdf4me/models/create_images_res.rb +0 -189
- data/lib/pdf4me/models/create_pdf_a.rb +0 -209
- data/lib/pdf4me/models/create_pdf_a_res.rb +0 -189
- data/lib/pdf4me/models/custom_cms_config.rb +0 -323
- data/lib/pdf4me/models/doc_action.rb +0 -190
- data/lib/pdf4me/models/drop_document_req.rb +0 -348
- data/lib/pdf4me/models/drop_document_res.rb +0 -260
- data/lib/pdf4me/models/execution_trigger.rb +0 -206
- data/lib/pdf4me/models/extract.rb +0 -207
- data/lib/pdf4me/models/extract_action.rb +0 -201
- data/lib/pdf4me/models/extract_res.rb +0 -188
- data/lib/pdf4me/models/get_document_list_res.rb +0 -237
- data/lib/pdf4me/models/get_document_req.rb +0 -243
- data/lib/pdf4me/models/get_document_res.rb +0 -246
- data/lib/pdf4me/models/i_form_file.rb +0 -235
- data/lib/pdf4me/models/image.rb +0 -300
- data/lib/pdf4me/models/image_action.rb +0 -513
- data/lib/pdf4me/models/job.rb +0 -213
- data/lib/pdf4me/models/job_config.rb +0 -298
- data/lib/pdf4me/models/job_config_res.rb +0 -193
- data/lib/pdf4me/models/key_value_pair_string_object.rb +0 -197
- data/lib/pdf4me/models/key_value_pair_string_string.rb +0 -197
- data/lib/pdf4me/models/merge.rb +0 -209
- data/lib/pdf4me/models/merge_action.rb +0 -190
- data/lib/pdf4me/models/merge_res.rb +0 -188
- data/lib/pdf4me/models/ocr_action.rb +0 -259
- data/lib/pdf4me/models/optimize.rb +0 -209
- data/lib/pdf4me/models/page_selection.rb +0 -246
- data/lib/pdf4me/models/pdf4me_action.rb +0 -259
- data/lib/pdf4me/models/pdf4me_document.rb +0 -511
- data/lib/pdf4me/models/pdf4me_exception.rb +0 -189
- data/lib/pdf4me/models/pdf_a_action.rb +0 -297
- data/lib/pdf4me/models/pdf_font.rb +0 -213
- data/lib/pdf4me/models/pricing.rb +0 -278
- data/lib/pdf4me/models/produce_documents.rb +0 -251
- data/lib/pdf4me/models/produce_documents_res.rb +0 -191
- data/lib/pdf4me/models/produce_output.rb +0 -221
- data/lib/pdf4me/models/recognize_document.rb +0 -209
- data/lib/pdf4me/models/recognize_document_res.rb +0 -198
- data/lib/pdf4me/models/rectangle.rb +0 -215
- data/lib/pdf4me/models/rgb_set.rb +0 -206
- data/lib/pdf4me/models/rotate.rb +0 -221
- data/lib/pdf4me/models/run_job_res.rb +0 -215
- data/lib/pdf4me/models/signature_config.rb +0 -179
- data/lib/pdf4me/models/split.rb +0 -207
- data/lib/pdf4me/models/split_action.rb +0 -219
- data/lib/pdf4me/models/split_res.rb +0 -190
- data/lib/pdf4me/models/stamp.rb +0 -209
- data/lib/pdf4me/models/stamp_action.rb +0 -387
- data/lib/pdf4me/models/stamp_res.rb +0 -189
- data/lib/pdf4me/models/storage_folder.rb +0 -239
- data/lib/pdf4me/models/text.rb +0 -320
- data/lib/pdf4me/models/transform.rb +0 -263
- data/lib/pdf4me/models/translate.rb +0 -207
- data/lib/pdf4me/models/user_fingerprint.rb +0 -197
- data/lib/pdf4me/models/version_res.rb +0 -188
- data/pdf4me.gemspec +0 -47
- data/spec/api/convert_api_spec.rb +0 -60
- data/spec/api/document_api_spec.rb +0 -83
- data/spec/api/extract_api_spec.rb +0 -60
- data/spec/api/image_api_spec.rb +0 -62
- data/spec/api/job_api_spec.rb +0 -82
- data/spec/api/management_api_spec.rb +0 -57
- data/spec/api/merge_api_spec.rb +0 -60
- data/spec/api/ocr_api_spec.rb +0 -47
- data/spec/api/optimize_api_spec.rb +0 -60
- data/spec/api/pdf_a_api_spec.rb +0 -60
- data/spec/api/split_api_spec.rb +0 -60
- data/spec/api/stamp_api_spec.rb +0 -63
- data/spec/api_client_spec.rb +0 -226
- data/spec/configuration_spec.rb +0 -42
- data/spec/models/action_flow_spec.rb +0 -42
- data/spec/models/api_usage_res_spec.rb +0 -60
- data/spec/models/archive_config_spec.rb +0 -60
- data/spec/models/archive_job_req_spec.rb +0 -66
- data/spec/models/archive_job_res_spec.rb +0 -48
- data/spec/models/color_spec.rb +0 -54
- data/spec/models/convert_to_pdf_action_spec.rb +0 -62
- data/spec/models/convert_to_pdf_res_spec.rb +0 -42
- data/spec/models/convert_to_pdf_spec.rb +0 -54
- data/spec/models/create_images_res_spec.rb +0 -42
- data/spec/models/create_images_spec.rb +0 -54
- data/spec/models/create_pdf_a_res_spec.rb +0 -42
- data/spec/models/create_pdf_a_spec.rb +0 -54
- data/spec/models/custom_cms_config_spec.rb +0 -132
- data/spec/models/doc_action_spec.rb +0 -42
- data/spec/models/doc_log_spec.rb +0 -70
- data/spec/models/doc_metadata_spec.rb +0 -90
- data/spec/models/document_spec.rb +0 -90
- data/spec/models/drop_document_req_spec.rb +0 -118
- data/spec/models/drop_document_res_spec.rb +0 -84
- data/spec/models/execution_trigger_spec.rb +0 -54
- data/spec/models/extract_action_spec.rb +0 -48
- data/spec/models/extract_res_spec.rb +0 -42
- data/spec/models/extract_spec.rb +0 -54
- data/spec/models/get_document_list_res_spec.rb +0 -72
- data/spec/models/get_document_req_spec.rb +0 -78
- data/spec/models/get_document_res_spec.rb +0 -78
- data/spec/models/i_form_file_spec.rb +0 -72
- data/spec/models/image_action_spec.rb +0 -206
- data/spec/models/image_spec.rb +0 -88
- data/spec/models/job_config_res_spec.rb +0 -42
- data/spec/models/job_config_spec.rb +0 -102
- data/spec/models/job_spec.rb +0 -54
- data/spec/models/key_value_pair_string_object_spec.rb +0 -48
- data/spec/models/key_value_pair_string_string_spec.rb +0 -48
- data/spec/models/merge_action_spec.rb +0 -42
- data/spec/models/merge_res_spec.rb +0 -42
- data/spec/models/merge_spec.rb +0 -54
- data/spec/models/notification_spec.rb +0 -48
- data/spec/models/ocr_action_spec.rb +0 -70
- data/spec/models/optimize_action_spec.rb +0 -228
- data/spec/models/optimize_res_spec.rb +0 -48
- data/spec/models/optimize_spec.rb +0 -54
- data/spec/models/page_selection_spec.rb +0 -58
- data/spec/models/page_spec.rb +0 -78
- data/spec/models/pdf4me_action_spec.rb +0 -70
- data/spec/models/pdf4me_document_spec.rb +0 -202
- data/spec/models/pdf4me_exception_spec.rb +0 -42
- data/spec/models/pdf_a_action_spec.rb +0 -86
- data/spec/models/pdf_font_spec.rb +0 -48
- data/spec/models/pricing_spec.rb +0 -80
- data/spec/models/produce_documents_res_spec.rb +0 -42
- data/spec/models/produce_documents_spec.rb +0 -78
- data/spec/models/produce_output_spec.rb +0 -46
- data/spec/models/recognize_document_res_spec.rb +0 -48
- data/spec/models/recognize_document_spec.rb +0 -54
- data/spec/models/rectangle_spec.rb +0 -60
- data/spec/models/rgb_set_spec.rb +0 -54
- data/spec/models/rotate_spec.rb +0 -54
- data/spec/models/run_job_res_spec.rb +0 -54
- data/spec/models/signature_config_spec.rb +0 -36
- data/spec/models/split_action_spec.rb +0 -60
- data/spec/models/split_res_spec.rb +0 -42
- data/spec/models/split_spec.rb +0 -54
- data/spec/models/stamp_action_spec.rb +0 -142
- data/spec/models/stamp_res_spec.rb +0 -42
- data/spec/models/stamp_spec.rb +0 -54
- data/spec/models/storage_folder_spec.rb +0 -58
- data/spec/models/text_spec.rb +0 -104
- data/spec/models/transform_spec.rb +0 -72
- data/spec/models/translate_spec.rb +0 -48
- data/spec/models/user_fingerprint_spec.rb +0 -48
- data/spec/models/version_res_spec.rb +0 -42
@@ -1,189 +0,0 @@
|
|
1
|
-
=begin
|
2
|
-
#DmsApi
|
3
|
-
|
4
|
-
#No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen)
|
5
|
-
|
6
|
-
OpenAPI spec version: v1
|
7
|
-
|
8
|
-
Generated by: https://github.com/swagger-api/swagger-codegen.git
|
9
|
-
Swagger Codegen version: 2.3.0
|
10
|
-
|
11
|
-
=end
|
12
|
-
|
13
|
-
require 'date'
|
14
|
-
|
15
|
-
module Pdf4me
|
16
|
-
# Pdf4me Exception gives more information of what is the error.
|
17
|
-
class Pdf4meException
|
18
|
-
# Human Readable Message of the error
|
19
|
-
attr_accessor :error_message
|
20
|
-
|
21
|
-
|
22
|
-
# Attribute mapping from ruby-style variable name to JSON key.
|
23
|
-
def self.attribute_map
|
24
|
-
{
|
25
|
-
:'error_message' => :'errorMessage'
|
26
|
-
}
|
27
|
-
end
|
28
|
-
|
29
|
-
# Attribute type mapping.
|
30
|
-
def self.swagger_types
|
31
|
-
{
|
32
|
-
:'error_message' => :'String'
|
33
|
-
}
|
34
|
-
end
|
35
|
-
|
36
|
-
# Initializes the object
|
37
|
-
# @param [Hash] attributes Model attributes in the form of hash
|
38
|
-
def initialize(attributes = {})
|
39
|
-
return unless attributes.is_a?(Hash)
|
40
|
-
|
41
|
-
# convert string to symbol for hash key
|
42
|
-
attributes = attributes.each_with_object({}){|(k,v), h| h[k.to_sym] = v}
|
43
|
-
|
44
|
-
if attributes.has_key?(:'errorMessage')
|
45
|
-
self.error_message = attributes[:'errorMessage']
|
46
|
-
end
|
47
|
-
|
48
|
-
end
|
49
|
-
|
50
|
-
# Show invalid properties with the reasons. Usually used together with valid?
|
51
|
-
# @return Array for valid properties with the reasons
|
52
|
-
def list_invalid_properties
|
53
|
-
invalid_properties = Array.new
|
54
|
-
return invalid_properties
|
55
|
-
end
|
56
|
-
|
57
|
-
# Check to see if the all the properties in the model are valid
|
58
|
-
# @return true if the model is valid
|
59
|
-
def valid?
|
60
|
-
return true
|
61
|
-
end
|
62
|
-
|
63
|
-
# Checks equality by comparing each attribute.
|
64
|
-
# @param [Object] Object to be compared
|
65
|
-
def ==(o)
|
66
|
-
return true if self.equal?(o)
|
67
|
-
self.class == o.class &&
|
68
|
-
error_message == o.error_message
|
69
|
-
end
|
70
|
-
|
71
|
-
# @see the `==` method
|
72
|
-
# @param [Object] Object to be compared
|
73
|
-
def eql?(o)
|
74
|
-
self == o
|
75
|
-
end
|
76
|
-
|
77
|
-
# Calculates hash code according to all attributes.
|
78
|
-
# @return [Fixnum] Hash code
|
79
|
-
def hash
|
80
|
-
[error_message].hash
|
81
|
-
end
|
82
|
-
|
83
|
-
# Builds the object from hash
|
84
|
-
# @param [Hash] attributes Model attributes in the form of hash
|
85
|
-
# @return [Object] Returns the model itself
|
86
|
-
def build_from_hash(attributes)
|
87
|
-
return nil unless attributes.is_a?(Hash)
|
88
|
-
self.class.swagger_types.each_pair do |key, type|
|
89
|
-
if type =~ /\AArray<(.*)>/i
|
90
|
-
# check to ensure the input is an array given that the the attribute
|
91
|
-
# is documented as an array but the input is not
|
92
|
-
if attributes[self.class.attribute_map[key]].is_a?(Array)
|
93
|
-
self.send("#{key}=", attributes[self.class.attribute_map[key]].map{ |v| _deserialize($1, v) } )
|
94
|
-
end
|
95
|
-
elsif !attributes[self.class.attribute_map[key]].nil?
|
96
|
-
self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
|
97
|
-
end # or else data not found in attributes(hash), not an issue as the data can be optional
|
98
|
-
end
|
99
|
-
|
100
|
-
self
|
101
|
-
end
|
102
|
-
|
103
|
-
# Deserializes the data based on type
|
104
|
-
# @param string type Data type
|
105
|
-
# @param string value Value to be deserialized
|
106
|
-
# @return [Object] Deserialized data
|
107
|
-
def _deserialize(type, value)
|
108
|
-
case type.to_sym
|
109
|
-
when :DateTime
|
110
|
-
DateTime.parse(value)
|
111
|
-
when :Date
|
112
|
-
Date.parse(value)
|
113
|
-
when :String
|
114
|
-
value.to_s
|
115
|
-
when :Integer
|
116
|
-
value.to_i
|
117
|
-
when :Float
|
118
|
-
value.to_f
|
119
|
-
when :BOOLEAN
|
120
|
-
if value.to_s =~ /\A(true|t|yes|y|1)\z/i
|
121
|
-
true
|
122
|
-
else
|
123
|
-
false
|
124
|
-
end
|
125
|
-
when :Object
|
126
|
-
# generic object (usually a Hash), return directly
|
127
|
-
value
|
128
|
-
when /\AArray<(?<inner_type>.+)>\z/
|
129
|
-
inner_type = Regexp.last_match[:inner_type]
|
130
|
-
value.map { |v| _deserialize(inner_type, v) }
|
131
|
-
when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
|
132
|
-
k_type = Regexp.last_match[:k_type]
|
133
|
-
v_type = Regexp.last_match[:v_type]
|
134
|
-
{}.tap do |hash|
|
135
|
-
value.each do |k, v|
|
136
|
-
hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
|
137
|
-
end
|
138
|
-
end
|
139
|
-
else # model
|
140
|
-
temp_model = Pdf4me.const_get(type).new
|
141
|
-
temp_model.build_from_hash(value)
|
142
|
-
end
|
143
|
-
end
|
144
|
-
|
145
|
-
# Returns the string representation of the object
|
146
|
-
# @return [String] String presentation of the object
|
147
|
-
def to_s
|
148
|
-
to_hash.to_s
|
149
|
-
end
|
150
|
-
|
151
|
-
# to_body is an alias to to_hash (backward compatibility)
|
152
|
-
# @return [Hash] Returns the object in the form of hash
|
153
|
-
def to_body
|
154
|
-
to_hash
|
155
|
-
end
|
156
|
-
|
157
|
-
# Returns the object in the form of hash
|
158
|
-
# @return [Hash] Returns the object in the form of hash
|
159
|
-
def to_hash
|
160
|
-
hash = {}
|
161
|
-
self.class.attribute_map.each_pair do |attr, param|
|
162
|
-
value = self.send(attr)
|
163
|
-
next if value.nil?
|
164
|
-
hash[param] = _to_hash(value)
|
165
|
-
end
|
166
|
-
hash
|
167
|
-
end
|
168
|
-
|
169
|
-
# Outputs non-array value in the form of hash
|
170
|
-
# For object, use to_hash. Otherwise, just return the value
|
171
|
-
# @param [Object] value Any valid value
|
172
|
-
# @return [Hash] Returns the value in the form of hash
|
173
|
-
def _to_hash(value)
|
174
|
-
if value.is_a?(Array)
|
175
|
-
value.compact.map{ |v| _to_hash(v) }
|
176
|
-
elsif value.is_a?(Hash)
|
177
|
-
{}.tap do |hash|
|
178
|
-
value.each { |k, v| hash[k] = _to_hash(v) }
|
179
|
-
end
|
180
|
-
elsif value.respond_to? :to_hash
|
181
|
-
value.to_hash
|
182
|
-
else
|
183
|
-
value
|
184
|
-
end
|
185
|
-
end
|
186
|
-
|
187
|
-
end
|
188
|
-
|
189
|
-
end
|
@@ -1,297 +0,0 @@
|
|
1
|
-
=begin
|
2
|
-
#DmsApi
|
3
|
-
|
4
|
-
#No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen)
|
5
|
-
|
6
|
-
OpenAPI spec version: v1
|
7
|
-
|
8
|
-
Generated by: https://github.com/swagger-api/swagger-codegen.git
|
9
|
-
Swagger Codegen version: 2.3.0
|
10
|
-
|
11
|
-
=end
|
12
|
-
|
13
|
-
require 'date'
|
14
|
-
|
15
|
-
module Pdf4me
|
16
|
-
# The CreatePdfA accepts files from many different applications and automatically converts them into PDF/A. The level of conformity can be set to level A, U, or B. ICC color profiles for device-dependent color profiles and font types are embedded in the document.There is an option to provide the entire character set for fonts (no subsetting) to facilitate editing at a later stage. Missing fonts are reproduced as close to the original as possible via font recognition. Metadata can be generated automatically or added from external sources. The tool also detects and automatically repairs problems typical of the PDF format.A digital signature can be applied and a conformity check carried out at the end of the process.
|
17
|
-
class PdfAAction
|
18
|
-
# By default, fonts that are embedded are automatically subset to minimize the file size. If for any reason, e.g. postprocessing, fonts shall not be subset, set the property SubsetFonts to false. Whether fonts are subset or not is irrelevant with respect to the compliance with PDF/A. (Relevant is only that all used glyphs are contained in the font program.) Additionals Fonts can be given in this FontsToSubset List
|
19
|
-
attr_accessor :fonts_to_subset
|
20
|
-
|
21
|
-
# Other listed entries (e.g. ePDF10, ePDF11, .. .ePDF17, ePDFUnk) are not supported as output compliance level. Some files cannot be converted to the compliance requested. This will be detected and up- (AllowUpgrade) or downgrade (AllowDowngrade) the compliance automatically.
|
22
|
-
attr_accessor :compliance
|
23
|
-
|
24
|
-
# If set to True, automatic downgrade of the PDF/A conformance level is allowed, e.g. from PDF/A-1a to PDF/A-1b. If this property is set to True, the level is downgraded under the following conditions: - Downgrade to level B: If a file contains text that is not extractable (i.e.missing ToUnicode information). Example: Downgrade PDF/A-2u to PDF/A-2b. - Downgrade to level U (PDF/A-2 and PDF/A-3) or B(PDF/A-1): Level A requires logical structure information and “tagging” information, so if a file contains no such information, its level is downgraded. <para> Logical structure information in a PDF defines the structure of content, such as titles, paragraphs, figures, reading order, tables or articles.Logical structure elements can be “tagged” with descriptions or alternative text. “Tagging” allows the contents of an image to be described to the visually impaired. It is not possible for Pdf/A converter to add meaningful tagging information. Adding tagging information without prior knowledge about the input file’s structure and content is neither possible nor allowed by the PDF/A standard. For that reason, the conformance level is automatically downgraded to level B or U. Example: Downgrade PDF/A-1a to PDF/A-1b. </para><para> If set to False and an input file cannot be converted to the requested standard, e.g.because of missing “tagging” information, the conversion is aborted and the ErrorCode set to PDF_E_DOWNGRADE. </para>
|
25
|
-
attr_accessor :allow_downgrade
|
26
|
-
|
27
|
-
# If set to True, automatic upgrade of the PDF/A version is allowed. If the target standard is PDF/A-1 and a file contains elements that cannot be converted to PDF/A-1, the target standard is upgraded to PDF/A-2. This avoids significant visual differences in the output file. For example, the following elements may lead to an automatic upgrade: - Transpanrecy - Optional content groups(OCG, layers) - Real values that exceed the implementation limit of PDF/A-1 - Embedded OpenType font files - Predefined CMap encodings in Type0 fonts If set to False, the compliance is not upgraded.Depeding on the value of the ConversionErrorMask the conversion this will fail with a conversion error PDF_E_CONVERSION
|
28
|
-
attr_accessor :allow_upgrade
|
29
|
-
|
30
|
-
# <para> Set or get the path to the ICC profile for the output intent. </para> <para> The given profile is embedded only if the input file does not contain a PDF/A output intent already </para>
|
31
|
-
attr_accessor :output_intent_profile
|
32
|
-
|
33
|
-
# <para> Get or set whether to linearize the PDF output file, i.e. optimize file for fast web access. A linearized document has a slightly larger file size than a non-linearized file and provides the following main features: - When a document is opened in a PDF viewer of a web browser, the first page can be viewed without downloading the entire PDF file.In contrast, a non-linearized PDF file must be downloaded completely before the firstpage can be displayed. - When another page is requested by the user, that page is displayed as quickly as possible and incrementally as data arrives, without downloading the entire PDF file. </para> <para> Signed files cannot be linearizes.So this property must be set to False if a digital signature is applied. </para>
|
34
|
-
attr_accessor :linearize
|
35
|
-
|
36
|
-
attr_accessor :custom_properties
|
37
|
-
|
38
|
-
class EnumAttributeValidator
|
39
|
-
attr_reader :datatype
|
40
|
-
attr_reader :allowable_values
|
41
|
-
|
42
|
-
def initialize(datatype, allowable_values)
|
43
|
-
@allowable_values = allowable_values.map do |value|
|
44
|
-
case datatype.to_s
|
45
|
-
when /Integer/i
|
46
|
-
value.to_i
|
47
|
-
when /Float/i
|
48
|
-
value.to_f
|
49
|
-
else
|
50
|
-
value
|
51
|
-
end
|
52
|
-
end
|
53
|
-
end
|
54
|
-
|
55
|
-
def valid?(value)
|
56
|
-
!value || allowable_values.include?(value)
|
57
|
-
end
|
58
|
-
end
|
59
|
-
|
60
|
-
# Attribute mapping from ruby-style variable name to JSON key.
|
61
|
-
def self.attribute_map
|
62
|
-
{
|
63
|
-
:'fonts_to_subset' => :'fontsToSubset',
|
64
|
-
:'compliance' => :'compliance',
|
65
|
-
:'allow_downgrade' => :'allowDowngrade',
|
66
|
-
:'allow_upgrade' => :'allowUpgrade',
|
67
|
-
:'output_intent_profile' => :'outputIntentProfile',
|
68
|
-
:'linearize' => :'linearize',
|
69
|
-
:'custom_properties' => :'customProperties'
|
70
|
-
}
|
71
|
-
end
|
72
|
-
|
73
|
-
# Attribute type mapping.
|
74
|
-
def self.swagger_types
|
75
|
-
{
|
76
|
-
:'fonts_to_subset' => :'Array<PdfFont>',
|
77
|
-
:'compliance' => :'String',
|
78
|
-
:'allow_downgrade' => :'BOOLEAN',
|
79
|
-
:'allow_upgrade' => :'BOOLEAN',
|
80
|
-
:'output_intent_profile' => :'String',
|
81
|
-
:'linearize' => :'BOOLEAN',
|
82
|
-
:'custom_properties' => :'Array<KeyValuePairStringString>'
|
83
|
-
}
|
84
|
-
end
|
85
|
-
|
86
|
-
# Initializes the object
|
87
|
-
# @param [Hash] attributes Model attributes in the form of hash
|
88
|
-
def initialize(attributes = {})
|
89
|
-
return unless attributes.is_a?(Hash)
|
90
|
-
|
91
|
-
# convert string to symbol for hash key
|
92
|
-
attributes = attributes.each_with_object({}){|(k,v), h| h[k.to_sym] = v}
|
93
|
-
|
94
|
-
if attributes.has_key?(:'fontsToSubset')
|
95
|
-
if (value = attributes[:'fontsToSubset']).is_a?(Array)
|
96
|
-
self.fonts_to_subset = value
|
97
|
-
end
|
98
|
-
end
|
99
|
-
|
100
|
-
if attributes.has_key?(:'compliance')
|
101
|
-
self.compliance = attributes[:'compliance']
|
102
|
-
end
|
103
|
-
|
104
|
-
if attributes.has_key?(:'allowDowngrade')
|
105
|
-
self.allow_downgrade = attributes[:'allowDowngrade']
|
106
|
-
end
|
107
|
-
|
108
|
-
if attributes.has_key?(:'allowUpgrade')
|
109
|
-
self.allow_upgrade = attributes[:'allowUpgrade']
|
110
|
-
end
|
111
|
-
|
112
|
-
if attributes.has_key?(:'outputIntentProfile')
|
113
|
-
self.output_intent_profile = attributes[:'outputIntentProfile']
|
114
|
-
end
|
115
|
-
|
116
|
-
if attributes.has_key?(:'linearize')
|
117
|
-
self.linearize = attributes[:'linearize']
|
118
|
-
end
|
119
|
-
|
120
|
-
if attributes.has_key?(:'customProperties')
|
121
|
-
if (value = attributes[:'customProperties']).is_a?(Array)
|
122
|
-
self.custom_properties = value
|
123
|
-
end
|
124
|
-
end
|
125
|
-
|
126
|
-
end
|
127
|
-
|
128
|
-
# Show invalid properties with the reasons. Usually used together with valid?
|
129
|
-
# @return Array for valid properties with the reasons
|
130
|
-
def list_invalid_properties
|
131
|
-
invalid_properties = Array.new
|
132
|
-
return invalid_properties
|
133
|
-
end
|
134
|
-
|
135
|
-
# Check to see if the all the properties in the model are valid
|
136
|
-
# @return true if the model is valid
|
137
|
-
def valid?
|
138
|
-
compliance_validator = EnumAttributeValidator.new('String', ["pdfA1b", "pdfA1a", "pdfA2b", "pdfA2u", "pdfA2a", "pdfA3b", "pdfA3u", "pdfA3a"])
|
139
|
-
return false unless compliance_validator.valid?(@compliance)
|
140
|
-
output_intent_profile_validator = EnumAttributeValidator.new('String', ["notSet", "sRGBColorSpace"])
|
141
|
-
return false unless output_intent_profile_validator.valid?(@output_intent_profile)
|
142
|
-
return true
|
143
|
-
end
|
144
|
-
|
145
|
-
# Custom attribute writer method checking allowed values (enum).
|
146
|
-
# @param [Object] compliance Object to be assigned
|
147
|
-
def compliance=(compliance)
|
148
|
-
validator = EnumAttributeValidator.new('String', ["pdfA1b", "pdfA1a", "pdfA2b", "pdfA2u", "pdfA2a", "pdfA3b", "pdfA3u", "pdfA3a"])
|
149
|
-
unless validator.valid?(compliance)
|
150
|
-
fail ArgumentError, "invalid value for 'compliance', must be one of #{validator.allowable_values}."
|
151
|
-
end
|
152
|
-
@compliance = compliance
|
153
|
-
end
|
154
|
-
|
155
|
-
# Custom attribute writer method checking allowed values (enum).
|
156
|
-
# @param [Object] output_intent_profile Object to be assigned
|
157
|
-
def output_intent_profile=(output_intent_profile)
|
158
|
-
validator = EnumAttributeValidator.new('String', ["notSet", "sRGBColorSpace"])
|
159
|
-
unless validator.valid?(output_intent_profile)
|
160
|
-
fail ArgumentError, "invalid value for 'output_intent_profile', must be one of #{validator.allowable_values}."
|
161
|
-
end
|
162
|
-
@output_intent_profile = output_intent_profile
|
163
|
-
end
|
164
|
-
|
165
|
-
# Checks equality by comparing each attribute.
|
166
|
-
# @param [Object] Object to be compared
|
167
|
-
def ==(o)
|
168
|
-
return true if self.equal?(o)
|
169
|
-
self.class == o.class &&
|
170
|
-
fonts_to_subset == o.fonts_to_subset &&
|
171
|
-
compliance == o.compliance &&
|
172
|
-
allow_downgrade == o.allow_downgrade &&
|
173
|
-
allow_upgrade == o.allow_upgrade &&
|
174
|
-
output_intent_profile == o.output_intent_profile &&
|
175
|
-
linearize == o.linearize &&
|
176
|
-
custom_properties == o.custom_properties
|
177
|
-
end
|
178
|
-
|
179
|
-
# @see the `==` method
|
180
|
-
# @param [Object] Object to be compared
|
181
|
-
def eql?(o)
|
182
|
-
self == o
|
183
|
-
end
|
184
|
-
|
185
|
-
# Calculates hash code according to all attributes.
|
186
|
-
# @return [Fixnum] Hash code
|
187
|
-
def hash
|
188
|
-
[fonts_to_subset, compliance, allow_downgrade, allow_upgrade, output_intent_profile, linearize, custom_properties].hash
|
189
|
-
end
|
190
|
-
|
191
|
-
# Builds the object from hash
|
192
|
-
# @param [Hash] attributes Model attributes in the form of hash
|
193
|
-
# @return [Object] Returns the model itself
|
194
|
-
def build_from_hash(attributes)
|
195
|
-
return nil unless attributes.is_a?(Hash)
|
196
|
-
self.class.swagger_types.each_pair do |key, type|
|
197
|
-
if type =~ /\AArray<(.*)>/i
|
198
|
-
# check to ensure the input is an array given that the the attribute
|
199
|
-
# is documented as an array but the input is not
|
200
|
-
if attributes[self.class.attribute_map[key]].is_a?(Array)
|
201
|
-
self.send("#{key}=", attributes[self.class.attribute_map[key]].map{ |v| _deserialize($1, v) } )
|
202
|
-
end
|
203
|
-
elsif !attributes[self.class.attribute_map[key]].nil?
|
204
|
-
self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
|
205
|
-
end # or else data not found in attributes(hash), not an issue as the data can be optional
|
206
|
-
end
|
207
|
-
|
208
|
-
self
|
209
|
-
end
|
210
|
-
|
211
|
-
# Deserializes the data based on type
|
212
|
-
# @param string type Data type
|
213
|
-
# @param string value Value to be deserialized
|
214
|
-
# @return [Object] Deserialized data
|
215
|
-
def _deserialize(type, value)
|
216
|
-
case type.to_sym
|
217
|
-
when :DateTime
|
218
|
-
DateTime.parse(value)
|
219
|
-
when :Date
|
220
|
-
Date.parse(value)
|
221
|
-
when :String
|
222
|
-
value.to_s
|
223
|
-
when :Integer
|
224
|
-
value.to_i
|
225
|
-
when :Float
|
226
|
-
value.to_f
|
227
|
-
when :BOOLEAN
|
228
|
-
if value.to_s =~ /\A(true|t|yes|y|1)\z/i
|
229
|
-
true
|
230
|
-
else
|
231
|
-
false
|
232
|
-
end
|
233
|
-
when :Object
|
234
|
-
# generic object (usually a Hash), return directly
|
235
|
-
value
|
236
|
-
when /\AArray<(?<inner_type>.+)>\z/
|
237
|
-
inner_type = Regexp.last_match[:inner_type]
|
238
|
-
value.map { |v| _deserialize(inner_type, v) }
|
239
|
-
when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
|
240
|
-
k_type = Regexp.last_match[:k_type]
|
241
|
-
v_type = Regexp.last_match[:v_type]
|
242
|
-
{}.tap do |hash|
|
243
|
-
value.each do |k, v|
|
244
|
-
hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
|
245
|
-
end
|
246
|
-
end
|
247
|
-
else # model
|
248
|
-
temp_model = Pdf4me.const_get(type).new
|
249
|
-
temp_model.build_from_hash(value)
|
250
|
-
end
|
251
|
-
end
|
252
|
-
|
253
|
-
# Returns the string representation of the object
|
254
|
-
# @return [String] String presentation of the object
|
255
|
-
def to_s
|
256
|
-
to_hash.to_s
|
257
|
-
end
|
258
|
-
|
259
|
-
# to_body is an alias to to_hash (backward compatibility)
|
260
|
-
# @return [Hash] Returns the object in the form of hash
|
261
|
-
def to_body
|
262
|
-
to_hash
|
263
|
-
end
|
264
|
-
|
265
|
-
# Returns the object in the form of hash
|
266
|
-
# @return [Hash] Returns the object in the form of hash
|
267
|
-
def to_hash
|
268
|
-
hash = {}
|
269
|
-
self.class.attribute_map.each_pair do |attr, param|
|
270
|
-
value = self.send(attr)
|
271
|
-
next if value.nil?
|
272
|
-
hash[param] = _to_hash(value)
|
273
|
-
end
|
274
|
-
hash
|
275
|
-
end
|
276
|
-
|
277
|
-
# Outputs non-array value in the form of hash
|
278
|
-
# For object, use to_hash. Otherwise, just return the value
|
279
|
-
# @param [Object] value Any valid value
|
280
|
-
# @return [Hash] Returns the value in the form of hash
|
281
|
-
def _to_hash(value)
|
282
|
-
if value.is_a?(Array)
|
283
|
-
value.compact.map{ |v| _to_hash(v) }
|
284
|
-
elsif value.is_a?(Hash)
|
285
|
-
{}.tap do |hash|
|
286
|
-
value.each { |k, v| hash[k] = _to_hash(v) }
|
287
|
-
end
|
288
|
-
elsif value.respond_to? :to_hash
|
289
|
-
value.to_hash
|
290
|
-
else
|
291
|
-
value
|
292
|
-
end
|
293
|
-
end
|
294
|
-
|
295
|
-
end
|
296
|
-
|
297
|
-
end
|