cloudmersive-convert-api-client 2.2.7 → 2.3.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (81) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +52 -7
  3. data/docs/CompareDocumentApi.md +6 -2
  4. data/docs/ConvertDocumentApi.md +358 -10
  5. data/docs/ConvertDocumentBatchJobCreateResult.md +9 -0
  6. data/docs/ConvertDocumentJobStatusResult.md +12 -0
  7. data/docs/ConvertImageApi.md +6 -2
  8. data/docs/ConvertedPngDirectPage.md +9 -0
  9. data/docs/DocumentArrayInput.md +8 -0
  10. data/docs/DocumentItem.md +9 -0
  11. data/docs/EditDocumentApi.md +124 -2
  12. data/docs/EditPdfApi.md +244 -2
  13. data/docs/EditPdfBatchJobCreateResult.md +9 -0
  14. data/docs/EditPdfJobStatusResult.md +12 -0
  15. data/docs/JobStatusResult.md +12 -0
  16. data/docs/MergeBatchJobCreateResult.md +9 -0
  17. data/docs/MergeDocumentApi.md +440 -0
  18. data/docs/MergeJobStatusResult.md +12 -0
  19. data/docs/PdfMetadata.md +2 -0
  20. data/docs/PdfToPngDirectResult.md +9 -0
  21. data/docs/PptxPageLayoutInformation.md +11 -0
  22. data/docs/PptxSplitAdvancedRequest.md +9 -0
  23. data/docs/PptxSplitAdvancedResponse.md +9 -0
  24. data/docs/PresentationAdvancedResult.md +9 -0
  25. data/docs/SplitBatchJobCreateResult.md +9 -0
  26. data/docs/SplitDocumentApi.md +169 -0
  27. data/docs/ValidateDocumentApi.md +175 -6
  28. data/lib/cloudmersive-convert-api-client/api/compare_document_api.rb +3 -0
  29. data/lib/cloudmersive-convert-api-client/api/convert_document_api.rb +354 -11
  30. data/lib/cloudmersive-convert-api-client/api/convert_image_api.rb +3 -0
  31. data/lib/cloudmersive-convert-api-client/api/edit_document_api.rb +122 -0
  32. data/lib/cloudmersive-convert-api-client/api/edit_pdf_api.rb +263 -0
  33. data/lib/cloudmersive-convert-api-client/api/merge_document_api.rb +431 -0
  34. data/lib/cloudmersive-convert-api-client/api/split_document_api.rb +165 -0
  35. data/lib/cloudmersive-convert-api-client/api/validate_document_api.rb +172 -4
  36. data/lib/cloudmersive-convert-api-client/models/convert_document_batch_job_create_result.rb +196 -0
  37. data/lib/cloudmersive-convert-api-client/models/convert_document_job_status_result.rb +241 -0
  38. data/lib/cloudmersive-convert-api-client/models/converted_png_direct_page.rb +211 -0
  39. data/lib/cloudmersive-convert-api-client/models/document_array_input.rb +188 -0
  40. data/lib/cloudmersive-convert-api-client/models/document_item.rb +211 -0
  41. data/lib/cloudmersive-convert-api-client/models/edit_pdf_batch_job_create_result.rb +196 -0
  42. data/lib/cloudmersive-convert-api-client/models/edit_pdf_job_status_result.rb +241 -0
  43. data/lib/cloudmersive-convert-api-client/models/job_status_result.rb +226 -0
  44. data/lib/cloudmersive-convert-api-client/models/merge_batch_job_create_result.rb +196 -0
  45. data/lib/cloudmersive-convert-api-client/models/merge_job_status_result.rb +241 -0
  46. data/lib/cloudmersive-convert-api-client/models/pdf_metadata.rb +24 -4
  47. data/lib/cloudmersive-convert-api-client/models/pdf_to_png_direct_result.rb +198 -0
  48. data/lib/cloudmersive-convert-api-client/models/pptx_page_layout_information.rb +216 -0
  49. data/lib/cloudmersive-convert-api-client/models/pptx_split_advanced_request.rb +211 -0
  50. data/lib/cloudmersive-convert-api-client/models/pptx_split_advanced_response.rb +197 -0
  51. data/lib/cloudmersive-convert-api-client/models/presentation_advanced_result.rb +211 -0
  52. data/lib/cloudmersive-convert-api-client/models/presentation_result.rb +1 -1
  53. data/lib/cloudmersive-convert-api-client/models/split_batch_job_create_result.rb +196 -0
  54. data/lib/cloudmersive-convert-api-client/version.rb +1 -1
  55. data/lib/cloudmersive-convert-api-client.rb +16 -0
  56. data/spec/api/compare_document_api_spec.rb +1 -0
  57. data/spec/api/convert_document_api_spec.rb +80 -3
  58. data/spec/api/convert_image_api_spec.rb +1 -0
  59. data/spec/api/edit_document_api_spec.rb +28 -0
  60. data/spec/api/edit_pdf_api_spec.rb +55 -0
  61. data/spec/api/merge_document_api_spec.rb +96 -0
  62. data/spec/api/split_document_api_spec.rb +37 -0
  63. data/spec/api/validate_document_api_spec.rb +39 -2
  64. data/spec/models/convert_document_batch_job_create_result_spec.rb +47 -0
  65. data/spec/models/convert_document_job_status_result_spec.rb +65 -0
  66. data/spec/models/converted_png_direct_page_spec.rb +47 -0
  67. data/spec/models/document_array_input_spec.rb +41 -0
  68. data/spec/models/document_item_spec.rb +47 -0
  69. data/spec/models/edit_pdf_batch_job_create_result_spec.rb +47 -0
  70. data/spec/models/edit_pdf_job_status_result_spec.rb +65 -0
  71. data/spec/models/job_status_result_spec.rb +65 -0
  72. data/spec/models/merge_batch_job_create_result_spec.rb +47 -0
  73. data/spec/models/merge_job_status_result_spec.rb +65 -0
  74. data/spec/models/pdf_metadata_spec.rb +12 -0
  75. data/spec/models/pdf_to_png_direct_result_spec.rb +47 -0
  76. data/spec/models/pptx_page_layout_information_spec.rb +59 -0
  77. data/spec/models/pptx_split_advanced_request_spec.rb +47 -0
  78. data/spec/models/pptx_split_advanced_response_spec.rb +47 -0
  79. data/spec/models/presentation_advanced_result_spec.rb +47 -0
  80. data/spec/models/split_batch_job_create_result_spec.rb +47 -0
  81. metadata +50 -2
@@ -0,0 +1,198 @@
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
+ # Result of converting a PDF to a PNG array
17
+ class PdfToPngDirectResult
18
+ # True if the operation was successful, false otherwise
19
+ attr_accessor :successful
20
+
21
+ # Array of converted pages
22
+ attr_accessor :png_result_pages
23
+
24
+ # Attribute mapping from ruby-style variable name to JSON key.
25
+ def self.attribute_map
26
+ {
27
+ :'successful' => :'Successful',
28
+ :'png_result_pages' => :'PngResultPages'
29
+ }
30
+ end
31
+
32
+ # Attribute type mapping.
33
+ def self.swagger_types
34
+ {
35
+ :'successful' => :'BOOLEAN',
36
+ :'png_result_pages' => :'Array<ConvertedPngDirectPage>'
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?(:'Successful')
49
+ self.successful = attributes[:'Successful']
50
+ end
51
+
52
+ if attributes.has_key?(:'PngResultPages')
53
+ if (value = attributes[:'PngResultPages']).is_a?(Array)
54
+ self.png_result_pages = value
55
+ end
56
+ end
57
+ end
58
+
59
+ # Show invalid properties with the reasons. Usually used together with valid?
60
+ # @return Array for valid properties with the reasons
61
+ def list_invalid_properties
62
+ invalid_properties = Array.new
63
+ invalid_properties
64
+ end
65
+
66
+ # Check to see if the all the properties in the model are valid
67
+ # @return true if the model is valid
68
+ def valid?
69
+ true
70
+ end
71
+
72
+ # Checks equality by comparing each attribute.
73
+ # @param [Object] Object to be compared
74
+ def ==(o)
75
+ return true if self.equal?(o)
76
+ self.class == o.class &&
77
+ successful == o.successful &&
78
+ png_result_pages == o.png_result_pages
79
+ end
80
+
81
+ # @see the `==` method
82
+ # @param [Object] Object to be compared
83
+ def eql?(o)
84
+ self == o
85
+ end
86
+
87
+ # Calculates hash code according to all attributes.
88
+ # @return [Fixnum] Hash code
89
+ def hash
90
+ [successful, png_result_pages].hash
91
+ end
92
+
93
+ # Builds the object from hash
94
+ # @param [Hash] attributes Model attributes in the form of hash
95
+ # @return [Object] Returns the model itself
96
+ def build_from_hash(attributes)
97
+ return nil unless attributes.is_a?(Hash)
98
+ self.class.swagger_types.each_pair do |key, type|
99
+ if type =~ /\AArray<(.*)>/i
100
+ # check to ensure the input is an array given that the attribute
101
+ # is documented as an array but the input is not
102
+ if attributes[self.class.attribute_map[key]].is_a?(Array)
103
+ self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
104
+ end
105
+ elsif !attributes[self.class.attribute_map[key]].nil?
106
+ self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
107
+ end # or else data not found in attributes(hash), not an issue as the data can be optional
108
+ end
109
+
110
+ self
111
+ end
112
+
113
+ # Deserializes the data based on type
114
+ # @param string type Data type
115
+ # @param string value Value to be deserialized
116
+ # @return [Object] Deserialized data
117
+ def _deserialize(type, value)
118
+ case type.to_sym
119
+ when :DateTime
120
+ DateTime.parse(value)
121
+ when :Date
122
+ Date.parse(value)
123
+ when :String
124
+ value.to_s
125
+ when :Integer
126
+ value.to_i
127
+ when :Float
128
+ value.to_f
129
+ when :BOOLEAN
130
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
131
+ true
132
+ else
133
+ false
134
+ end
135
+ when :Object
136
+ # generic object (usually a Hash), return directly
137
+ value
138
+ when /\AArray<(?<inner_type>.+)>\z/
139
+ inner_type = Regexp.last_match[:inner_type]
140
+ value.map { |v| _deserialize(inner_type, v) }
141
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
142
+ k_type = Regexp.last_match[:k_type]
143
+ v_type = Regexp.last_match[:v_type]
144
+ {}.tap do |hash|
145
+ value.each do |k, v|
146
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
147
+ end
148
+ end
149
+ else # model
150
+ temp_model = CloudmersiveConvertApiClient.const_get(type).new
151
+ temp_model.build_from_hash(value)
152
+ end
153
+ end
154
+
155
+ # Returns the string representation of the object
156
+ # @return [String] String presentation of the object
157
+ def to_s
158
+ to_hash.to_s
159
+ end
160
+
161
+ # to_body is an alias to to_hash (backward compatibility)
162
+ # @return [Hash] Returns the object in the form of hash
163
+ def to_body
164
+ to_hash
165
+ end
166
+
167
+ # Returns the object in the form of hash
168
+ # @return [Hash] Returns the object in the form of hash
169
+ def to_hash
170
+ hash = {}
171
+ self.class.attribute_map.each_pair do |attr, param|
172
+ value = self.send(attr)
173
+ next if value.nil?
174
+ hash[param] = _to_hash(value)
175
+ end
176
+ hash
177
+ end
178
+
179
+ # Outputs non-array value in the form of hash
180
+ # For object, use to_hash. Otherwise, just return the value
181
+ # @param [Object] value Any valid value
182
+ # @return [Hash] Returns the value in the form of hash
183
+ def _to_hash(value)
184
+ if value.is_a?(Array)
185
+ value.compact.map { |v| _to_hash(v) }
186
+ elsif value.is_a?(Hash)
187
+ {}.tap do |hash|
188
+ value.each { |k, v| hash[k] = _to_hash(v) }
189
+ end
190
+ elsif value.respond_to? :to_hash
191
+ value.to_hash
192
+ else
193
+ value
194
+ end
195
+ end
196
+
197
+ end
198
+ end
@@ -0,0 +1,216 @@
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
+ # Result of getting the page layout information of a PowerPoint PPTX presentation
17
+ class PptxPageLayoutInformation
18
+ # True if successful, false otherwise
19
+ attr_accessor :successful
20
+
21
+ # Orientation of the presentation, either portrait or landscape
22
+ attr_accessor :orientation
23
+
24
+ # Width of the presentation in Emu, where 1 inch equals 914400 emu.
25
+ attr_accessor :width
26
+
27
+ # Height of the presentation in Emu, where 1 inch equals 914400 emu.
28
+ attr_accessor :height
29
+
30
+ # Attribute mapping from ruby-style variable name to JSON key.
31
+ def self.attribute_map
32
+ {
33
+ :'successful' => :'Successful',
34
+ :'orientation' => :'Orientation',
35
+ :'width' => :'Width',
36
+ :'height' => :'Height'
37
+ }
38
+ end
39
+
40
+ # Attribute type mapping.
41
+ def self.swagger_types
42
+ {
43
+ :'successful' => :'BOOLEAN',
44
+ :'orientation' => :'String',
45
+ :'width' => :'Integer',
46
+ :'height' => :'Integer'
47
+ }
48
+ end
49
+
50
+ # Initializes the object
51
+ # @param [Hash] attributes Model attributes in the form of hash
52
+ def initialize(attributes = {})
53
+ return unless attributes.is_a?(Hash)
54
+
55
+ # convert string to symbol for hash key
56
+ attributes = attributes.each_with_object({}) { |(k, v), h| h[k.to_sym] = v }
57
+
58
+ if attributes.has_key?(:'Successful')
59
+ self.successful = attributes[:'Successful']
60
+ end
61
+
62
+ if attributes.has_key?(:'Orientation')
63
+ self.orientation = attributes[:'Orientation']
64
+ end
65
+
66
+ if attributes.has_key?(:'Width')
67
+ self.width = attributes[:'Width']
68
+ end
69
+
70
+ if attributes.has_key?(:'Height')
71
+ self.height = attributes[:'Height']
72
+ end
73
+ end
74
+
75
+ # Show invalid properties with the reasons. Usually used together with valid?
76
+ # @return Array for valid properties with the reasons
77
+ def list_invalid_properties
78
+ invalid_properties = Array.new
79
+ invalid_properties
80
+ end
81
+
82
+ # Check to see if the all the properties in the model are valid
83
+ # @return true if the model is valid
84
+ def valid?
85
+ true
86
+ end
87
+
88
+ # Checks equality by comparing each attribute.
89
+ # @param [Object] Object to be compared
90
+ def ==(o)
91
+ return true if self.equal?(o)
92
+ self.class == o.class &&
93
+ successful == o.successful &&
94
+ orientation == o.orientation &&
95
+ width == o.width &&
96
+ height == o.height
97
+ end
98
+
99
+ # @see the `==` method
100
+ # @param [Object] Object to be compared
101
+ def eql?(o)
102
+ self == o
103
+ end
104
+
105
+ # Calculates hash code according to all attributes.
106
+ # @return [Fixnum] Hash code
107
+ def hash
108
+ [successful, orientation, width, height].hash
109
+ end
110
+
111
+ # Builds the object from hash
112
+ # @param [Hash] attributes Model attributes in the form of hash
113
+ # @return [Object] Returns the model itself
114
+ def build_from_hash(attributes)
115
+ return nil unless attributes.is_a?(Hash)
116
+ self.class.swagger_types.each_pair do |key, type|
117
+ if type =~ /\AArray<(.*)>/i
118
+ # check to ensure the input is an array given that the attribute
119
+ # is documented as an array but the input is not
120
+ if attributes[self.class.attribute_map[key]].is_a?(Array)
121
+ self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
122
+ end
123
+ elsif !attributes[self.class.attribute_map[key]].nil?
124
+ self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
125
+ end # or else data not found in attributes(hash), not an issue as the data can be optional
126
+ end
127
+
128
+ self
129
+ end
130
+
131
+ # Deserializes the data based on type
132
+ # @param string type Data type
133
+ # @param string value Value to be deserialized
134
+ # @return [Object] Deserialized data
135
+ def _deserialize(type, value)
136
+ case type.to_sym
137
+ when :DateTime
138
+ DateTime.parse(value)
139
+ when :Date
140
+ Date.parse(value)
141
+ when :String
142
+ value.to_s
143
+ when :Integer
144
+ value.to_i
145
+ when :Float
146
+ value.to_f
147
+ when :BOOLEAN
148
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
149
+ true
150
+ else
151
+ false
152
+ end
153
+ when :Object
154
+ # generic object (usually a Hash), return directly
155
+ value
156
+ when /\AArray<(?<inner_type>.+)>\z/
157
+ inner_type = Regexp.last_match[:inner_type]
158
+ value.map { |v| _deserialize(inner_type, v) }
159
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
160
+ k_type = Regexp.last_match[:k_type]
161
+ v_type = Regexp.last_match[:v_type]
162
+ {}.tap do |hash|
163
+ value.each do |k, v|
164
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
165
+ end
166
+ end
167
+ else # model
168
+ temp_model = CloudmersiveConvertApiClient.const_get(type).new
169
+ temp_model.build_from_hash(value)
170
+ end
171
+ end
172
+
173
+ # Returns the string representation of the object
174
+ # @return [String] String presentation of the object
175
+ def to_s
176
+ to_hash.to_s
177
+ end
178
+
179
+ # to_body is an alias to to_hash (backward compatibility)
180
+ # @return [Hash] Returns the object in the form of hash
181
+ def to_body
182
+ to_hash
183
+ end
184
+
185
+ # Returns the object in the form of hash
186
+ # @return [Hash] Returns the object in the form of hash
187
+ def to_hash
188
+ hash = {}
189
+ self.class.attribute_map.each_pair do |attr, param|
190
+ value = self.send(attr)
191
+ next if value.nil?
192
+ hash[param] = _to_hash(value)
193
+ end
194
+ hash
195
+ end
196
+
197
+ # Outputs non-array value in the form of hash
198
+ # For object, use to_hash. Otherwise, just return the value
199
+ # @param [Object] value Any valid value
200
+ # @return [Hash] Returns the value in the form of hash
201
+ def _to_hash(value)
202
+ if value.is_a?(Array)
203
+ value.compact.map { |v| _to_hash(v) }
204
+ elsif value.is_a?(Hash)
205
+ {}.tap do |hash|
206
+ value.each { |k, v| hash[k] = _to_hash(v) }
207
+ end
208
+ elsif value.respond_to? :to_hash
209
+ value.to_hash
210
+ else
211
+ value
212
+ end
213
+ end
214
+
215
+ end
216
+ 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
+ # Request to split a PowerPoint presentation
17
+ class PptxSplitAdvancedRequest
18
+ # Input file
19
+ attr_accessor :input_file
20
+
21
+ # Slides per presentation for result
22
+ attr_accessor :slides_per_presentation
23
+
24
+ # Attribute mapping from ruby-style variable name to JSON key.
25
+ def self.attribute_map
26
+ {
27
+ :'input_file' => :'InputFile',
28
+ :'slides_per_presentation' => :'SlidesPerPresentation'
29
+ }
30
+ end
31
+
32
+ # Attribute type mapping.
33
+ def self.swagger_types
34
+ {
35
+ :'input_file' => :'String',
36
+ :'slides_per_presentation' => :'Integer'
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?(:'InputFile')
49
+ self.input_file = attributes[:'InputFile']
50
+ end
51
+
52
+ if attributes.has_key?(:'SlidesPerPresentation')
53
+ self.slides_per_presentation = attributes[:'SlidesPerPresentation']
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 !@input_file.nil? && @input_file !~ Regexp.new(/^(?:[A-Za-z0-9+\/]{4})*(?:[A-Za-z0-9+\/]{2}==|[A-Za-z0-9+\/]{3}=)?$/)
62
+ invalid_properties.push('invalid value for "input_file", 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 !@input_file.nil? && @input_file !~ 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] input_file Value to be assigned
77
+ def input_file=(input_file)
78
+ if !input_file.nil? && input_file !~ Regexp.new(/^(?:[A-Za-z0-9+\/]{4})*(?:[A-Za-z0-9+\/]{2}==|[A-Za-z0-9+\/]{3}=)?$/)
79
+ fail ArgumentError, 'invalid value for "input_file", must conform to the pattern /^(?:[A-Za-z0-9+\/]{4})*(?:[A-Za-z0-9+\/]{2}==|[A-Za-z0-9+\/]{3}=)?$/.'
80
+ end
81
+
82
+ @input_file = input_file
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
+ input_file == o.input_file &&
91
+ slides_per_presentation == o.slides_per_presentation
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
+ [input_file, slides_per_presentation].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