cloudmersive-convert-api-client 1.5.1 → 1.5.2
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/README.md +17 -5
- data/docs/ConvertWebApi.md +3 -3
- data/docs/DocxPage.md +9 -0
- data/docs/EditDocumentApi.md +165 -0
- data/docs/EditPdfApi.md +55 -0
- data/docs/GetDocxPagesRequest.md +9 -0
- data/docs/GetDocxPagesResponse.md +10 -0
- data/docs/InsertDocxTableRowRequest.md +12 -0
- data/docs/InsertDocxTableRowResponse.md +9 -0
- data/docs/PdfPageText.md +9 -0
- data/docs/PdfTextByPageResult.md +9 -0
- data/docs/RemoveDocxPagesRequest.md +11 -0
- data/lib/cloudmersive-convert-api-client.rb +8 -0
- data/lib/cloudmersive-convert-api-client/api/convert_web_api.rb +2 -2
- data/lib/cloudmersive-convert-api-client/api/edit_document_api.rb +165 -0
- data/lib/cloudmersive-convert-api-client/api/edit_pdf_api.rb +56 -0
- data/lib/cloudmersive-convert-api-client/models/docx_page.rb +201 -0
- data/lib/cloudmersive-convert-api-client/models/get_docx_pages_request.rb +215 -0
- data/lib/cloudmersive-convert-api-client/models/get_docx_pages_response.rb +208 -0
- data/lib/cloudmersive-convert-api-client/models/insert_docx_table_row_request.rb +245 -0
- data/lib/cloudmersive-convert-api-client/models/insert_docx_table_row_response.rb +199 -0
- data/lib/cloudmersive-convert-api-client/models/pdf_page_text.rb +199 -0
- data/lib/cloudmersive-convert-api-client/models/pdf_text_by_page_result.rb +201 -0
- data/lib/cloudmersive-convert-api-client/models/remove_docx_pages_request.rb +235 -0
- data/lib/cloudmersive-convert-api-client/version.rb +1 -1
- data/spec/api/convert_web_api_spec.rb +1 -1
- data/spec/api/edit_document_api_spec.rb +36 -0
- data/spec/api/edit_pdf_api_spec.rb +12 -0
- data/spec/models/docx_page_spec.rb +48 -0
- data/spec/models/get_docx_pages_request_spec.rb +48 -0
- data/spec/models/get_docx_pages_response_spec.rb +54 -0
- data/spec/models/insert_docx_table_row_request_spec.rb +66 -0
- data/spec/models/insert_docx_table_row_response_spec.rb +48 -0
- data/spec/models/pdf_page_text_spec.rb +48 -0
- data/spec/models/pdf_text_by_page_result_spec.rb +48 -0
- data/spec/models/remove_docx_pages_request_spec.rb +60 -0
- metadata +26 -2
data/docs/PdfPageText.md
ADDED
@@ -0,0 +1,9 @@
|
|
1
|
+
# CloudmersiveConvertApiClient::PdfPageText
|
2
|
+
|
3
|
+
## Properties
|
4
|
+
Name | Type | Description | Notes
|
5
|
+
------------ | ------------- | ------------- | -------------
|
6
|
+
**page_number** | **Integer** | Page number of the page (1-based) | [optional]
|
7
|
+
**page_text** | **String** | Text of the page | [optional]
|
8
|
+
|
9
|
+
|
@@ -0,0 +1,9 @@
|
|
1
|
+
# CloudmersiveConvertApiClient::PdfTextByPageResult
|
2
|
+
|
3
|
+
## Properties
|
4
|
+
Name | Type | Description | Notes
|
5
|
+
------------ | ------------- | ------------- | -------------
|
6
|
+
**successful** | **BOOLEAN** | True if the operation was successful, false otherwise | [optional]
|
7
|
+
**pages** | [**Array<PdfPageText>**](PdfPageText.md) | Pages in the PDF | [optional]
|
8
|
+
|
9
|
+
|
@@ -0,0 +1,11 @@
|
|
1
|
+
# CloudmersiveConvertApiClient::RemoveDocxPagesRequest
|
2
|
+
|
3
|
+
## Properties
|
4
|
+
Name | Type | Description | Notes
|
5
|
+
------------ | ------------- | ------------- | -------------
|
6
|
+
**input_file_bytes** | **String** | Optional: Bytes of the input file to operate on | [optional]
|
7
|
+
**input_file_url** | **String** | 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). | [optional]
|
8
|
+
**start_delete_page_number** | **Integer** | Page number (1-based) to start deleting pages; inclusive | [optional]
|
9
|
+
**end_delete_page_number** | **Integer** | Page number (1-based) to stop deleting pages; inclusive | [optional]
|
10
|
+
|
11
|
+
|
@@ -31,6 +31,7 @@ require 'cloudmersive-convert-api-client/models/docx_header'
|
|
31
31
|
require 'cloudmersive-convert-api-client/models/docx_image'
|
32
32
|
require 'cloudmersive-convert-api-client/models/docx_insert_image_request'
|
33
33
|
require 'cloudmersive-convert-api-client/models/docx_insert_image_response'
|
34
|
+
require 'cloudmersive-convert-api-client/models/docx_page'
|
34
35
|
require 'cloudmersive-convert-api-client/models/docx_paragraph'
|
35
36
|
require 'cloudmersive-convert-api-client/models/docx_remove_object_request'
|
36
37
|
require 'cloudmersive-convert-api-client/models/docx_remove_object_response'
|
@@ -56,6 +57,8 @@ require 'cloudmersive-convert-api-client/models/get_docx_headers_and_footers_req
|
|
56
57
|
require 'cloudmersive-convert-api-client/models/get_docx_headers_and_footers_response'
|
57
58
|
require 'cloudmersive-convert-api-client/models/get_docx_images_request'
|
58
59
|
require 'cloudmersive-convert-api-client/models/get_docx_images_response'
|
60
|
+
require 'cloudmersive-convert-api-client/models/get_docx_pages_request'
|
61
|
+
require 'cloudmersive-convert-api-client/models/get_docx_pages_response'
|
59
62
|
require 'cloudmersive-convert-api-client/models/get_docx_sections_request'
|
60
63
|
require 'cloudmersive-convert-api-client/models/get_docx_sections_response'
|
61
64
|
require 'cloudmersive-convert-api-client/models/get_docx_styles_request'
|
@@ -82,6 +85,8 @@ require 'cloudmersive-convert-api-client/models/html_to_pdf_request'
|
|
82
85
|
require 'cloudmersive-convert-api-client/models/html_to_png_request'
|
83
86
|
require 'cloudmersive-convert-api-client/models/insert_docx_insert_paragraph_request'
|
84
87
|
require 'cloudmersive-convert-api-client/models/insert_docx_insert_paragraph_response'
|
88
|
+
require 'cloudmersive-convert-api-client/models/insert_docx_table_row_request'
|
89
|
+
require 'cloudmersive-convert-api-client/models/insert_docx_table_row_response'
|
85
90
|
require 'cloudmersive-convert-api-client/models/insert_docx_tables_request'
|
86
91
|
require 'cloudmersive-convert-api-client/models/insert_docx_tables_response'
|
87
92
|
require 'cloudmersive-convert-api-client/models/insert_xlsx_worksheet_request'
|
@@ -92,9 +97,12 @@ require 'cloudmersive-convert-api-client/models/pdf_document'
|
|
92
97
|
require 'cloudmersive-convert-api-client/models/pdf_form_field'
|
93
98
|
require 'cloudmersive-convert-api-client/models/pdf_form_fields'
|
94
99
|
require 'cloudmersive-convert-api-client/models/pdf_metadata'
|
100
|
+
require 'cloudmersive-convert-api-client/models/pdf_page_text'
|
101
|
+
require 'cloudmersive-convert-api-client/models/pdf_text_by_page_result'
|
95
102
|
require 'cloudmersive-convert-api-client/models/pdf_to_png_result'
|
96
103
|
require 'cloudmersive-convert-api-client/models/remove_docx_headers_and_footers_request'
|
97
104
|
require 'cloudmersive-convert-api-client/models/remove_docx_headers_and_footers_response'
|
105
|
+
require 'cloudmersive-convert-api-client/models/remove_docx_pages_request'
|
98
106
|
require 'cloudmersive-convert-api-client/models/replace_string_request'
|
99
107
|
require 'cloudmersive-convert-api-client/models/screenshot_request'
|
100
108
|
require 'cloudmersive-convert-api-client/models/set_form_field_value'
|
@@ -20,7 +20,7 @@ module CloudmersiveConvertApiClient
|
|
20
20
|
@api_client = api_client
|
21
21
|
end
|
22
22
|
|
23
|
-
# Convert HTML to DOCX
|
23
|
+
# Convert HTML to Word DOCX Document
|
24
24
|
# Convert HTML to Office Word Document (DOCX) format
|
25
25
|
# @param input_request HTL input to convert to DOCX
|
26
26
|
# @param [Hash] opts the optional parameters
|
@@ -30,7 +30,7 @@ module CloudmersiveConvertApiClient
|
|
30
30
|
return data
|
31
31
|
end
|
32
32
|
|
33
|
-
# Convert HTML to DOCX
|
33
|
+
# Convert HTML to Word DOCX Document
|
34
34
|
# Convert HTML to Office Word Document (DOCX) format
|
35
35
|
# @param input_request HTL input to convert to DOCX
|
36
36
|
# @param [Hash] opts the optional parameters
|
@@ -131,6 +131,61 @@ module CloudmersiveConvertApiClient
|
|
131
131
|
return data, status_code, headers
|
132
132
|
end
|
133
133
|
|
134
|
+
# Delete, remove pages from a Word DOCX document
|
135
|
+
# Returns the pages and contents of each page defined in the Word Document (DOCX) format file
|
136
|
+
# @param req_config Document input request
|
137
|
+
# @param [Hash] opts the optional parameters
|
138
|
+
# @return [String]
|
139
|
+
def edit_document_docx_delete_pages(req_config, opts = {})
|
140
|
+
data, _status_code, _headers = edit_document_docx_delete_pages_with_http_info(req_config, opts)
|
141
|
+
return data
|
142
|
+
end
|
143
|
+
|
144
|
+
# Delete, remove pages from a Word DOCX document
|
145
|
+
# Returns the pages and contents of each page defined in the Word Document (DOCX) format file
|
146
|
+
# @param req_config Document input request
|
147
|
+
# @param [Hash] opts the optional parameters
|
148
|
+
# @return [Array<(String, Fixnum, Hash)>] String data, response status code and response headers
|
149
|
+
def edit_document_docx_delete_pages_with_http_info(req_config, opts = {})
|
150
|
+
if @api_client.config.debugging
|
151
|
+
@api_client.config.logger.debug "Calling API: EditDocumentApi.edit_document_docx_delete_pages ..."
|
152
|
+
end
|
153
|
+
# verify the required parameter 'req_config' is set
|
154
|
+
if @api_client.config.client_side_validation && req_config.nil?
|
155
|
+
fail ArgumentError, "Missing the required parameter 'req_config' when calling EditDocumentApi.edit_document_docx_delete_pages"
|
156
|
+
end
|
157
|
+
# resource path
|
158
|
+
local_var_path = "/convert/edit/docx/delete-pages"
|
159
|
+
|
160
|
+
# query parameters
|
161
|
+
query_params = {}
|
162
|
+
|
163
|
+
# header parameters
|
164
|
+
header_params = {}
|
165
|
+
# HTTP header 'Accept' (if needed)
|
166
|
+
header_params['Accept'] = @api_client.select_header_accept(['application/octet-stream'])
|
167
|
+
# HTTP header 'Content-Type'
|
168
|
+
header_params['Content-Type'] = @api_client.select_header_content_type(['application/json', 'text/json', 'application/xml', 'text/xml', 'application/x-www-form-urlencoded'])
|
169
|
+
|
170
|
+
# form parameters
|
171
|
+
form_params = {}
|
172
|
+
|
173
|
+
# http body (model)
|
174
|
+
post_body = @api_client.object_to_http_body(req_config)
|
175
|
+
auth_names = ['Apikey']
|
176
|
+
data, status_code, headers = @api_client.call_api(:POST, local_var_path,
|
177
|
+
:header_params => header_params,
|
178
|
+
:query_params => query_params,
|
179
|
+
:form_params => form_params,
|
180
|
+
:body => post_body,
|
181
|
+
:auth_names => auth_names,
|
182
|
+
:return_type => 'String')
|
183
|
+
if @api_client.config.debugging
|
184
|
+
@api_client.config.logger.debug "API called: EditDocumentApi#edit_document_docx_delete_pages\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
|
185
|
+
end
|
186
|
+
return data, status_code, headers
|
187
|
+
end
|
188
|
+
|
134
189
|
# Get content of a footer from a Word DOCX document
|
135
190
|
# Returns the footer content from a Word Document (DOCX) format file
|
136
191
|
# @param req_config Document input request
|
@@ -571,6 +626,116 @@ module CloudmersiveConvertApiClient
|
|
571
626
|
return data, status_code, headers
|
572
627
|
end
|
573
628
|
|
629
|
+
# Insert a new row into an existing table in a Word DOCX document
|
630
|
+
# Adds a new table row into a DOCX Document and returns the result. Call Finish Editing on the output URL to complete the operation.
|
631
|
+
# @param req_config Document input request
|
632
|
+
# @param [Hash] opts the optional parameters
|
633
|
+
# @return [InsertDocxTableRowResponse]
|
634
|
+
def edit_document_docx_insert_table_row(req_config, opts = {})
|
635
|
+
data, _status_code, _headers = edit_document_docx_insert_table_row_with_http_info(req_config, opts)
|
636
|
+
return data
|
637
|
+
end
|
638
|
+
|
639
|
+
# Insert a new row into an existing table in a Word DOCX document
|
640
|
+
# Adds a new table row into a DOCX Document and returns the result. Call Finish Editing on the output URL to complete the operation.
|
641
|
+
# @param req_config Document input request
|
642
|
+
# @param [Hash] opts the optional parameters
|
643
|
+
# @return [Array<(InsertDocxTableRowResponse, Fixnum, Hash)>] InsertDocxTableRowResponse data, response status code and response headers
|
644
|
+
def edit_document_docx_insert_table_row_with_http_info(req_config, opts = {})
|
645
|
+
if @api_client.config.debugging
|
646
|
+
@api_client.config.logger.debug "Calling API: EditDocumentApi.edit_document_docx_insert_table_row ..."
|
647
|
+
end
|
648
|
+
# verify the required parameter 'req_config' is set
|
649
|
+
if @api_client.config.client_side_validation && req_config.nil?
|
650
|
+
fail ArgumentError, "Missing the required parameter 'req_config' when calling EditDocumentApi.edit_document_docx_insert_table_row"
|
651
|
+
end
|
652
|
+
# resource path
|
653
|
+
local_var_path = "/convert/edit/docx/insert-table-row"
|
654
|
+
|
655
|
+
# query parameters
|
656
|
+
query_params = {}
|
657
|
+
|
658
|
+
# header parameters
|
659
|
+
header_params = {}
|
660
|
+
# HTTP header 'Accept' (if needed)
|
661
|
+
header_params['Accept'] = @api_client.select_header_accept(['application/json', 'text/json', 'application/xml', 'text/xml'])
|
662
|
+
# HTTP header 'Content-Type'
|
663
|
+
header_params['Content-Type'] = @api_client.select_header_content_type(['application/json', 'text/json', 'application/xml', 'text/xml', 'application/x-www-form-urlencoded'])
|
664
|
+
|
665
|
+
# form parameters
|
666
|
+
form_params = {}
|
667
|
+
|
668
|
+
# http body (model)
|
669
|
+
post_body = @api_client.object_to_http_body(req_config)
|
670
|
+
auth_names = ['Apikey']
|
671
|
+
data, status_code, headers = @api_client.call_api(:POST, local_var_path,
|
672
|
+
:header_params => header_params,
|
673
|
+
:query_params => query_params,
|
674
|
+
:form_params => form_params,
|
675
|
+
:body => post_body,
|
676
|
+
:auth_names => auth_names,
|
677
|
+
:return_type => 'InsertDocxTableRowResponse')
|
678
|
+
if @api_client.config.debugging
|
679
|
+
@api_client.config.logger.debug "API called: EditDocumentApi#edit_document_docx_insert_table_row\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
|
680
|
+
end
|
681
|
+
return data, status_code, headers
|
682
|
+
end
|
683
|
+
|
684
|
+
# Get pages and content from a Word DOCX document
|
685
|
+
# Returns the pages and contents of each page defined in the Word Document (DOCX) format file
|
686
|
+
# @param req_config Document input request
|
687
|
+
# @param [Hash] opts the optional parameters
|
688
|
+
# @return [GetDocxPagesResponse]
|
689
|
+
def edit_document_docx_pages(req_config, opts = {})
|
690
|
+
data, _status_code, _headers = edit_document_docx_pages_with_http_info(req_config, opts)
|
691
|
+
return data
|
692
|
+
end
|
693
|
+
|
694
|
+
# Get pages and content from a Word DOCX document
|
695
|
+
# Returns the pages and contents of each page defined in the Word Document (DOCX) format file
|
696
|
+
# @param req_config Document input request
|
697
|
+
# @param [Hash] opts the optional parameters
|
698
|
+
# @return [Array<(GetDocxPagesResponse, Fixnum, Hash)>] GetDocxPagesResponse data, response status code and response headers
|
699
|
+
def edit_document_docx_pages_with_http_info(req_config, opts = {})
|
700
|
+
if @api_client.config.debugging
|
701
|
+
@api_client.config.logger.debug "Calling API: EditDocumentApi.edit_document_docx_pages ..."
|
702
|
+
end
|
703
|
+
# verify the required parameter 'req_config' is set
|
704
|
+
if @api_client.config.client_side_validation && req_config.nil?
|
705
|
+
fail ArgumentError, "Missing the required parameter 'req_config' when calling EditDocumentApi.edit_document_docx_pages"
|
706
|
+
end
|
707
|
+
# resource path
|
708
|
+
local_var_path = "/convert/edit/docx/get-pages"
|
709
|
+
|
710
|
+
# query parameters
|
711
|
+
query_params = {}
|
712
|
+
|
713
|
+
# header parameters
|
714
|
+
header_params = {}
|
715
|
+
# HTTP header 'Accept' (if needed)
|
716
|
+
header_params['Accept'] = @api_client.select_header_accept(['application/json', 'text/json', 'application/xml', 'text/xml'])
|
717
|
+
# HTTP header 'Content-Type'
|
718
|
+
header_params['Content-Type'] = @api_client.select_header_content_type(['application/json', 'text/json', 'application/xml', 'text/xml', 'application/x-www-form-urlencoded'])
|
719
|
+
|
720
|
+
# form parameters
|
721
|
+
form_params = {}
|
722
|
+
|
723
|
+
# http body (model)
|
724
|
+
post_body = @api_client.object_to_http_body(req_config)
|
725
|
+
auth_names = ['Apikey']
|
726
|
+
data, status_code, headers = @api_client.call_api(:POST, local_var_path,
|
727
|
+
:header_params => header_params,
|
728
|
+
:query_params => query_params,
|
729
|
+
:form_params => form_params,
|
730
|
+
:body => post_body,
|
731
|
+
:auth_names => auth_names,
|
732
|
+
:return_type => 'GetDocxPagesResponse')
|
733
|
+
if @api_client.config.debugging
|
734
|
+
@api_client.config.logger.debug "API called: EditDocumentApi#edit_document_docx_pages\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
|
735
|
+
end
|
736
|
+
return data, status_code, headers
|
737
|
+
end
|
738
|
+
|
574
739
|
# Remove headers and footers from Word DOCX document
|
575
740
|
# Remove all headers, or footers, or both from a Word Document (DOCX). Call Finish Editing on the output URL to complete the operation.
|
576
741
|
# @param req_config Document input request
|
@@ -330,6 +330,62 @@ module CloudmersiveConvertApiClient
|
|
330
330
|
return data, status_code, headers
|
331
331
|
end
|
332
332
|
|
333
|
+
# Get text in a PDF document by page
|
334
|
+
# Gets the text in a PDF by page
|
335
|
+
# @param input_file Input file to perform the operation on.
|
336
|
+
# @param [Hash] opts the optional parameters
|
337
|
+
# @return [PdfTextByPageResult]
|
338
|
+
def edit_pdf_get_pdf_text_by_pages(input_file, opts = {})
|
339
|
+
data, _status_code, _headers = edit_pdf_get_pdf_text_by_pages_with_http_info(input_file, opts)
|
340
|
+
return data
|
341
|
+
end
|
342
|
+
|
343
|
+
# Get text in a PDF document by page
|
344
|
+
# Gets the text in a PDF by page
|
345
|
+
# @param input_file Input file to perform the operation on.
|
346
|
+
# @param [Hash] opts the optional parameters
|
347
|
+
# @return [Array<(PdfTextByPageResult, Fixnum, Hash)>] PdfTextByPageResult data, response status code and response headers
|
348
|
+
def edit_pdf_get_pdf_text_by_pages_with_http_info(input_file, opts = {})
|
349
|
+
if @api_client.config.debugging
|
350
|
+
@api_client.config.logger.debug "Calling API: EditPdfApi.edit_pdf_get_pdf_text_by_pages ..."
|
351
|
+
end
|
352
|
+
# verify the required parameter 'input_file' is set
|
353
|
+
if @api_client.config.client_side_validation && input_file.nil?
|
354
|
+
fail ArgumentError, "Missing the required parameter 'input_file' when calling EditPdfApi.edit_pdf_get_pdf_text_by_pages"
|
355
|
+
end
|
356
|
+
# resource path
|
357
|
+
local_var_path = "/convert/edit/pdf/pages/get-text"
|
358
|
+
|
359
|
+
# query parameters
|
360
|
+
query_params = {}
|
361
|
+
|
362
|
+
# header parameters
|
363
|
+
header_params = {}
|
364
|
+
# HTTP header 'Accept' (if needed)
|
365
|
+
header_params['Accept'] = @api_client.select_header_accept(['application/json', 'text/json', 'application/xml', 'text/xml'])
|
366
|
+
# HTTP header 'Content-Type'
|
367
|
+
header_params['Content-Type'] = @api_client.select_header_content_type(['multipart/form-data'])
|
368
|
+
|
369
|
+
# form parameters
|
370
|
+
form_params = {}
|
371
|
+
form_params["inputFile"] = input_file
|
372
|
+
|
373
|
+
# http body (model)
|
374
|
+
post_body = nil
|
375
|
+
auth_names = ['Apikey']
|
376
|
+
data, status_code, headers = @api_client.call_api(:POST, local_var_path,
|
377
|
+
:header_params => header_params,
|
378
|
+
:query_params => query_params,
|
379
|
+
:form_params => form_params,
|
380
|
+
:body => post_body,
|
381
|
+
:auth_names => auth_names,
|
382
|
+
:return_type => 'PdfTextByPageResult')
|
383
|
+
if @api_client.config.debugging
|
384
|
+
@api_client.config.logger.debug "API called: EditPdfApi#edit_pdf_get_pdf_text_by_pages\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
|
385
|
+
end
|
386
|
+
return data, status_code, headers
|
387
|
+
end
|
388
|
+
|
333
389
|
# Insert / copy pages from one PDF document into another
|
334
390
|
# Copy one or more pages from one PDF document (source document) and insert them into a second PDF document (destination document).
|
335
391
|
# @param source_file Source PDF file to copy pages from.
|
@@ -0,0 +1,201 @@
|
|
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
|
+
|
17
|
+
class DocxPage
|
18
|
+
# Page number of this page, 1-based
|
19
|
+
attr_accessor :page_number
|
20
|
+
|
21
|
+
# All paragraphs anywhere in the document; these objects are not sequentially placed but are scatted across document
|
22
|
+
attr_accessor :paragraphs
|
23
|
+
|
24
|
+
|
25
|
+
# Attribute mapping from ruby-style variable name to JSON key.
|
26
|
+
def self.attribute_map
|
27
|
+
{
|
28
|
+
:'page_number' => :'PageNumber',
|
29
|
+
:'paragraphs' => :'Paragraphs'
|
30
|
+
}
|
31
|
+
end
|
32
|
+
|
33
|
+
# Attribute type mapping.
|
34
|
+
def self.swagger_types
|
35
|
+
{
|
36
|
+
:'page_number' => :'Integer',
|
37
|
+
:'paragraphs' => :'Array<DocxParagraph>'
|
38
|
+
}
|
39
|
+
end
|
40
|
+
|
41
|
+
# Initializes the object
|
42
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
43
|
+
def initialize(attributes = {})
|
44
|
+
return unless attributes.is_a?(Hash)
|
45
|
+
|
46
|
+
# convert string to symbol for hash key
|
47
|
+
attributes = attributes.each_with_object({}){|(k,v), h| h[k.to_sym] = v}
|
48
|
+
|
49
|
+
if attributes.has_key?(:'PageNumber')
|
50
|
+
self.page_number = attributes[:'PageNumber']
|
51
|
+
end
|
52
|
+
|
53
|
+
if attributes.has_key?(:'Paragraphs')
|
54
|
+
if (value = attributes[:'Paragraphs']).is_a?(Array)
|
55
|
+
self.paragraphs = value
|
56
|
+
end
|
57
|
+
end
|
58
|
+
|
59
|
+
end
|
60
|
+
|
61
|
+
# Show invalid properties with the reasons. Usually used together with valid?
|
62
|
+
# @return Array for valid properties with the reasons
|
63
|
+
def list_invalid_properties
|
64
|
+
invalid_properties = Array.new
|
65
|
+
return 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 true
|
72
|
+
end
|
73
|
+
|
74
|
+
# Checks equality by comparing each attribute.
|
75
|
+
# @param [Object] Object to be compared
|
76
|
+
def ==(o)
|
77
|
+
return true if self.equal?(o)
|
78
|
+
self.class == o.class &&
|
79
|
+
page_number == o.page_number &&
|
80
|
+
paragraphs == o.paragraphs
|
81
|
+
end
|
82
|
+
|
83
|
+
# @see the `==` method
|
84
|
+
# @param [Object] Object to be compared
|
85
|
+
def eql?(o)
|
86
|
+
self == o
|
87
|
+
end
|
88
|
+
|
89
|
+
# Calculates hash code according to all attributes.
|
90
|
+
# @return [Fixnum] Hash code
|
91
|
+
def hash
|
92
|
+
[page_number, paragraphs].hash
|
93
|
+
end
|
94
|
+
|
95
|
+
# Builds the object from hash
|
96
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
97
|
+
# @return [Object] Returns the model itself
|
98
|
+
def build_from_hash(attributes)
|
99
|
+
return nil unless attributes.is_a?(Hash)
|
100
|
+
self.class.swagger_types.each_pair do |key, type|
|
101
|
+
if type =~ /\AArray<(.*)>/i
|
102
|
+
# check to ensure the input is an array given that the the attribute
|
103
|
+
# is documented as an array but the input is not
|
104
|
+
if attributes[self.class.attribute_map[key]].is_a?(Array)
|
105
|
+
self.send("#{key}=", attributes[self.class.attribute_map[key]].map{ |v| _deserialize($1, v) } )
|
106
|
+
end
|
107
|
+
elsif !attributes[self.class.attribute_map[key]].nil?
|
108
|
+
self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
|
109
|
+
end # or else data not found in attributes(hash), not an issue as the data can be optional
|
110
|
+
end
|
111
|
+
|
112
|
+
self
|
113
|
+
end
|
114
|
+
|
115
|
+
# Deserializes the data based on type
|
116
|
+
# @param string type Data type
|
117
|
+
# @param string value Value to be deserialized
|
118
|
+
# @return [Object] Deserialized data
|
119
|
+
def _deserialize(type, value)
|
120
|
+
case type.to_sym
|
121
|
+
when :DateTime
|
122
|
+
DateTime.parse(value)
|
123
|
+
when :Date
|
124
|
+
Date.parse(value)
|
125
|
+
when :String
|
126
|
+
value.to_s
|
127
|
+
when :Integer
|
128
|
+
value.to_i
|
129
|
+
when :Float
|
130
|
+
value.to_f
|
131
|
+
when :BOOLEAN
|
132
|
+
if value.to_s =~ /\A(true|t|yes|y|1)\z/i
|
133
|
+
true
|
134
|
+
else
|
135
|
+
false
|
136
|
+
end
|
137
|
+
when :Object
|
138
|
+
# generic object (usually a Hash), return directly
|
139
|
+
value
|
140
|
+
when /\AArray<(?<inner_type>.+)>\z/
|
141
|
+
inner_type = Regexp.last_match[:inner_type]
|
142
|
+
value.map { |v| _deserialize(inner_type, v) }
|
143
|
+
when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
|
144
|
+
k_type = Regexp.last_match[:k_type]
|
145
|
+
v_type = Regexp.last_match[:v_type]
|
146
|
+
{}.tap do |hash|
|
147
|
+
value.each do |k, v|
|
148
|
+
hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
|
149
|
+
end
|
150
|
+
end
|
151
|
+
else # model
|
152
|
+
temp_model = CloudmersiveConvertApiClient.const_get(type).new
|
153
|
+
temp_model.build_from_hash(value)
|
154
|
+
end
|
155
|
+
end
|
156
|
+
|
157
|
+
# Returns the string representation of the object
|
158
|
+
# @return [String] String presentation of the object
|
159
|
+
def to_s
|
160
|
+
to_hash.to_s
|
161
|
+
end
|
162
|
+
|
163
|
+
# to_body is an alias to to_hash (backward compatibility)
|
164
|
+
# @return [Hash] Returns the object in the form of hash
|
165
|
+
def to_body
|
166
|
+
to_hash
|
167
|
+
end
|
168
|
+
|
169
|
+
# Returns the object in the form of hash
|
170
|
+
# @return [Hash] Returns the object in the form of hash
|
171
|
+
def to_hash
|
172
|
+
hash = {}
|
173
|
+
self.class.attribute_map.each_pair do |attr, param|
|
174
|
+
value = self.send(attr)
|
175
|
+
next if value.nil?
|
176
|
+
hash[param] = _to_hash(value)
|
177
|
+
end
|
178
|
+
hash
|
179
|
+
end
|
180
|
+
|
181
|
+
# Outputs non-array value in the form of hash
|
182
|
+
# For object, use to_hash. Otherwise, just return the value
|
183
|
+
# @param [Object] value Any valid value
|
184
|
+
# @return [Hash] Returns the value in the form of hash
|
185
|
+
def _to_hash(value)
|
186
|
+
if value.is_a?(Array)
|
187
|
+
value.compact.map{ |v| _to_hash(v) }
|
188
|
+
elsif value.is_a?(Hash)
|
189
|
+
{}.tap do |hash|
|
190
|
+
value.each { |k, v| hash[k] = _to_hash(v) }
|
191
|
+
end
|
192
|
+
elsif value.respond_to? :to_hash
|
193
|
+
value.to_hash
|
194
|
+
else
|
195
|
+
value
|
196
|
+
end
|
197
|
+
end
|
198
|
+
|
199
|
+
end
|
200
|
+
|
201
|
+
end
|