cloudmersive-convert-api-client 2.2.6 → 2.3.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (86) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +54 -8
  3. data/docs/CompareDocumentApi.md +6 -2
  4. data/docs/ConvertDataApi.md +60 -5
  5. data/docs/ConvertDocumentApi.md +358 -10
  6. data/docs/ConvertDocumentBatchJobCreateResult.md +9 -0
  7. data/docs/ConvertDocumentJobStatusResult.md +12 -0
  8. data/docs/ConvertImageApi.md +6 -2
  9. data/docs/ConvertWebApi.md +8 -8
  10. data/docs/ConvertedPngDirectPage.md +9 -0
  11. data/docs/DocumentArrayInput.md +8 -0
  12. data/docs/DocumentItem.md +9 -0
  13. data/docs/EditDocumentApi.md +124 -2
  14. data/docs/EditPdfApi.md +244 -2
  15. data/docs/EditPdfBatchJobCreateResult.md +9 -0
  16. data/docs/EditPdfJobStatusResult.md +12 -0
  17. data/docs/JobStatusResult.md +12 -0
  18. data/docs/MergeBatchJobCreateResult.md +9 -0
  19. data/docs/MergeDocumentApi.md +440 -0
  20. data/docs/MergeJobStatusResult.md +12 -0
  21. data/docs/PdfMetadata.md +2 -0
  22. data/docs/PdfToPngDirectResult.md +9 -0
  23. data/docs/PptxPageLayoutInformation.md +11 -0
  24. data/docs/PptxSplitAdvancedRequest.md +9 -0
  25. data/docs/PptxSplitAdvancedResponse.md +9 -0
  26. data/docs/PresentationAdvancedResult.md +9 -0
  27. data/docs/SplitBatchJobCreateResult.md +9 -0
  28. data/docs/SplitDocumentApi.md +169 -0
  29. data/docs/ValidateDocumentApi.md +175 -6
  30. data/lib/cloudmersive-convert-api-client/api/compare_document_api.rb +3 -0
  31. data/lib/cloudmersive-convert-api-client/api/convert_data_api.rb +57 -4
  32. data/lib/cloudmersive-convert-api-client/api/convert_document_api.rb +354 -11
  33. data/lib/cloudmersive-convert-api-client/api/convert_image_api.rb +3 -0
  34. data/lib/cloudmersive-convert-api-client/api/convert_web_api.rb +8 -8
  35. data/lib/cloudmersive-convert-api-client/api/edit_document_api.rb +122 -0
  36. data/lib/cloudmersive-convert-api-client/api/edit_pdf_api.rb +263 -0
  37. data/lib/cloudmersive-convert-api-client/api/merge_document_api.rb +431 -0
  38. data/lib/cloudmersive-convert-api-client/api/split_document_api.rb +165 -0
  39. data/lib/cloudmersive-convert-api-client/api/validate_document_api.rb +172 -4
  40. data/lib/cloudmersive-convert-api-client/models/convert_document_batch_job_create_result.rb +196 -0
  41. data/lib/cloudmersive-convert-api-client/models/convert_document_job_status_result.rb +241 -0
  42. data/lib/cloudmersive-convert-api-client/models/converted_png_direct_page.rb +211 -0
  43. data/lib/cloudmersive-convert-api-client/models/document_array_input.rb +188 -0
  44. data/lib/cloudmersive-convert-api-client/models/document_item.rb +211 -0
  45. data/lib/cloudmersive-convert-api-client/models/edit_pdf_batch_job_create_result.rb +196 -0
  46. data/lib/cloudmersive-convert-api-client/models/edit_pdf_job_status_result.rb +241 -0
  47. data/lib/cloudmersive-convert-api-client/models/job_status_result.rb +226 -0
  48. data/lib/cloudmersive-convert-api-client/models/merge_batch_job_create_result.rb +196 -0
  49. data/lib/cloudmersive-convert-api-client/models/merge_job_status_result.rb +241 -0
  50. data/lib/cloudmersive-convert-api-client/models/pdf_metadata.rb +24 -4
  51. data/lib/cloudmersive-convert-api-client/models/pdf_to_png_direct_result.rb +198 -0
  52. data/lib/cloudmersive-convert-api-client/models/pptx_page_layout_information.rb +216 -0
  53. data/lib/cloudmersive-convert-api-client/models/pptx_split_advanced_request.rb +211 -0
  54. data/lib/cloudmersive-convert-api-client/models/pptx_split_advanced_response.rb +197 -0
  55. data/lib/cloudmersive-convert-api-client/models/presentation_advanced_result.rb +211 -0
  56. data/lib/cloudmersive-convert-api-client/models/presentation_result.rb +1 -1
  57. data/lib/cloudmersive-convert-api-client/models/split_batch_job_create_result.rb +196 -0
  58. data/lib/cloudmersive-convert-api-client/version.rb +1 -1
  59. data/lib/cloudmersive-convert-api-client.rb +16 -0
  60. data/spec/api/compare_document_api_spec.rb +1 -0
  61. data/spec/api/convert_data_api_spec.rb +14 -2
  62. data/spec/api/convert_document_api_spec.rb +80 -3
  63. data/spec/api/convert_image_api_spec.rb +1 -0
  64. data/spec/api/edit_document_api_spec.rb +28 -0
  65. data/spec/api/edit_pdf_api_spec.rb +55 -0
  66. data/spec/api/merge_document_api_spec.rb +96 -0
  67. data/spec/api/split_document_api_spec.rb +37 -0
  68. data/spec/api/validate_document_api_spec.rb +39 -2
  69. data/spec/models/convert_document_batch_job_create_result_spec.rb +47 -0
  70. data/spec/models/convert_document_job_status_result_spec.rb +65 -0
  71. data/spec/models/converted_png_direct_page_spec.rb +47 -0
  72. data/spec/models/document_array_input_spec.rb +41 -0
  73. data/spec/models/document_item_spec.rb +47 -0
  74. data/spec/models/edit_pdf_batch_job_create_result_spec.rb +47 -0
  75. data/spec/models/edit_pdf_job_status_result_spec.rb +65 -0
  76. data/spec/models/job_status_result_spec.rb +65 -0
  77. data/spec/models/merge_batch_job_create_result_spec.rb +47 -0
  78. data/spec/models/merge_job_status_result_spec.rb +65 -0
  79. data/spec/models/pdf_metadata_spec.rb +12 -0
  80. data/spec/models/pdf_to_png_direct_result_spec.rb +47 -0
  81. data/spec/models/pptx_page_layout_information_spec.rb +59 -0
  82. data/spec/models/pptx_split_advanced_request_spec.rb +47 -0
  83. data/spec/models/pptx_split_advanced_response_spec.rb +47 -0
  84. data/spec/models/presentation_advanced_result_spec.rb +47 -0
  85. data/spec/models/split_batch_job_create_result_spec.rb +47 -0
  86. metadata +50 -2
@@ -0,0 +1,211 @@
1
+ =begin
2
+ #convertapi
3
+
4
+ #Convert API lets you effortlessly convert file formats and types.
5
+
6
+ OpenAPI spec version: v1
7
+
8
+ Generated by: https://github.com/swagger-api/swagger-codegen.git
9
+ Swagger Codegen version: 2.4.14
10
+
11
+ =end
12
+
13
+ require 'date'
14
+
15
+ module CloudmersiveConvertApiClient
16
+ # A single converted page
17
+ class ConvertedPngDirectPage
18
+ # Page number of the converted page, starting with 1
19
+ attr_accessor :page_number
20
+
21
+ # PNG binary image file data in bytes
22
+ attr_accessor :image_data
23
+
24
+ # Attribute mapping from ruby-style variable name to JSON key.
25
+ def self.attribute_map
26
+ {
27
+ :'page_number' => :'PageNumber',
28
+ :'image_data' => :'ImageData'
29
+ }
30
+ end
31
+
32
+ # Attribute type mapping.
33
+ def self.swagger_types
34
+ {
35
+ :'page_number' => :'Integer',
36
+ :'image_data' => :'String'
37
+ }
38
+ end
39
+
40
+ # Initializes the object
41
+ # @param [Hash] attributes Model attributes in the form of hash
42
+ def initialize(attributes = {})
43
+ return unless attributes.is_a?(Hash)
44
+
45
+ # convert string to symbol for hash key
46
+ attributes = attributes.each_with_object({}) { |(k, v), h| h[k.to_sym] = v }
47
+
48
+ if attributes.has_key?(:'PageNumber')
49
+ self.page_number = attributes[:'PageNumber']
50
+ end
51
+
52
+ if attributes.has_key?(:'ImageData')
53
+ self.image_data = attributes[:'ImageData']
54
+ end
55
+ end
56
+
57
+ # Show invalid properties with the reasons. Usually used together with valid?
58
+ # @return Array for valid properties with the reasons
59
+ def list_invalid_properties
60
+ invalid_properties = Array.new
61
+ if !@image_data.nil? && @image_data !~ Regexp.new(/^(?:[A-Za-z0-9+\/]{4})*(?:[A-Za-z0-9+\/]{2}==|[A-Za-z0-9+\/]{3}=)?$/)
62
+ invalid_properties.push('invalid value for "image_data", must conform to the pattern /^(?:[A-Za-z0-9+\/]{4})*(?:[A-Za-z0-9+\/]{2}==|[A-Za-z0-9+\/]{3}=)?$/.')
63
+ end
64
+
65
+ invalid_properties
66
+ end
67
+
68
+ # Check to see if the all the properties in the model are valid
69
+ # @return true if the model is valid
70
+ def valid?
71
+ return false if !@image_data.nil? && @image_data !~ Regexp.new(/^(?:[A-Za-z0-9+\/]{4})*(?:[A-Za-z0-9+\/]{2}==|[A-Za-z0-9+\/]{3}=)?$/)
72
+ true
73
+ end
74
+
75
+ # Custom attribute writer method with validation
76
+ # @param [Object] image_data Value to be assigned
77
+ def image_data=(image_data)
78
+ if !image_data.nil? && image_data !~ Regexp.new(/^(?:[A-Za-z0-9+\/]{4})*(?:[A-Za-z0-9+\/]{2}==|[A-Za-z0-9+\/]{3}=)?$/)
79
+ fail ArgumentError, 'invalid value for "image_data", must conform to the pattern /^(?:[A-Za-z0-9+\/]{4})*(?:[A-Za-z0-9+\/]{2}==|[A-Za-z0-9+\/]{3}=)?$/.'
80
+ end
81
+
82
+ @image_data = image_data
83
+ end
84
+
85
+ # Checks equality by comparing each attribute.
86
+ # @param [Object] Object to be compared
87
+ def ==(o)
88
+ return true if self.equal?(o)
89
+ self.class == o.class &&
90
+ page_number == o.page_number &&
91
+ image_data == o.image_data
92
+ end
93
+
94
+ # @see the `==` method
95
+ # @param [Object] Object to be compared
96
+ def eql?(o)
97
+ self == o
98
+ end
99
+
100
+ # Calculates hash code according to all attributes.
101
+ # @return [Fixnum] Hash code
102
+ def hash
103
+ [page_number, image_data].hash
104
+ end
105
+
106
+ # Builds the object from hash
107
+ # @param [Hash] attributes Model attributes in the form of hash
108
+ # @return [Object] Returns the model itself
109
+ def build_from_hash(attributes)
110
+ return nil unless attributes.is_a?(Hash)
111
+ self.class.swagger_types.each_pair do |key, type|
112
+ if type =~ /\AArray<(.*)>/i
113
+ # check to ensure the input is an array given that the attribute
114
+ # is documented as an array but the input is not
115
+ if attributes[self.class.attribute_map[key]].is_a?(Array)
116
+ self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
117
+ end
118
+ elsif !attributes[self.class.attribute_map[key]].nil?
119
+ self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
120
+ end # or else data not found in attributes(hash), not an issue as the data can be optional
121
+ end
122
+
123
+ self
124
+ end
125
+
126
+ # Deserializes the data based on type
127
+ # @param string type Data type
128
+ # @param string value Value to be deserialized
129
+ # @return [Object] Deserialized data
130
+ def _deserialize(type, value)
131
+ case type.to_sym
132
+ when :DateTime
133
+ DateTime.parse(value)
134
+ when :Date
135
+ Date.parse(value)
136
+ when :String
137
+ value.to_s
138
+ when :Integer
139
+ value.to_i
140
+ when :Float
141
+ value.to_f
142
+ when :BOOLEAN
143
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
144
+ true
145
+ else
146
+ false
147
+ end
148
+ when :Object
149
+ # generic object (usually a Hash), return directly
150
+ value
151
+ when /\AArray<(?<inner_type>.+)>\z/
152
+ inner_type = Regexp.last_match[:inner_type]
153
+ value.map { |v| _deserialize(inner_type, v) }
154
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
155
+ k_type = Regexp.last_match[:k_type]
156
+ v_type = Regexp.last_match[:v_type]
157
+ {}.tap do |hash|
158
+ value.each do |k, v|
159
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
160
+ end
161
+ end
162
+ else # model
163
+ temp_model = CloudmersiveConvertApiClient.const_get(type).new
164
+ temp_model.build_from_hash(value)
165
+ end
166
+ end
167
+
168
+ # Returns the string representation of the object
169
+ # @return [String] String presentation of the object
170
+ def to_s
171
+ to_hash.to_s
172
+ end
173
+
174
+ # to_body is an alias to to_hash (backward compatibility)
175
+ # @return [Hash] Returns the object in the form of hash
176
+ def to_body
177
+ to_hash
178
+ end
179
+
180
+ # Returns the object in the form of hash
181
+ # @return [Hash] Returns the object in the form of hash
182
+ def to_hash
183
+ hash = {}
184
+ self.class.attribute_map.each_pair do |attr, param|
185
+ value = self.send(attr)
186
+ next if value.nil?
187
+ hash[param] = _to_hash(value)
188
+ end
189
+ hash
190
+ end
191
+
192
+ # Outputs non-array value in the form of hash
193
+ # For object, use to_hash. Otherwise, just return the value
194
+ # @param [Object] value Any valid value
195
+ # @return [Hash] Returns the value in the form of hash
196
+ def _to_hash(value)
197
+ if value.is_a?(Array)
198
+ value.compact.map { |v| _to_hash(v) }
199
+ elsif value.is_a?(Hash)
200
+ {}.tap do |hash|
201
+ value.each { |k, v| hash[k] = _to_hash(v) }
202
+ end
203
+ elsif value.respond_to? :to_hash
204
+ value.to_hash
205
+ else
206
+ value
207
+ end
208
+ end
209
+
210
+ end
211
+ end
@@ -0,0 +1,188 @@
1
+ =begin
2
+ #convertapi
3
+
4
+ #Convert API lets you effortlessly convert file formats and types.
5
+
6
+ OpenAPI spec version: v1
7
+
8
+ Generated by: https://github.com/swagger-api/swagger-codegen.git
9
+ Swagger Codegen version: 2.4.14
10
+
11
+ =end
12
+
13
+ require 'date'
14
+
15
+ module CloudmersiveConvertApiClient
16
+ # Input array of documents to be processed for a merge operation
17
+ class DocumentArrayInput
18
+ # Array of document objects
19
+ attr_accessor :documents
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<DocumentItem>'
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
+ 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
+ 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
+ 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
+ documents == o.documents
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
+ [documents].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 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 = CloudmersiveConvertApiClient.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
+ end
@@ -0,0 +1,211 @@
1
+ =begin
2
+ #convertapi
3
+
4
+ #Convert API lets you effortlessly convert file formats and types.
5
+
6
+ OpenAPI spec version: v1
7
+
8
+ Generated by: https://github.com/swagger-api/swagger-codegen.git
9
+ Swagger Codegen version: 2.4.14
10
+
11
+ =end
12
+
13
+ require 'date'
14
+
15
+ module CloudmersiveConvertApiClient
16
+ # Object representing one document
17
+ class DocumentItem
18
+ # File name of the document
19
+ attr_accessor :document_file_name
20
+
21
+ # Contents of the document as a binary byte array
22
+ attr_accessor :document_content
23
+
24
+ # Attribute mapping from ruby-style variable name to JSON key.
25
+ def self.attribute_map
26
+ {
27
+ :'document_file_name' => :'DocumentFileName',
28
+ :'document_content' => :'DocumentContent'
29
+ }
30
+ end
31
+
32
+ # Attribute type mapping.
33
+ def self.swagger_types
34
+ {
35
+ :'document_file_name' => :'String',
36
+ :'document_content' => :'String'
37
+ }
38
+ end
39
+
40
+ # Initializes the object
41
+ # @param [Hash] attributes Model attributes in the form of hash
42
+ def initialize(attributes = {})
43
+ return unless attributes.is_a?(Hash)
44
+
45
+ # convert string to symbol for hash key
46
+ attributes = attributes.each_with_object({}) { |(k, v), h| h[k.to_sym] = v }
47
+
48
+ if attributes.has_key?(:'DocumentFileName')
49
+ self.document_file_name = attributes[:'DocumentFileName']
50
+ end
51
+
52
+ if attributes.has_key?(:'DocumentContent')
53
+ self.document_content = attributes[:'DocumentContent']
54
+ end
55
+ end
56
+
57
+ # Show invalid properties with the reasons. Usually used together with valid?
58
+ # @return Array for valid properties with the reasons
59
+ def list_invalid_properties
60
+ invalid_properties = Array.new
61
+ if !@document_content.nil? && @document_content !~ Regexp.new(/^(?:[A-Za-z0-9+\/]{4})*(?:[A-Za-z0-9+\/]{2}==|[A-Za-z0-9+\/]{3}=)?$/)
62
+ invalid_properties.push('invalid value for "document_content", must conform to the pattern /^(?:[A-Za-z0-9+\/]{4})*(?:[A-Za-z0-9+\/]{2}==|[A-Za-z0-9+\/]{3}=)?$/.')
63
+ end
64
+
65
+ invalid_properties
66
+ end
67
+
68
+ # Check to see if the all the properties in the model are valid
69
+ # @return true if the model is valid
70
+ def valid?
71
+ return false if !@document_content.nil? && @document_content !~ Regexp.new(/^(?:[A-Za-z0-9+\/]{4})*(?:[A-Za-z0-9+\/]{2}==|[A-Za-z0-9+\/]{3}=)?$/)
72
+ true
73
+ end
74
+
75
+ # Custom attribute writer method with validation
76
+ # @param [Object] document_content Value to be assigned
77
+ def document_content=(document_content)
78
+ if !document_content.nil? && document_content !~ Regexp.new(/^(?:[A-Za-z0-9+\/]{4})*(?:[A-Za-z0-9+\/]{2}==|[A-Za-z0-9+\/]{3}=)?$/)
79
+ fail ArgumentError, 'invalid value for "document_content", must conform to the pattern /^(?:[A-Za-z0-9+\/]{4})*(?:[A-Za-z0-9+\/]{2}==|[A-Za-z0-9+\/]{3}=)?$/.'
80
+ end
81
+
82
+ @document_content = document_content
83
+ end
84
+
85
+ # Checks equality by comparing each attribute.
86
+ # @param [Object] Object to be compared
87
+ def ==(o)
88
+ return true if self.equal?(o)
89
+ self.class == o.class &&
90
+ document_file_name == o.document_file_name &&
91
+ document_content == o.document_content
92
+ end
93
+
94
+ # @see the `==` method
95
+ # @param [Object] Object to be compared
96
+ def eql?(o)
97
+ self == o
98
+ end
99
+
100
+ # Calculates hash code according to all attributes.
101
+ # @return [Fixnum] Hash code
102
+ def hash
103
+ [document_file_name, document_content].hash
104
+ end
105
+
106
+ # Builds the object from hash
107
+ # @param [Hash] attributes Model attributes in the form of hash
108
+ # @return [Object] Returns the model itself
109
+ def build_from_hash(attributes)
110
+ return nil unless attributes.is_a?(Hash)
111
+ self.class.swagger_types.each_pair do |key, type|
112
+ if type =~ /\AArray<(.*)>/i
113
+ # check to ensure the input is an array given that the attribute
114
+ # is documented as an array but the input is not
115
+ if attributes[self.class.attribute_map[key]].is_a?(Array)
116
+ self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
117
+ end
118
+ elsif !attributes[self.class.attribute_map[key]].nil?
119
+ self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
120
+ end # or else data not found in attributes(hash), not an issue as the data can be optional
121
+ end
122
+
123
+ self
124
+ end
125
+
126
+ # Deserializes the data based on type
127
+ # @param string type Data type
128
+ # @param string value Value to be deserialized
129
+ # @return [Object] Deserialized data
130
+ def _deserialize(type, value)
131
+ case type.to_sym
132
+ when :DateTime
133
+ DateTime.parse(value)
134
+ when :Date
135
+ Date.parse(value)
136
+ when :String
137
+ value.to_s
138
+ when :Integer
139
+ value.to_i
140
+ when :Float
141
+ value.to_f
142
+ when :BOOLEAN
143
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
144
+ true
145
+ else
146
+ false
147
+ end
148
+ when :Object
149
+ # generic object (usually a Hash), return directly
150
+ value
151
+ when /\AArray<(?<inner_type>.+)>\z/
152
+ inner_type = Regexp.last_match[:inner_type]
153
+ value.map { |v| _deserialize(inner_type, v) }
154
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
155
+ k_type = Regexp.last_match[:k_type]
156
+ v_type = Regexp.last_match[:v_type]
157
+ {}.tap do |hash|
158
+ value.each do |k, v|
159
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
160
+ end
161
+ end
162
+ else # model
163
+ temp_model = CloudmersiveConvertApiClient.const_get(type).new
164
+ temp_model.build_from_hash(value)
165
+ end
166
+ end
167
+
168
+ # Returns the string representation of the object
169
+ # @return [String] String presentation of the object
170
+ def to_s
171
+ to_hash.to_s
172
+ end
173
+
174
+ # to_body is an alias to to_hash (backward compatibility)
175
+ # @return [Hash] Returns the object in the form of hash
176
+ def to_body
177
+ to_hash
178
+ end
179
+
180
+ # Returns the object in the form of hash
181
+ # @return [Hash] Returns the object in the form of hash
182
+ def to_hash
183
+ hash = {}
184
+ self.class.attribute_map.each_pair do |attr, param|
185
+ value = self.send(attr)
186
+ next if value.nil?
187
+ hash[param] = _to_hash(value)
188
+ end
189
+ hash
190
+ end
191
+
192
+ # Outputs non-array value in the form of hash
193
+ # For object, use to_hash. Otherwise, just return the value
194
+ # @param [Object] value Any valid value
195
+ # @return [Hash] Returns the value in the form of hash
196
+ def _to_hash(value)
197
+ if value.is_a?(Array)
198
+ value.compact.map { |v| _to_hash(v) }
199
+ elsif value.is_a?(Hash)
200
+ {}.tap do |hash|
201
+ value.each { |k, v| hash[k] = _to_hash(v) }
202
+ end
203
+ elsif value.respond_to? :to_hash
204
+ value.to_hash
205
+ else
206
+ value
207
+ end
208
+ end
209
+
210
+ end
211
+ end