pdf4me 1.0.1 → 2.0.1
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/{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,190 +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
|
-
|
17
|
-
class SplitRes
|
18
|
-
attr_accessor :documents
|
19
|
-
|
20
|
-
|
21
|
-
# Attribute mapping from ruby-style variable name to JSON key.
|
22
|
-
def self.attribute_map
|
23
|
-
{
|
24
|
-
:'documents' => :'documents'
|
25
|
-
}
|
26
|
-
end
|
27
|
-
|
28
|
-
# Attribute type mapping.
|
29
|
-
def self.swagger_types
|
30
|
-
{
|
31
|
-
:'documents' => :'Array<Document>'
|
32
|
-
}
|
33
|
-
end
|
34
|
-
|
35
|
-
# Initializes the object
|
36
|
-
# @param [Hash] attributes Model attributes in the form of hash
|
37
|
-
def initialize(attributes = {})
|
38
|
-
return unless attributes.is_a?(Hash)
|
39
|
-
|
40
|
-
# convert string to symbol for hash key
|
41
|
-
attributes = attributes.each_with_object({}){|(k,v), h| h[k.to_sym] = v}
|
42
|
-
|
43
|
-
if attributes.has_key?(:'documents')
|
44
|
-
if (value = attributes[:'documents']).is_a?(Array)
|
45
|
-
self.documents = value
|
46
|
-
end
|
47
|
-
end
|
48
|
-
|
49
|
-
end
|
50
|
-
|
51
|
-
# Show invalid properties with the reasons. Usually used together with valid?
|
52
|
-
# @return Array for valid properties with the reasons
|
53
|
-
def list_invalid_properties
|
54
|
-
invalid_properties = Array.new
|
55
|
-
return invalid_properties
|
56
|
-
end
|
57
|
-
|
58
|
-
# Check to see if the all the properties in the model are valid
|
59
|
-
# @return true if the model is valid
|
60
|
-
def valid?
|
61
|
-
return true
|
62
|
-
end
|
63
|
-
|
64
|
-
# Checks equality by comparing each attribute.
|
65
|
-
# @param [Object] Object to be compared
|
66
|
-
def ==(o)
|
67
|
-
return true if self.equal?(o)
|
68
|
-
self.class == o.class &&
|
69
|
-
documents == o.documents
|
70
|
-
end
|
71
|
-
|
72
|
-
# @see the `==` method
|
73
|
-
# @param [Object] Object to be compared
|
74
|
-
def eql?(o)
|
75
|
-
self == o
|
76
|
-
end
|
77
|
-
|
78
|
-
# Calculates hash code according to all attributes.
|
79
|
-
# @return [Fixnum] Hash code
|
80
|
-
def hash
|
81
|
-
[documents].hash
|
82
|
-
end
|
83
|
-
|
84
|
-
# Builds the object from hash
|
85
|
-
# @param [Hash] attributes Model attributes in the form of hash
|
86
|
-
# @return [Object] Returns the model itself
|
87
|
-
def build_from_hash(attributes)
|
88
|
-
return nil unless attributes.is_a?(Hash)
|
89
|
-
self.class.swagger_types.each_pair do |key, type|
|
90
|
-
if type =~ /\AArray<(.*)>/i
|
91
|
-
# check to ensure the input is an array given that the the attribute
|
92
|
-
# is documented as an array but the input is not
|
93
|
-
if attributes[self.class.attribute_map[key]].is_a?(Array)
|
94
|
-
self.send("#{key}=", attributes[self.class.attribute_map[key]].map{ |v| _deserialize($1, v) } )
|
95
|
-
end
|
96
|
-
elsif !attributes[self.class.attribute_map[key]].nil?
|
97
|
-
self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
|
98
|
-
end # or else data not found in attributes(hash), not an issue as the data can be optional
|
99
|
-
end
|
100
|
-
|
101
|
-
self
|
102
|
-
end
|
103
|
-
|
104
|
-
# Deserializes the data based on type
|
105
|
-
# @param string type Data type
|
106
|
-
# @param string value Value to be deserialized
|
107
|
-
# @return [Object] Deserialized data
|
108
|
-
def _deserialize(type, value)
|
109
|
-
case type.to_sym
|
110
|
-
when :DateTime
|
111
|
-
DateTime.parse(value)
|
112
|
-
when :Date
|
113
|
-
Date.parse(value)
|
114
|
-
when :String
|
115
|
-
value.to_s
|
116
|
-
when :Integer
|
117
|
-
value.to_i
|
118
|
-
when :Float
|
119
|
-
value.to_f
|
120
|
-
when :BOOLEAN
|
121
|
-
if value.to_s =~ /\A(true|t|yes|y|1)\z/i
|
122
|
-
true
|
123
|
-
else
|
124
|
-
false
|
125
|
-
end
|
126
|
-
when :Object
|
127
|
-
# generic object (usually a Hash), return directly
|
128
|
-
value
|
129
|
-
when /\AArray<(?<inner_type>.+)>\z/
|
130
|
-
inner_type = Regexp.last_match[:inner_type]
|
131
|
-
value.map { |v| _deserialize(inner_type, v) }
|
132
|
-
when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
|
133
|
-
k_type = Regexp.last_match[:k_type]
|
134
|
-
v_type = Regexp.last_match[:v_type]
|
135
|
-
{}.tap do |hash|
|
136
|
-
value.each do |k, v|
|
137
|
-
hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
|
138
|
-
end
|
139
|
-
end
|
140
|
-
else # model
|
141
|
-
temp_model = Pdf4me.const_get(type).new
|
142
|
-
temp_model.build_from_hash(value)
|
143
|
-
end
|
144
|
-
end
|
145
|
-
|
146
|
-
# Returns the string representation of the object
|
147
|
-
# @return [String] String presentation of the object
|
148
|
-
def to_s
|
149
|
-
to_hash.to_s
|
150
|
-
end
|
151
|
-
|
152
|
-
# to_body is an alias to to_hash (backward compatibility)
|
153
|
-
# @return [Hash] Returns the object in the form of hash
|
154
|
-
def to_body
|
155
|
-
to_hash
|
156
|
-
end
|
157
|
-
|
158
|
-
# Returns the object in the form of hash
|
159
|
-
# @return [Hash] Returns the object in the form of hash
|
160
|
-
def to_hash
|
161
|
-
hash = {}
|
162
|
-
self.class.attribute_map.each_pair do |attr, param|
|
163
|
-
value = self.send(attr)
|
164
|
-
next if value.nil?
|
165
|
-
hash[param] = _to_hash(value)
|
166
|
-
end
|
167
|
-
hash
|
168
|
-
end
|
169
|
-
|
170
|
-
# Outputs non-array value in the form of hash
|
171
|
-
# For object, use to_hash. Otherwise, just return the value
|
172
|
-
# @param [Object] value Any valid value
|
173
|
-
# @return [Hash] Returns the value in the form of hash
|
174
|
-
def _to_hash(value)
|
175
|
-
if value.is_a?(Array)
|
176
|
-
value.compact.map{ |v| _to_hash(v) }
|
177
|
-
elsif value.is_a?(Hash)
|
178
|
-
{}.tap do |hash|
|
179
|
-
value.each { |k, v| hash[k] = _to_hash(v) }
|
180
|
-
end
|
181
|
-
elsif value.respond_to? :to_hash
|
182
|
-
value.to_hash
|
183
|
-
else
|
184
|
-
value
|
185
|
-
end
|
186
|
-
end
|
187
|
-
|
188
|
-
end
|
189
|
-
|
190
|
-
end
|
data/lib/pdf4me/models/stamp.rb
DELETED
@@ -1,209 +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
|
-
# Stamp Request with core data to stamp
|
17
|
-
class Stamp
|
18
|
-
# Give the document to change or use JobId/DocumentId to reference an uploaded document.
|
19
|
-
attr_accessor :document
|
20
|
-
|
21
|
-
# Give an image stamp
|
22
|
-
attr_accessor :stamp_action
|
23
|
-
|
24
|
-
# Set Notification
|
25
|
-
attr_accessor :notification
|
26
|
-
|
27
|
-
|
28
|
-
# Attribute mapping from ruby-style variable name to JSON key.
|
29
|
-
def self.attribute_map
|
30
|
-
{
|
31
|
-
:'document' => :'document',
|
32
|
-
:'stamp_action' => :'stampAction',
|
33
|
-
:'notification' => :'notification'
|
34
|
-
}
|
35
|
-
end
|
36
|
-
|
37
|
-
# Attribute type mapping.
|
38
|
-
def self.swagger_types
|
39
|
-
{
|
40
|
-
:'document' => :'Document',
|
41
|
-
:'stamp_action' => :'StampAction',
|
42
|
-
:'notification' => :'Notification'
|
43
|
-
}
|
44
|
-
end
|
45
|
-
|
46
|
-
# Initializes the object
|
47
|
-
# @param [Hash] attributes Model attributes in the form of hash
|
48
|
-
def initialize(attributes = {})
|
49
|
-
return unless attributes.is_a?(Hash)
|
50
|
-
|
51
|
-
# convert string to symbol for hash key
|
52
|
-
attributes = attributes.each_with_object({}){|(k,v), h| h[k.to_sym] = v}
|
53
|
-
|
54
|
-
if attributes.has_key?(:'document')
|
55
|
-
self.document = attributes[:'document']
|
56
|
-
end
|
57
|
-
|
58
|
-
if attributes.has_key?(:'stampAction')
|
59
|
-
self.stamp_action = attributes[:'stampAction']
|
60
|
-
end
|
61
|
-
|
62
|
-
if attributes.has_key?(:'notification')
|
63
|
-
self.notification = attributes[:'notification']
|
64
|
-
end
|
65
|
-
|
66
|
-
end
|
67
|
-
|
68
|
-
# Show invalid properties with the reasons. Usually used together with valid?
|
69
|
-
# @return Array for valid properties with the reasons
|
70
|
-
def list_invalid_properties
|
71
|
-
invalid_properties = Array.new
|
72
|
-
return invalid_properties
|
73
|
-
end
|
74
|
-
|
75
|
-
# Check to see if the all the properties in the model are valid
|
76
|
-
# @return true if the model is valid
|
77
|
-
def valid?
|
78
|
-
return true
|
79
|
-
end
|
80
|
-
|
81
|
-
# Checks equality by comparing each attribute.
|
82
|
-
# @param [Object] Object to be compared
|
83
|
-
def ==(o)
|
84
|
-
return true if self.equal?(o)
|
85
|
-
self.class == o.class &&
|
86
|
-
document == o.document &&
|
87
|
-
stamp_action == o.stamp_action &&
|
88
|
-
notification == o.notification
|
89
|
-
end
|
90
|
-
|
91
|
-
# @see the `==` method
|
92
|
-
# @param [Object] Object to be compared
|
93
|
-
def eql?(o)
|
94
|
-
self == o
|
95
|
-
end
|
96
|
-
|
97
|
-
# Calculates hash code according to all attributes.
|
98
|
-
# @return [Fixnum] Hash code
|
99
|
-
def hash
|
100
|
-
[document, stamp_action, notification].hash
|
101
|
-
end
|
102
|
-
|
103
|
-
# Builds the object from hash
|
104
|
-
# @param [Hash] attributes Model attributes in the form of hash
|
105
|
-
# @return [Object] Returns the model itself
|
106
|
-
def build_from_hash(attributes)
|
107
|
-
return nil unless attributes.is_a?(Hash)
|
108
|
-
self.class.swagger_types.each_pair do |key, type|
|
109
|
-
if type =~ /\AArray<(.*)>/i
|
110
|
-
# check to ensure the input is an array given that the the attribute
|
111
|
-
# is documented as an array but the input is not
|
112
|
-
if attributes[self.class.attribute_map[key]].is_a?(Array)
|
113
|
-
self.send("#{key}=", attributes[self.class.attribute_map[key]].map{ |v| _deserialize($1, v) } )
|
114
|
-
end
|
115
|
-
elsif !attributes[self.class.attribute_map[key]].nil?
|
116
|
-
self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
|
117
|
-
end # or else data not found in attributes(hash), not an issue as the data can be optional
|
118
|
-
end
|
119
|
-
|
120
|
-
self
|
121
|
-
end
|
122
|
-
|
123
|
-
# Deserializes the data based on type
|
124
|
-
# @param string type Data type
|
125
|
-
# @param string value Value to be deserialized
|
126
|
-
# @return [Object] Deserialized data
|
127
|
-
def _deserialize(type, value)
|
128
|
-
case type.to_sym
|
129
|
-
when :DateTime
|
130
|
-
DateTime.parse(value)
|
131
|
-
when :Date
|
132
|
-
Date.parse(value)
|
133
|
-
when :String
|
134
|
-
value.to_s
|
135
|
-
when :Integer
|
136
|
-
value.to_i
|
137
|
-
when :Float
|
138
|
-
value.to_f
|
139
|
-
when :BOOLEAN
|
140
|
-
if value.to_s =~ /\A(true|t|yes|y|1)\z/i
|
141
|
-
true
|
142
|
-
else
|
143
|
-
false
|
144
|
-
end
|
145
|
-
when :Object
|
146
|
-
# generic object (usually a Hash), return directly
|
147
|
-
value
|
148
|
-
when /\AArray<(?<inner_type>.+)>\z/
|
149
|
-
inner_type = Regexp.last_match[:inner_type]
|
150
|
-
value.map { |v| _deserialize(inner_type, v) }
|
151
|
-
when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
|
152
|
-
k_type = Regexp.last_match[:k_type]
|
153
|
-
v_type = Regexp.last_match[:v_type]
|
154
|
-
{}.tap do |hash|
|
155
|
-
value.each do |k, v|
|
156
|
-
hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
|
157
|
-
end
|
158
|
-
end
|
159
|
-
else # model
|
160
|
-
temp_model = Pdf4me.const_get(type).new
|
161
|
-
temp_model.build_from_hash(value)
|
162
|
-
end
|
163
|
-
end
|
164
|
-
|
165
|
-
# Returns the string representation of the object
|
166
|
-
# @return [String] String presentation of the object
|
167
|
-
def to_s
|
168
|
-
to_hash.to_s
|
169
|
-
end
|
170
|
-
|
171
|
-
# to_body is an alias to to_hash (backward compatibility)
|
172
|
-
# @return [Hash] Returns the object in the form of hash
|
173
|
-
def to_body
|
174
|
-
to_hash
|
175
|
-
end
|
176
|
-
|
177
|
-
# Returns the object in the form of hash
|
178
|
-
# @return [Hash] Returns the object in the form of hash
|
179
|
-
def to_hash
|
180
|
-
hash = {}
|
181
|
-
self.class.attribute_map.each_pair do |attr, param|
|
182
|
-
value = self.send(attr)
|
183
|
-
next if value.nil?
|
184
|
-
hash[param] = _to_hash(value)
|
185
|
-
end
|
186
|
-
hash
|
187
|
-
end
|
188
|
-
|
189
|
-
# Outputs non-array value in the form of hash
|
190
|
-
# For object, use to_hash. Otherwise, just return the value
|
191
|
-
# @param [Object] value Any valid value
|
192
|
-
# @return [Hash] Returns the value in the form of hash
|
193
|
-
def _to_hash(value)
|
194
|
-
if value.is_a?(Array)
|
195
|
-
value.compact.map{ |v| _to_hash(v) }
|
196
|
-
elsif value.is_a?(Hash)
|
197
|
-
{}.tap do |hash|
|
198
|
-
value.each { |k, v| hash[k] = _to_hash(v) }
|
199
|
-
end
|
200
|
-
elsif value.respond_to? :to_hash
|
201
|
-
value.to_hash
|
202
|
-
else
|
203
|
-
value
|
204
|
-
end
|
205
|
-
end
|
206
|
-
|
207
|
-
end
|
208
|
-
|
209
|
-
end
|
@@ -1,387 +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
|
-
# Define Stamp to place on Document
|
17
|
-
class StampAction
|
18
|
-
attr_accessor :page_sequence
|
19
|
-
|
20
|
-
attr_accessor :relative_pos_x
|
21
|
-
|
22
|
-
attr_accessor :relative_pos_y
|
23
|
-
|
24
|
-
attr_accessor :size_x
|
25
|
-
|
26
|
-
attr_accessor :size_y
|
27
|
-
|
28
|
-
attr_accessor :rotate
|
29
|
-
|
30
|
-
attr_accessor :autoorientation
|
31
|
-
|
32
|
-
# The opacity of the stamp as a whole. 1.0 for fully opaque, 0.0 for fully transparent. Default: 1.0 The PDF/A-1 standard does not allow transparency.Therefore, for PDF/A-1 conforming input files you must not set alpha to a value other than 1.0
|
33
|
-
attr_accessor :alpha
|
34
|
-
|
35
|
-
# Modify scale of stamp. Allowed values for ‹scale_set› are: - relToA4: Scale the stamp relative to the page size. For example, make stamp half as large on a A5 and twice as large on a A3 page as specified.
|
36
|
-
attr_accessor :scale
|
37
|
-
|
38
|
-
attr_accessor :align_x
|
39
|
-
|
40
|
-
attr_accessor :align_y
|
41
|
-
|
42
|
-
attr_accessor :stamp_type
|
43
|
-
|
44
|
-
attr_accessor :text
|
45
|
-
|
46
|
-
attr_accessor :image
|
47
|
-
|
48
|
-
attr_accessor :custom_properties
|
49
|
-
|
50
|
-
class EnumAttributeValidator
|
51
|
-
attr_reader :datatype
|
52
|
-
attr_reader :allowable_values
|
53
|
-
|
54
|
-
def initialize(datatype, allowable_values)
|
55
|
-
@allowable_values = allowable_values.map do |value|
|
56
|
-
case datatype.to_s
|
57
|
-
when /Integer/i
|
58
|
-
value.to_i
|
59
|
-
when /Float/i
|
60
|
-
value.to_f
|
61
|
-
else
|
62
|
-
value
|
63
|
-
end
|
64
|
-
end
|
65
|
-
end
|
66
|
-
|
67
|
-
def valid?(value)
|
68
|
-
!value || allowable_values.include?(value)
|
69
|
-
end
|
70
|
-
end
|
71
|
-
|
72
|
-
# Attribute mapping from ruby-style variable name to JSON key.
|
73
|
-
def self.attribute_map
|
74
|
-
{
|
75
|
-
:'page_sequence' => :'pageSequence',
|
76
|
-
:'relative_pos_x' => :'relativePosX',
|
77
|
-
:'relative_pos_y' => :'relativePosY',
|
78
|
-
:'size_x' => :'sizeX',
|
79
|
-
:'size_y' => :'sizeY',
|
80
|
-
:'rotate' => :'rotate',
|
81
|
-
:'autoorientation' => :'autoorientation',
|
82
|
-
:'alpha' => :'alpha',
|
83
|
-
:'scale' => :'scale',
|
84
|
-
:'align_x' => :'alignX',
|
85
|
-
:'align_y' => :'alignY',
|
86
|
-
:'stamp_type' => :'stampType',
|
87
|
-
:'text' => :'text',
|
88
|
-
:'image' => :'image',
|
89
|
-
:'custom_properties' => :'customProperties'
|
90
|
-
}
|
91
|
-
end
|
92
|
-
|
93
|
-
# Attribute type mapping.
|
94
|
-
def self.swagger_types
|
95
|
-
{
|
96
|
-
:'page_sequence' => :'String',
|
97
|
-
:'relative_pos_x' => :'Integer',
|
98
|
-
:'relative_pos_y' => :'Integer',
|
99
|
-
:'size_x' => :'Integer',
|
100
|
-
:'size_y' => :'Integer',
|
101
|
-
:'rotate' => :'Float',
|
102
|
-
:'autoorientation' => :'BOOLEAN',
|
103
|
-
:'alpha' => :'Float',
|
104
|
-
:'scale' => :'String',
|
105
|
-
:'align_x' => :'String',
|
106
|
-
:'align_y' => :'String',
|
107
|
-
:'stamp_type' => :'String',
|
108
|
-
:'text' => :'Text',
|
109
|
-
:'image' => :'Image',
|
110
|
-
:'custom_properties' => :'Array<KeyValuePairStringString>'
|
111
|
-
}
|
112
|
-
end
|
113
|
-
|
114
|
-
# Initializes the object
|
115
|
-
# @param [Hash] attributes Model attributes in the form of hash
|
116
|
-
def initialize(attributes = {})
|
117
|
-
return unless attributes.is_a?(Hash)
|
118
|
-
|
119
|
-
# convert string to symbol for hash key
|
120
|
-
attributes = attributes.each_with_object({}){|(k,v), h| h[k.to_sym] = v}
|
121
|
-
|
122
|
-
if attributes.has_key?(:'pageSequence')
|
123
|
-
self.page_sequence = attributes[:'pageSequence']
|
124
|
-
end
|
125
|
-
|
126
|
-
if attributes.has_key?(:'relativePosX')
|
127
|
-
self.relative_pos_x = attributes[:'relativePosX']
|
128
|
-
end
|
129
|
-
|
130
|
-
if attributes.has_key?(:'relativePosY')
|
131
|
-
self.relative_pos_y = attributes[:'relativePosY']
|
132
|
-
end
|
133
|
-
|
134
|
-
if attributes.has_key?(:'sizeX')
|
135
|
-
self.size_x = attributes[:'sizeX']
|
136
|
-
end
|
137
|
-
|
138
|
-
if attributes.has_key?(:'sizeY')
|
139
|
-
self.size_y = attributes[:'sizeY']
|
140
|
-
end
|
141
|
-
|
142
|
-
if attributes.has_key?(:'rotate')
|
143
|
-
self.rotate = attributes[:'rotate']
|
144
|
-
end
|
145
|
-
|
146
|
-
if attributes.has_key?(:'autoorientation')
|
147
|
-
self.autoorientation = attributes[:'autoorientation']
|
148
|
-
end
|
149
|
-
|
150
|
-
if attributes.has_key?(:'alpha')
|
151
|
-
self.alpha = attributes[:'alpha']
|
152
|
-
end
|
153
|
-
|
154
|
-
if attributes.has_key?(:'scale')
|
155
|
-
self.scale = attributes[:'scale']
|
156
|
-
end
|
157
|
-
|
158
|
-
if attributes.has_key?(:'alignX')
|
159
|
-
self.align_x = attributes[:'alignX']
|
160
|
-
end
|
161
|
-
|
162
|
-
if attributes.has_key?(:'alignY')
|
163
|
-
self.align_y = attributes[:'alignY']
|
164
|
-
end
|
165
|
-
|
166
|
-
if attributes.has_key?(:'stampType')
|
167
|
-
self.stamp_type = attributes[:'stampType']
|
168
|
-
end
|
169
|
-
|
170
|
-
if attributes.has_key?(:'text')
|
171
|
-
self.text = attributes[:'text']
|
172
|
-
end
|
173
|
-
|
174
|
-
if attributes.has_key?(:'image')
|
175
|
-
self.image = attributes[:'image']
|
176
|
-
end
|
177
|
-
|
178
|
-
if attributes.has_key?(:'customProperties')
|
179
|
-
if (value = attributes[:'customProperties']).is_a?(Array)
|
180
|
-
self.custom_properties = value
|
181
|
-
end
|
182
|
-
end
|
183
|
-
|
184
|
-
end
|
185
|
-
|
186
|
-
# Show invalid properties with the reasons. Usually used together with valid?
|
187
|
-
# @return Array for valid properties with the reasons
|
188
|
-
def list_invalid_properties
|
189
|
-
invalid_properties = Array.new
|
190
|
-
return invalid_properties
|
191
|
-
end
|
192
|
-
|
193
|
-
# Check to see if the all the properties in the model are valid
|
194
|
-
# @return true if the model is valid
|
195
|
-
def valid?
|
196
|
-
scale_validator = EnumAttributeValidator.new('String', ["relToA4"])
|
197
|
-
return false unless scale_validator.valid?(@scale)
|
198
|
-
align_x_validator = EnumAttributeValidator.new('String', ["left", "center", "right"])
|
199
|
-
return false unless align_x_validator.valid?(@align_x)
|
200
|
-
align_y_validator = EnumAttributeValidator.new('String', ["top", "middle", "bottom"])
|
201
|
-
return false unless align_y_validator.valid?(@align_y)
|
202
|
-
stamp_type_validator = EnumAttributeValidator.new('String', ["annotation", "foreground", "background"])
|
203
|
-
return false unless stamp_type_validator.valid?(@stamp_type)
|
204
|
-
return true
|
205
|
-
end
|
206
|
-
|
207
|
-
# Custom attribute writer method checking allowed values (enum).
|
208
|
-
# @param [Object] scale Object to be assigned
|
209
|
-
def scale=(scale)
|
210
|
-
validator = EnumAttributeValidator.new('String', ["relToA4"])
|
211
|
-
unless validator.valid?(scale)
|
212
|
-
fail ArgumentError, "invalid value for 'scale', must be one of #{validator.allowable_values}."
|
213
|
-
end
|
214
|
-
@scale = scale
|
215
|
-
end
|
216
|
-
|
217
|
-
# Custom attribute writer method checking allowed values (enum).
|
218
|
-
# @param [Object] align_x Object to be assigned
|
219
|
-
def align_x=(align_x)
|
220
|
-
validator = EnumAttributeValidator.new('String', ["left", "center", "right"])
|
221
|
-
unless validator.valid?(align_x)
|
222
|
-
fail ArgumentError, "invalid value for 'align_x', must be one of #{validator.allowable_values}."
|
223
|
-
end
|
224
|
-
@align_x = align_x
|
225
|
-
end
|
226
|
-
|
227
|
-
# Custom attribute writer method checking allowed values (enum).
|
228
|
-
# @param [Object] align_y Object to be assigned
|
229
|
-
def align_y=(align_y)
|
230
|
-
validator = EnumAttributeValidator.new('String', ["top", "middle", "bottom"])
|
231
|
-
unless validator.valid?(align_y)
|
232
|
-
fail ArgumentError, "invalid value for 'align_y', must be one of #{validator.allowable_values}."
|
233
|
-
end
|
234
|
-
@align_y = align_y
|
235
|
-
end
|
236
|
-
|
237
|
-
# Custom attribute writer method checking allowed values (enum).
|
238
|
-
# @param [Object] stamp_type Object to be assigned
|
239
|
-
def stamp_type=(stamp_type)
|
240
|
-
validator = EnumAttributeValidator.new('String', ["annotation", "foreground", "background"])
|
241
|
-
unless validator.valid?(stamp_type)
|
242
|
-
fail ArgumentError, "invalid value for 'stamp_type', must be one of #{validator.allowable_values}."
|
243
|
-
end
|
244
|
-
@stamp_type = stamp_type
|
245
|
-
end
|
246
|
-
|
247
|
-
# Checks equality by comparing each attribute.
|
248
|
-
# @param [Object] Object to be compared
|
249
|
-
def ==(o)
|
250
|
-
return true if self.equal?(o)
|
251
|
-
self.class == o.class &&
|
252
|
-
page_sequence == o.page_sequence &&
|
253
|
-
relative_pos_x == o.relative_pos_x &&
|
254
|
-
relative_pos_y == o.relative_pos_y &&
|
255
|
-
size_x == o.size_x &&
|
256
|
-
size_y == o.size_y &&
|
257
|
-
rotate == o.rotate &&
|
258
|
-
autoorientation == o.autoorientation &&
|
259
|
-
alpha == o.alpha &&
|
260
|
-
scale == o.scale &&
|
261
|
-
align_x == o.align_x &&
|
262
|
-
align_y == o.align_y &&
|
263
|
-
stamp_type == o.stamp_type &&
|
264
|
-
text == o.text &&
|
265
|
-
image == o.image &&
|
266
|
-
custom_properties == o.custom_properties
|
267
|
-
end
|
268
|
-
|
269
|
-
# @see the `==` method
|
270
|
-
# @param [Object] Object to be compared
|
271
|
-
def eql?(o)
|
272
|
-
self == o
|
273
|
-
end
|
274
|
-
|
275
|
-
# Calculates hash code according to all attributes.
|
276
|
-
# @return [Fixnum] Hash code
|
277
|
-
def hash
|
278
|
-
[page_sequence, relative_pos_x, relative_pos_y, size_x, size_y, rotate, autoorientation, alpha, scale, align_x, align_y, stamp_type, text, image, custom_properties].hash
|
279
|
-
end
|
280
|
-
|
281
|
-
# Builds the object from hash
|
282
|
-
# @param [Hash] attributes Model attributes in the form of hash
|
283
|
-
# @return [Object] Returns the model itself
|
284
|
-
def build_from_hash(attributes)
|
285
|
-
return nil unless attributes.is_a?(Hash)
|
286
|
-
self.class.swagger_types.each_pair do |key, type|
|
287
|
-
if type =~ /\AArray<(.*)>/i
|
288
|
-
# check to ensure the input is an array given that the the attribute
|
289
|
-
# is documented as an array but the input is not
|
290
|
-
if attributes[self.class.attribute_map[key]].is_a?(Array)
|
291
|
-
self.send("#{key}=", attributes[self.class.attribute_map[key]].map{ |v| _deserialize($1, v) } )
|
292
|
-
end
|
293
|
-
elsif !attributes[self.class.attribute_map[key]].nil?
|
294
|
-
self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
|
295
|
-
end # or else data not found in attributes(hash), not an issue as the data can be optional
|
296
|
-
end
|
297
|
-
|
298
|
-
self
|
299
|
-
end
|
300
|
-
|
301
|
-
# Deserializes the data based on type
|
302
|
-
# @param string type Data type
|
303
|
-
# @param string value Value to be deserialized
|
304
|
-
# @return [Object] Deserialized data
|
305
|
-
def _deserialize(type, value)
|
306
|
-
case type.to_sym
|
307
|
-
when :DateTime
|
308
|
-
DateTime.parse(value)
|
309
|
-
when :Date
|
310
|
-
Date.parse(value)
|
311
|
-
when :String
|
312
|
-
value.to_s
|
313
|
-
when :Integer
|
314
|
-
value.to_i
|
315
|
-
when :Float
|
316
|
-
value.to_f
|
317
|
-
when :BOOLEAN
|
318
|
-
if value.to_s =~ /\A(true|t|yes|y|1)\z/i
|
319
|
-
true
|
320
|
-
else
|
321
|
-
false
|
322
|
-
end
|
323
|
-
when :Object
|
324
|
-
# generic object (usually a Hash), return directly
|
325
|
-
value
|
326
|
-
when /\AArray<(?<inner_type>.+)>\z/
|
327
|
-
inner_type = Regexp.last_match[:inner_type]
|
328
|
-
value.map { |v| _deserialize(inner_type, v) }
|
329
|
-
when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
|
330
|
-
k_type = Regexp.last_match[:k_type]
|
331
|
-
v_type = Regexp.last_match[:v_type]
|
332
|
-
{}.tap do |hash|
|
333
|
-
value.each do |k, v|
|
334
|
-
hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
|
335
|
-
end
|
336
|
-
end
|
337
|
-
else # model
|
338
|
-
temp_model = Pdf4me.const_get(type).new
|
339
|
-
temp_model.build_from_hash(value)
|
340
|
-
end
|
341
|
-
end
|
342
|
-
|
343
|
-
# Returns the string representation of the object
|
344
|
-
# @return [String] String presentation of the object
|
345
|
-
def to_s
|
346
|
-
to_hash.to_s
|
347
|
-
end
|
348
|
-
|
349
|
-
# to_body is an alias to to_hash (backward compatibility)
|
350
|
-
# @return [Hash] Returns the object in the form of hash
|
351
|
-
def to_body
|
352
|
-
to_hash
|
353
|
-
end
|
354
|
-
|
355
|
-
# Returns the object in the form of hash
|
356
|
-
# @return [Hash] Returns the object in the form of hash
|
357
|
-
def to_hash
|
358
|
-
hash = {}
|
359
|
-
self.class.attribute_map.each_pair do |attr, param|
|
360
|
-
value = self.send(attr)
|
361
|
-
next if value.nil?
|
362
|
-
hash[param] = _to_hash(value)
|
363
|
-
end
|
364
|
-
hash
|
365
|
-
end
|
366
|
-
|
367
|
-
# Outputs non-array value in the form of hash
|
368
|
-
# For object, use to_hash. Otherwise, just return the value
|
369
|
-
# @param [Object] value Any valid value
|
370
|
-
# @return [Hash] Returns the value in the form of hash
|
371
|
-
def _to_hash(value)
|
372
|
-
if value.is_a?(Array)
|
373
|
-
value.compact.map{ |v| _to_hash(v) }
|
374
|
-
elsif value.is_a?(Hash)
|
375
|
-
{}.tap do |hash|
|
376
|
-
value.each { |k, v| hash[k] = _to_hash(v) }
|
377
|
-
end
|
378
|
-
elsif value.respond_to? :to_hash
|
379
|
-
value.to_hash
|
380
|
-
else
|
381
|
-
value
|
382
|
-
end
|
383
|
-
end
|
384
|
-
|
385
|
-
end
|
386
|
-
|
387
|
-
end
|