cloudmersive-convert-api-client 1.5.1 → 1.5.2

Sign up to get free protection for your applications and to get access to all the features.
Files changed (38) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +17 -5
  3. data/docs/ConvertWebApi.md +3 -3
  4. data/docs/DocxPage.md +9 -0
  5. data/docs/EditDocumentApi.md +165 -0
  6. data/docs/EditPdfApi.md +55 -0
  7. data/docs/GetDocxPagesRequest.md +9 -0
  8. data/docs/GetDocxPagesResponse.md +10 -0
  9. data/docs/InsertDocxTableRowRequest.md +12 -0
  10. data/docs/InsertDocxTableRowResponse.md +9 -0
  11. data/docs/PdfPageText.md +9 -0
  12. data/docs/PdfTextByPageResult.md +9 -0
  13. data/docs/RemoveDocxPagesRequest.md +11 -0
  14. data/lib/cloudmersive-convert-api-client.rb +8 -0
  15. data/lib/cloudmersive-convert-api-client/api/convert_web_api.rb +2 -2
  16. data/lib/cloudmersive-convert-api-client/api/edit_document_api.rb +165 -0
  17. data/lib/cloudmersive-convert-api-client/api/edit_pdf_api.rb +56 -0
  18. data/lib/cloudmersive-convert-api-client/models/docx_page.rb +201 -0
  19. data/lib/cloudmersive-convert-api-client/models/get_docx_pages_request.rb +215 -0
  20. data/lib/cloudmersive-convert-api-client/models/get_docx_pages_response.rb +208 -0
  21. data/lib/cloudmersive-convert-api-client/models/insert_docx_table_row_request.rb +245 -0
  22. data/lib/cloudmersive-convert-api-client/models/insert_docx_table_row_response.rb +199 -0
  23. data/lib/cloudmersive-convert-api-client/models/pdf_page_text.rb +199 -0
  24. data/lib/cloudmersive-convert-api-client/models/pdf_text_by_page_result.rb +201 -0
  25. data/lib/cloudmersive-convert-api-client/models/remove_docx_pages_request.rb +235 -0
  26. data/lib/cloudmersive-convert-api-client/version.rb +1 -1
  27. data/spec/api/convert_web_api_spec.rb +1 -1
  28. data/spec/api/edit_document_api_spec.rb +36 -0
  29. data/spec/api/edit_pdf_api_spec.rb +12 -0
  30. data/spec/models/docx_page_spec.rb +48 -0
  31. data/spec/models/get_docx_pages_request_spec.rb +48 -0
  32. data/spec/models/get_docx_pages_response_spec.rb +54 -0
  33. data/spec/models/insert_docx_table_row_request_spec.rb +66 -0
  34. data/spec/models/insert_docx_table_row_response_spec.rb +48 -0
  35. data/spec/models/pdf_page_text_spec.rb +48 -0
  36. data/spec/models/pdf_text_by_page_result_spec.rb +48 -0
  37. data/spec/models/remove_docx_pages_request_spec.rb +60 -0
  38. metadata +26 -2
@@ -0,0 +1,235 @@
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.3.1
10
+
11
+ =end
12
+
13
+ require 'date'
14
+
15
+ module CloudmersiveConvertApiClient
16
+ # Input to a Remove Word DOCX Document Pages request
17
+ class RemoveDocxPagesRequest
18
+ # Optional: Bytes of the input file to operate on
19
+ attr_accessor :input_file_bytes
20
+
21
+ # Optional: URL of a file to operate on as input. This can be a public URL, or you can also use the begin-editing API to upload a document and pass in the secure URL result from that operation as the URL here (this URL is not public).
22
+ attr_accessor :input_file_url
23
+
24
+ # Page number (1-based) to start deleting pages; inclusive
25
+ attr_accessor :start_delete_page_number
26
+
27
+ # Page number (1-based) to stop deleting pages; inclusive
28
+ attr_accessor :end_delete_page_number
29
+
30
+
31
+ # Attribute mapping from ruby-style variable name to JSON key.
32
+ def self.attribute_map
33
+ {
34
+ :'input_file_bytes' => :'InputFileBytes',
35
+ :'input_file_url' => :'InputFileUrl',
36
+ :'start_delete_page_number' => :'StartDeletePageNumber',
37
+ :'end_delete_page_number' => :'EndDeletePageNumber'
38
+ }
39
+ end
40
+
41
+ # Attribute type mapping.
42
+ def self.swagger_types
43
+ {
44
+ :'input_file_bytes' => :'String',
45
+ :'input_file_url' => :'String',
46
+ :'start_delete_page_number' => :'Integer',
47
+ :'end_delete_page_number' => :'Integer'
48
+ }
49
+ end
50
+
51
+ # Initializes the object
52
+ # @param [Hash] attributes Model attributes in the form of hash
53
+ def initialize(attributes = {})
54
+ return unless attributes.is_a?(Hash)
55
+
56
+ # convert string to symbol for hash key
57
+ attributes = attributes.each_with_object({}){|(k,v), h| h[k.to_sym] = v}
58
+
59
+ if attributes.has_key?(:'InputFileBytes')
60
+ self.input_file_bytes = attributes[:'InputFileBytes']
61
+ end
62
+
63
+ if attributes.has_key?(:'InputFileUrl')
64
+ self.input_file_url = attributes[:'InputFileUrl']
65
+ end
66
+
67
+ if attributes.has_key?(:'StartDeletePageNumber')
68
+ self.start_delete_page_number = attributes[:'StartDeletePageNumber']
69
+ end
70
+
71
+ if attributes.has_key?(:'EndDeletePageNumber')
72
+ self.end_delete_page_number = attributes[:'EndDeletePageNumber']
73
+ end
74
+
75
+ end
76
+
77
+ # Show invalid properties with the reasons. Usually used together with valid?
78
+ # @return Array for valid properties with the reasons
79
+ def list_invalid_properties
80
+ invalid_properties = Array.new
81
+ if !@input_file_bytes.nil? && @input_file_bytes !~ Regexp.new(/^(?:[A-Za-z0-9+\/]{4})*(?:[A-Za-z0-9+\/]{2}==|[A-Za-z0-9+\/]{3}=)?$/)
82
+ invalid_properties.push("invalid value for 'input_file_bytes', must conform to the pattern /^(?:[A-Za-z0-9+\/]{4})*(?:[A-Za-z0-9+\/]{2}==|[A-Za-z0-9+\/]{3}=)?$/.")
83
+ end
84
+
85
+ return invalid_properties
86
+ end
87
+
88
+ # Check to see if the all the properties in the model are valid
89
+ # @return true if the model is valid
90
+ def valid?
91
+ return false if !@input_file_bytes.nil? && @input_file_bytes !~ Regexp.new(/^(?:[A-Za-z0-9+\/]{4})*(?:[A-Za-z0-9+\/]{2}==|[A-Za-z0-9+\/]{3}=)?$/)
92
+ return true
93
+ end
94
+
95
+ # Custom attribute writer method with validation
96
+ # @param [Object] input_file_bytes Value to be assigned
97
+ def input_file_bytes=(input_file_bytes)
98
+
99
+ if !input_file_bytes.nil? && input_file_bytes !~ Regexp.new(/^(?:[A-Za-z0-9+\/]{4})*(?:[A-Za-z0-9+\/]{2}==|[A-Za-z0-9+\/]{3}=)?$/)
100
+ fail ArgumentError, "invalid value for 'input_file_bytes', must conform to the pattern /^(?:[A-Za-z0-9+\/]{4})*(?:[A-Za-z0-9+\/]{2}==|[A-Za-z0-9+\/]{3}=)?$/."
101
+ end
102
+
103
+ @input_file_bytes = input_file_bytes
104
+ end
105
+
106
+ # Checks equality by comparing each attribute.
107
+ # @param [Object] Object to be compared
108
+ def ==(o)
109
+ return true if self.equal?(o)
110
+ self.class == o.class &&
111
+ input_file_bytes == o.input_file_bytes &&
112
+ input_file_url == o.input_file_url &&
113
+ start_delete_page_number == o.start_delete_page_number &&
114
+ end_delete_page_number == o.end_delete_page_number
115
+ end
116
+
117
+ # @see the `==` method
118
+ # @param [Object] Object to be compared
119
+ def eql?(o)
120
+ self == o
121
+ end
122
+
123
+ # Calculates hash code according to all attributes.
124
+ # @return [Fixnum] Hash code
125
+ def hash
126
+ [input_file_bytes, input_file_url, start_delete_page_number, end_delete_page_number].hash
127
+ end
128
+
129
+ # Builds the object from hash
130
+ # @param [Hash] attributes Model attributes in the form of hash
131
+ # @return [Object] Returns the model itself
132
+ def build_from_hash(attributes)
133
+ return nil unless attributes.is_a?(Hash)
134
+ self.class.swagger_types.each_pair do |key, type|
135
+ if type =~ /\AArray<(.*)>/i
136
+ # check to ensure the input is an array given that the the attribute
137
+ # is documented as an array but the input is not
138
+ if attributes[self.class.attribute_map[key]].is_a?(Array)
139
+ self.send("#{key}=", attributes[self.class.attribute_map[key]].map{ |v| _deserialize($1, v) } )
140
+ end
141
+ elsif !attributes[self.class.attribute_map[key]].nil?
142
+ self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
143
+ end # or else data not found in attributes(hash), not an issue as the data can be optional
144
+ end
145
+
146
+ self
147
+ end
148
+
149
+ # Deserializes the data based on type
150
+ # @param string type Data type
151
+ # @param string value Value to be deserialized
152
+ # @return [Object] Deserialized data
153
+ def _deserialize(type, value)
154
+ case type.to_sym
155
+ when :DateTime
156
+ DateTime.parse(value)
157
+ when :Date
158
+ Date.parse(value)
159
+ when :String
160
+ value.to_s
161
+ when :Integer
162
+ value.to_i
163
+ when :Float
164
+ value.to_f
165
+ when :BOOLEAN
166
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
167
+ true
168
+ else
169
+ false
170
+ end
171
+ when :Object
172
+ # generic object (usually a Hash), return directly
173
+ value
174
+ when /\AArray<(?<inner_type>.+)>\z/
175
+ inner_type = Regexp.last_match[:inner_type]
176
+ value.map { |v| _deserialize(inner_type, v) }
177
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
178
+ k_type = Regexp.last_match[:k_type]
179
+ v_type = Regexp.last_match[:v_type]
180
+ {}.tap do |hash|
181
+ value.each do |k, v|
182
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
183
+ end
184
+ end
185
+ else # model
186
+ temp_model = CloudmersiveConvertApiClient.const_get(type).new
187
+ temp_model.build_from_hash(value)
188
+ end
189
+ end
190
+
191
+ # Returns the string representation of the object
192
+ # @return [String] String presentation of the object
193
+ def to_s
194
+ to_hash.to_s
195
+ end
196
+
197
+ # to_body is an alias to to_hash (backward compatibility)
198
+ # @return [Hash] Returns the object in the form of hash
199
+ def to_body
200
+ to_hash
201
+ end
202
+
203
+ # Returns the object in the form of hash
204
+ # @return [Hash] Returns the object in the form of hash
205
+ def to_hash
206
+ hash = {}
207
+ self.class.attribute_map.each_pair do |attr, param|
208
+ value = self.send(attr)
209
+ next if value.nil?
210
+ hash[param] = _to_hash(value)
211
+ end
212
+ hash
213
+ end
214
+
215
+ # Outputs non-array value in the form of hash
216
+ # For object, use to_hash. Otherwise, just return the value
217
+ # @param [Object] value Any valid value
218
+ # @return [Hash] Returns the value in the form of hash
219
+ def _to_hash(value)
220
+ if value.is_a?(Array)
221
+ value.compact.map{ |v| _to_hash(v) }
222
+ elsif value.is_a?(Hash)
223
+ {}.tap do |hash|
224
+ value.each { |k, v| hash[k] = _to_hash(v) }
225
+ end
226
+ elsif value.respond_to? :to_hash
227
+ value.to_hash
228
+ else
229
+ value
230
+ end
231
+ end
232
+
233
+ end
234
+
235
+ end
@@ -11,5 +11,5 @@ Swagger Codegen version: 2.3.1
11
11
  =end
12
12
 
13
13
  module CloudmersiveConvertApiClient
14
- VERSION = "1.5.1"
14
+ VERSION = "1.5.2"
15
15
  end
@@ -33,7 +33,7 @@ describe 'ConvertWebApi' do
33
33
  end
34
34
 
35
35
  # unit tests for convert_web_html_to_docx
36
- # Convert HTML to DOCX
36
+ # Convert HTML to Word DOCX Document
37
37
  # Convert HTML to Office Word Document (DOCX) format
38
38
  # @param input_request HTL input to convert to DOCX
39
39
  # @param [Hash] opts the optional parameters
@@ -56,6 +56,18 @@ describe 'EditDocumentApi' do
56
56
  end
57
57
  end
58
58
 
59
+ # unit tests for edit_document_docx_delete_pages
60
+ # Delete, remove pages from a Word DOCX document
61
+ # Returns the pages and contents of each page defined in the Word Document (DOCX) format file
62
+ # @param req_config Document input request
63
+ # @param [Hash] opts the optional parameters
64
+ # @return [String]
65
+ describe 'edit_document_docx_delete_pages test' do
66
+ it "should work" do
67
+ # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers
68
+ end
69
+ end
70
+
59
71
  # unit tests for edit_document_docx_get_headers_and_footers
60
72
  # Get content of a footer from a Word DOCX document
61
73
  # Returns the footer content from a Word Document (DOCX) format file
@@ -152,6 +164,30 @@ describe 'EditDocumentApi' do
152
164
  end
153
165
  end
154
166
 
167
+ # unit tests for edit_document_docx_insert_table_row
168
+ # Insert a new row into an existing table in a Word DOCX document
169
+ # Adds a new table row into a DOCX Document and returns the result. Call Finish Editing on the output URL to complete the operation.
170
+ # @param req_config Document input request
171
+ # @param [Hash] opts the optional parameters
172
+ # @return [InsertDocxTableRowResponse]
173
+ describe 'edit_document_docx_insert_table_row test' do
174
+ it "should work" do
175
+ # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers
176
+ end
177
+ end
178
+
179
+ # unit tests for edit_document_docx_pages
180
+ # Get pages and content from a Word DOCX document
181
+ # Returns the pages and contents of each page defined in the Word Document (DOCX) format file
182
+ # @param req_config Document input request
183
+ # @param [Hash] opts the optional parameters
184
+ # @return [GetDocxPagesResponse]
185
+ describe 'edit_document_docx_pages test' do
186
+ it "should work" do
187
+ # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers
188
+ end
189
+ end
190
+
155
191
  # unit tests for edit_document_docx_remove_headers_and_footers
156
192
  # Remove headers and footers from Word DOCX document
157
193
  # Remove all headers, or footers, or both from a Word Document (DOCX). Call Finish Editing on the output URL to complete the operation.
@@ -98,6 +98,18 @@ describe 'EditPdfApi' do
98
98
  end
99
99
  end
100
100
 
101
+ # unit tests for edit_pdf_get_pdf_text_by_pages
102
+ # Get text in a PDF document by page
103
+ # Gets the text in a PDF by page
104
+ # @param input_file Input file to perform the operation on.
105
+ # @param [Hash] opts the optional parameters
106
+ # @return [PdfTextByPageResult]
107
+ describe 'edit_pdf_get_pdf_text_by_pages test' do
108
+ it "should work" do
109
+ # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers
110
+ end
111
+ end
112
+
101
113
  # unit tests for edit_pdf_insert_pages
102
114
  # Insert / copy pages from one PDF document into another
103
115
  # Copy one or more pages from one PDF document (source document) and insert them into a second PDF document (destination document).
@@ -0,0 +1,48 @@
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.3.1
10
+
11
+ =end
12
+
13
+ require 'spec_helper'
14
+ require 'json'
15
+ require 'date'
16
+
17
+ # Unit tests for CloudmersiveConvertApiClient::DocxPage
18
+ # Automatically generated by swagger-codegen (github.com/swagger-api/swagger-codegen)
19
+ # Please update as you see appropriate
20
+ describe 'DocxPage' do
21
+ before do
22
+ # run before each test
23
+ @instance = CloudmersiveConvertApiClient::DocxPage.new
24
+ end
25
+
26
+ after do
27
+ # run after each test
28
+ end
29
+
30
+ describe 'test an instance of DocxPage' do
31
+ it 'should create an instance of DocxPage' do
32
+ expect(@instance).to be_instance_of(CloudmersiveConvertApiClient::DocxPage)
33
+ end
34
+ end
35
+ describe 'test attribute "page_number"' do
36
+ it 'should work' do
37
+ # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers
38
+ end
39
+ end
40
+
41
+ describe 'test attribute "paragraphs"' do
42
+ it 'should work' do
43
+ # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers
44
+ end
45
+ end
46
+
47
+ end
48
+
@@ -0,0 +1,48 @@
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.3.1
10
+
11
+ =end
12
+
13
+ require 'spec_helper'
14
+ require 'json'
15
+ require 'date'
16
+
17
+ # Unit tests for CloudmersiveConvertApiClient::GetDocxPagesRequest
18
+ # Automatically generated by swagger-codegen (github.com/swagger-api/swagger-codegen)
19
+ # Please update as you see appropriate
20
+ describe 'GetDocxPagesRequest' do
21
+ before do
22
+ # run before each test
23
+ @instance = CloudmersiveConvertApiClient::GetDocxPagesRequest.new
24
+ end
25
+
26
+ after do
27
+ # run after each test
28
+ end
29
+
30
+ describe 'test an instance of GetDocxPagesRequest' do
31
+ it 'should create an instance of GetDocxPagesRequest' do
32
+ expect(@instance).to be_instance_of(CloudmersiveConvertApiClient::GetDocxPagesRequest)
33
+ end
34
+ end
35
+ describe 'test attribute "input_file_bytes"' do
36
+ it 'should work' do
37
+ # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers
38
+ end
39
+ end
40
+
41
+ describe 'test attribute "input_file_url"' do
42
+ it 'should work' do
43
+ # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers
44
+ end
45
+ end
46
+
47
+ end
48
+
@@ -0,0 +1,54 @@
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.3.1
10
+
11
+ =end
12
+
13
+ require 'spec_helper'
14
+ require 'json'
15
+ require 'date'
16
+
17
+ # Unit tests for CloudmersiveConvertApiClient::GetDocxPagesResponse
18
+ # Automatically generated by swagger-codegen (github.com/swagger-api/swagger-codegen)
19
+ # Please update as you see appropriate
20
+ describe 'GetDocxPagesResponse' do
21
+ before do
22
+ # run before each test
23
+ @instance = CloudmersiveConvertApiClient::GetDocxPagesResponse.new
24
+ end
25
+
26
+ after do
27
+ # run after each test
28
+ end
29
+
30
+ describe 'test an instance of GetDocxPagesResponse' do
31
+ it 'should create an instance of GetDocxPagesResponse' do
32
+ expect(@instance).to be_instance_of(CloudmersiveConvertApiClient::GetDocxPagesResponse)
33
+ end
34
+ end
35
+ describe 'test attribute "successful"' do
36
+ it 'should work' do
37
+ # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers
38
+ end
39
+ end
40
+
41
+ describe 'test attribute "pages"' do
42
+ it 'should work' do
43
+ # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers
44
+ end
45
+ end
46
+
47
+ describe 'test attribute "page_count"' do
48
+ it 'should work' do
49
+ # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers
50
+ end
51
+ end
52
+
53
+ end
54
+