Skip to content

Commit 9cbff21

Browse files
added compare tests
1 parent 841a937 commit 9cbff21

File tree

3 files changed

+74
-107
lines changed

3 files changed

+74
-107
lines changed

docs/PdfApi.md

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -2855,7 +2855,7 @@ Name | Type | Description | Notes
28552855

28562856

28572857
# **get_mht_in_storage_to_pdf**
2858-
> File get_mht_in_storage_to_pdf(src_path, height, width, margin_left, margin_bottom, margin_right, margin_top, opts)
2858+
> File get_mht_in_storage_to_pdf(src_path, opts)
28592859
28602860
Convert MHT file (located on storage) to PDF format and return resulting file in response.
28612861

@@ -2864,12 +2864,12 @@ Convert MHT file (located on storage) to PDF format and return resulting file in
28642864
Name | Type | Description | Notes
28652865
------------- | ------------- | ------------- | -------------
28662866
**src_path** | **String**| Full source filename (ex. /folder1/folder2/template.mht) |
2867-
**height** | **Float**| Page height |
2868-
**width** | **Float**| Page width |
2869-
**margin_left** | **Float**| Page margin left |
2870-
**margin_bottom** | **Float**| Page margin bottom |
2871-
**margin_right** | **Float**| Page margin right |
2872-
**margin_top** | **Float**| Page margin top |
2867+
**height** | **Float**| Page height | [optional]
2868+
**width** | **Float**| Page width | [optional]
2869+
**margin_left** | **Float**| Page margin left | [optional]
2870+
**margin_bottom** | **Float**| Page margin bottom | [optional]
2871+
**margin_right** | **Float**| Page margin right | [optional]
2872+
**margin_top** | **Float**| Page margin top | [optional]
28732873
**storage** | **String**| The document storage. | [optional]
28742874

28752875
### Return type
@@ -8153,7 +8153,7 @@ Name | Type | Description | Notes
81538153

81548154

81558155
# **put_mht_in_storage_to_pdf**
8156-
> AsposeResponse put_mht_in_storage_to_pdf(name, src_path, height, width, margin_left, margin_bottom, margin_right, margin_top, opts)
8156+
> AsposeResponse put_mht_in_storage_to_pdf(name, src_path, opts)
81578157
81588158
Convert MHT file (located on storage) to PDF format and upload resulting file to storage.
81598159

@@ -8163,12 +8163,12 @@ Name | Type | Description | Notes
81638163
------------- | ------------- | ------------- | -------------
81648164
**name** | **String**| The document name. |
81658165
**src_path** | **String**| Full source filename (ex. /folder1/folder2/template.mht) |
8166-
**height** | **Float**| Page height |
8167-
**width** | **Float**| Page width |
8168-
**margin_left** | **Float**| Page margin left |
8169-
**margin_bottom** | **Float**| Page margin bottom |
8170-
**margin_right** | **Float**| Page margin right |
8171-
**margin_top** | **Float**| Page margin top |
8166+
**height** | **Float**| Page height | [optional]
8167+
**width** | **Float**| Page width | [optional]
8168+
**margin_left** | **Float**| Page margin left | [optional]
8169+
**margin_bottom** | **Float**| Page margin bottom | [optional]
8170+
**margin_right** | **Float**| Page margin right | [optional]
8171+
**margin_top** | **Float**| Page margin top | [optional]
81728172
**dst_folder** | **String**| The destination document folder. | [optional]
81738173
**storage** | **String**| The document storage. | [optional]
81748174

lib/aspose_pdf_cloud/api/pdf_api.rb

Lines changed: 44 additions & 92 deletions
Original file line numberDiff line numberDiff line change
@@ -7596,22 +7596,22 @@ def get_markdown_in_storage_to_pdf_with_http_info(src_path, opts = {})
75967596
# Convert MHT file (located on storage) to PDF format and return resulting file in response.
75977597
#
75987598
# @param src_path Full source filename (ex. /folder1/folder2/template.mht)
7599-
# @param height Page height
7600-
# @param width Page width
7601-
# @param margin_left Page margin left
7602-
# @param margin_bottom Page margin bottom
7603-
# @param margin_right Page margin right
7604-
# @param margin_top Page margin top
76057599
# @param [Hash] opts the optional parameters
7600+
# @option opts [Float] :height Page height
7601+
# @option opts [Float] :width Page width
7602+
# @option opts [Float] :margin_left Page margin left
7603+
# @option opts [Float] :margin_bottom Page margin bottom
7604+
# @option opts [Float] :margin_right Page margin right
7605+
# @option opts [Float] :margin_top Page margin top
76067606
# @option opts [String] :storage The document storage.
76077607
# @return [File]
7608-
def get_mht_in_storage_to_pdf(src_path, height, width, margin_left, margin_bottom, margin_right, margin_top, opts = {})
7608+
def get_mht_in_storage_to_pdf(src_path, opts = {})
76097609
@api_client.request_token_if_needed
7610-
data, _status_code, _headers = get_mht_in_storage_to_pdf_with_http_info(src_path, height, width, margin_left, margin_bottom, margin_right, margin_top, opts)
7610+
data, _status_code, _headers = get_mht_in_storage_to_pdf_with_http_info(src_path, opts)
76117611
rescue ApiError => error
76127612
if error.code == 401
76137613
@api_client.request_token_if_needed
7614-
data, _status_code, _headers = get_mht_in_storage_to_pdf_with_http_info(src_path, height, width, margin_left, margin_bottom, margin_right, margin_top, opts)
7614+
data, _status_code, _headers = get_mht_in_storage_to_pdf_with_http_info(src_path, opts)
76157615
else
76167616
raise
76177617
end
@@ -7621,59 +7621,35 @@ def get_mht_in_storage_to_pdf(src_path, height, width, margin_left, margin_botto
76217621
# Convert MHT file (located on storage) to PDF format and return resulting file in response.
76227622
#
76237623
# @param src_path Full source filename (ex. /folder1/folder2/template.mht)
7624-
# @param height Page height
7625-
# @param width Page width
7626-
# @param margin_left Page margin left
7627-
# @param margin_bottom Page margin bottom
7628-
# @param margin_right Page margin right
7629-
# @param margin_top Page margin top
76307624
# @param [Hash] opts the optional parameters
7625+
# @option opts [Float] :height Page height
7626+
# @option opts [Float] :width Page width
7627+
# @option opts [Float] :margin_left Page margin left
7628+
# @option opts [Float] :margin_bottom Page margin bottom
7629+
# @option opts [Float] :margin_right Page margin right
7630+
# @option opts [Float] :margin_top Page margin top
76317631
# @option opts [String] :storage The document storage.
76327632
# @return [Array<(File, Fixnum, Hash)>] File data, response status code and response headers
7633-
def get_mht_in_storage_to_pdf_with_http_info(src_path, height, width, margin_left, margin_bottom, margin_right, margin_top, opts = {})
7633+
def get_mht_in_storage_to_pdf_with_http_info(src_path, opts = {})
76347634
if @api_client.config.debugging
76357635
@api_client.config.logger.debug "Calling API: PdfApi.get_mht_in_storage_to_pdf ..."
76367636
end
76377637
# verify the required parameter 'src_path' is set
76387638
if @api_client.config.client_side_validation && src_path.nil?
76397639
fail ArgumentError, "Missing the required parameter 'src_path' when calling PdfApi.get_mht_in_storage_to_pdf"
76407640
end
7641-
# verify the required parameter 'height' is set
7642-
if @api_client.config.client_side_validation && height.nil?
7643-
fail ArgumentError, "Missing the required parameter 'height' when calling PdfApi.get_mht_in_storage_to_pdf"
7644-
end
7645-
# verify the required parameter 'width' is set
7646-
if @api_client.config.client_side_validation && width.nil?
7647-
fail ArgumentError, "Missing the required parameter 'width' when calling PdfApi.get_mht_in_storage_to_pdf"
7648-
end
7649-
# verify the required parameter 'margin_left' is set
7650-
if @api_client.config.client_side_validation && margin_left.nil?
7651-
fail ArgumentError, "Missing the required parameter 'margin_left' when calling PdfApi.get_mht_in_storage_to_pdf"
7652-
end
7653-
# verify the required parameter 'margin_bottom' is set
7654-
if @api_client.config.client_side_validation && margin_bottom.nil?
7655-
fail ArgumentError, "Missing the required parameter 'margin_bottom' when calling PdfApi.get_mht_in_storage_to_pdf"
7656-
end
7657-
# verify the required parameter 'margin_right' is set
7658-
if @api_client.config.client_side_validation && margin_right.nil?
7659-
fail ArgumentError, "Missing the required parameter 'margin_right' when calling PdfApi.get_mht_in_storage_to_pdf"
7660-
end
7661-
# verify the required parameter 'margin_top' is set
7662-
if @api_client.config.client_side_validation && margin_top.nil?
7663-
fail ArgumentError, "Missing the required parameter 'margin_top' when calling PdfApi.get_mht_in_storage_to_pdf"
7664-
end
76657641
# resource path
76667642
local_var_path = "/pdf/create/mht"
76677643

76687644
# query parameters
76697645
query_params = {}
76707646
query_params[:'srcPath'] = src_path
7671-
query_params[:'height'] = height
7672-
query_params[:'width'] = width
7673-
query_params[:'marginLeft'] = margin_left
7674-
query_params[:'marginBottom'] = margin_bottom
7675-
query_params[:'marginRight'] = margin_right
7676-
query_params[:'marginTop'] = margin_top
7647+
query_params[:'height'] = opts[:'height'] if !opts[:'height'].nil?
7648+
query_params[:'width'] = opts[:'width'] if !opts[:'width'].nil?
7649+
query_params[:'marginLeft'] = opts[:'margin_left'] if !opts[:'margin_left'].nil?
7650+
query_params[:'marginBottom'] = opts[:'margin_bottom'] if !opts[:'margin_bottom'].nil?
7651+
query_params[:'marginRight'] = opts[:'margin_right'] if !opts[:'margin_right'].nil?
7652+
query_params[:'marginTop'] = opts[:'margin_top'] if !opts[:'margin_top'].nil?
76777653
query_params[:'storage'] = opts[:'storage'] if !opts[:'storage'].nil?
76787654

76797655
# header parameters
@@ -24277,23 +24253,23 @@ def put_merge_documents_with_http_info(name, merge_documents, opts = {})
2427724253
#
2427824254
# @param name The document name.
2427924255
# @param src_path Full source filename (ex. /folder1/folder2/template.mht)
24280-
# @param height Page height
24281-
# @param width Page width
24282-
# @param margin_left Page margin left
24283-
# @param margin_bottom Page margin bottom
24284-
# @param margin_right Page margin right
24285-
# @param margin_top Page margin top
2428624256
# @param [Hash] opts the optional parameters
24257+
# @option opts [Float] :height Page height
24258+
# @option opts [Float] :width Page width
24259+
# @option opts [Float] :margin_left Page margin left
24260+
# @option opts [Float] :margin_bottom Page margin bottom
24261+
# @option opts [Float] :margin_right Page margin right
24262+
# @option opts [Float] :margin_top Page margin top
2428724263
# @option opts [String] :dst_folder The destination document folder.
2428824264
# @option opts [String] :storage The document storage.
2428924265
# @return [AsposeResponse]
24290-
def put_mht_in_storage_to_pdf(name, src_path, height, width, margin_left, margin_bottom, margin_right, margin_top, opts = {})
24266+
def put_mht_in_storage_to_pdf(name, src_path, opts = {})
2429124267
@api_client.request_token_if_needed
24292-
data, _status_code, _headers = put_mht_in_storage_to_pdf_with_http_info(name, src_path, height, width, margin_left, margin_bottom, margin_right, margin_top, opts)
24268+
data, _status_code, _headers = put_mht_in_storage_to_pdf_with_http_info(name, src_path, opts)
2429324269
rescue ApiError => error
2429424270
if error.code == 401
2429524271
@api_client.request_token_if_needed
24296-
data, _status_code, _headers = put_mht_in_storage_to_pdf_with_http_info(name, src_path, height, width, margin_left, margin_bottom, margin_right, margin_top, opts)
24272+
data, _status_code, _headers = put_mht_in_storage_to_pdf_with_http_info(name, src_path, opts)
2429724273
else
2429824274
raise
2429924275
end
@@ -24304,17 +24280,17 @@ def put_mht_in_storage_to_pdf(name, src_path, height, width, margin_left, margin
2430424280
#
2430524281
# @param name The document name.
2430624282
# @param src_path Full source filename (ex. /folder1/folder2/template.mht)
24307-
# @param height Page height
24308-
# @param width Page width
24309-
# @param margin_left Page margin left
24310-
# @param margin_bottom Page margin bottom
24311-
# @param margin_right Page margin right
24312-
# @param margin_top Page margin top
2431324283
# @param [Hash] opts the optional parameters
24284+
# @option opts [Float] :height Page height
24285+
# @option opts [Float] :width Page width
24286+
# @option opts [Float] :margin_left Page margin left
24287+
# @option opts [Float] :margin_bottom Page margin bottom
24288+
# @option opts [Float] :margin_right Page margin right
24289+
# @option opts [Float] :margin_top Page margin top
2431424290
# @option opts [String] :dst_folder The destination document folder.
2431524291
# @option opts [String] :storage The document storage.
2431624292
# @return [Array<(AsposeResponse, Fixnum, Hash)>] AsposeResponse data, response status code and response headers
24317-
def put_mht_in_storage_to_pdf_with_http_info(name, src_path, height, width, margin_left, margin_bottom, margin_right, margin_top, opts = {})
24293+
def put_mht_in_storage_to_pdf_with_http_info(name, src_path, opts = {})
2431824294
if @api_client.config.debugging
2431924295
@api_client.config.logger.debug "Calling API: PdfApi.put_mht_in_storage_to_pdf ..."
2432024296
end
@@ -24326,42 +24302,18 @@ def put_mht_in_storage_to_pdf_with_http_info(name, src_path, height, width, marg
2432624302
if @api_client.config.client_side_validation && src_path.nil?
2432724303
fail ArgumentError, "Missing the required parameter 'src_path' when calling PdfApi.put_mht_in_storage_to_pdf"
2432824304
end
24329-
# verify the required parameter 'height' is set
24330-
if @api_client.config.client_side_validation && height.nil?
24331-
fail ArgumentError, "Missing the required parameter 'height' when calling PdfApi.put_mht_in_storage_to_pdf"
24332-
end
24333-
# verify the required parameter 'width' is set
24334-
if @api_client.config.client_side_validation && width.nil?
24335-
fail ArgumentError, "Missing the required parameter 'width' when calling PdfApi.put_mht_in_storage_to_pdf"
24336-
end
24337-
# verify the required parameter 'margin_left' is set
24338-
if @api_client.config.client_side_validation && margin_left.nil?
24339-
fail ArgumentError, "Missing the required parameter 'margin_left' when calling PdfApi.put_mht_in_storage_to_pdf"
24340-
end
24341-
# verify the required parameter 'margin_bottom' is set
24342-
if @api_client.config.client_side_validation && margin_bottom.nil?
24343-
fail ArgumentError, "Missing the required parameter 'margin_bottom' when calling PdfApi.put_mht_in_storage_to_pdf"
24344-
end
24345-
# verify the required parameter 'margin_right' is set
24346-
if @api_client.config.client_side_validation && margin_right.nil?
24347-
fail ArgumentError, "Missing the required parameter 'margin_right' when calling PdfApi.put_mht_in_storage_to_pdf"
24348-
end
24349-
# verify the required parameter 'margin_top' is set
24350-
if @api_client.config.client_side_validation && margin_top.nil?
24351-
fail ArgumentError, "Missing the required parameter 'margin_top' when calling PdfApi.put_mht_in_storage_to_pdf"
24352-
end
2435324305
# resource path
2435424306
local_var_path = "/pdf/{name}/create/mht".sub('{' + 'name' + '}', name.to_s)
2435524307

2435624308
# query parameters
2435724309
query_params = {}
2435824310
query_params[:'srcPath'] = src_path
24359-
query_params[:'height'] = height
24360-
query_params[:'width'] = width
24361-
query_params[:'marginLeft'] = margin_left
24362-
query_params[:'marginBottom'] = margin_bottom
24363-
query_params[:'marginRight'] = margin_right
24364-
query_params[:'marginTop'] = margin_top
24311+
query_params[:'height'] = opts[:'height'] if !opts[:'height'].nil?
24312+
query_params[:'width'] = opts[:'width'] if !opts[:'width'].nil?
24313+
query_params[:'marginLeft'] = opts[:'margin_left'] if !opts[:'margin_left'].nil?
24314+
query_params[:'marginBottom'] = opts[:'margin_bottom'] if !opts[:'margin_bottom'].nil?
24315+
query_params[:'marginRight'] = opts[:'margin_right'] if !opts[:'margin_right'].nil?
24316+
query_params[:'marginTop'] = opts[:'margin_top'] if !opts[:'margin_top'].nil?
2436524317
query_params[:'dstFolder'] = opts[:'dst_folder'] if !opts[:'dst_folder'].nil?
2436624318
query_params[:'storage'] = opts[:'storage'] if !opts[:'storage'].nil?
2436724319

test/pdf_tests.rb

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ def setup
4040
@temp_folder = 'TempPdfCloud'
4141
@test_data_folder = 'test_data/'
4242
config = @pdf_api.api_client.config
43-
config.scheme = 'https'
43+
config.scheme = 'http'
4444
end
4545

4646
def teardown
@@ -6755,4 +6755,19 @@ def test_post_xmp_metadata
67556755
assert(response, 'Failed to get xmp metadata in json format')
67566756
assert_equal(9, response[0].properties.count, 'Failed to read document xmp metadata.')
67576757
end
6758+
6759+
def test_post_compare_pdf
6760+
file_name_1 = '4pages.pdf'
6761+
upload_file(file_name_1)
6762+
6763+
file_name_2 = '4pagesPdfA.pdf'
6764+
upload_file(file_name_2)
6765+
6766+
opts = {
6767+
folder: @temp_folder
6768+
}
6769+
6770+
response = @pdf_api.post_compare_pdf(@temp_folder + '/' + file_name_1, @temp_folder + '/' + file_name_2, @temp_folder + '/' + 'output.pdf', opts)
6771+
assert(response, 'Failed to compare a PDF files.')
6772+
end
67586773
end

0 commit comments

Comments
 (0)