asposecloud 1.0.0 → 1.1.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.
Files changed (93) hide show
  1. data/README.md +31 -9
  2. data/Tests/Barcode/builder_tests.rb +95 -0
  3. data/Tests/Barcode/reader_tests.rb +70 -0
  4. data/Tests/Cells/charteditor_tests.rb +139 -0
  5. data/Tests/Cells/converter_tests.rb +83 -0
  6. data/Tests/Cells/extractor_tests.rb +40 -0
  7. data/Tests/Cells/texteditor_tests.rb +52 -0
  8. data/Tests/Cells/workbook_tests.rb +167 -0
  9. data/Tests/Cells/worksheet_tests.rb +435 -0
  10. data/Tests/Data/barcodeQR.bmp +0 -0
  11. data/Tests/Data/barcodeQR.jpg +0 -0
  12. data/Tests/Data/barcodeQR.tiff +0 -0
  13. data/Tests/Data/bizcard.psd +0 -0
  14. data/Tests/Data/macbook.gif +0 -0
  15. data/Tests/Data/mail_merge_regions.docx +0 -0
  16. data/Tests/Data/mail_merge_template.docx +0 -0
  17. data/Tests/Data/test_cells.xlsx +0 -0
  18. data/Tests/Data/test_multi_pages.docx +0 -0
  19. data/Tests/Data/test_slides.pptx +0 -0
  20. data/Tests/Email/converter_tests.rb +30 -0
  21. data/Tests/Email/document_tests.rb +55 -0
  22. data/Tests/Imaging/converter_tests.rb +32 -0
  23. data/Tests/Imaging/document_tests.rb +132 -0
  24. data/Tests/Imaging/extractor_tests.rb +67 -0
  25. data/Tests/Imaging/image_tests.rb +55 -0
  26. data/Tests/Ocr/extractor_tests.rb +34 -0
  27. data/Tests/Pdf/annotationeditor_tests.rb +128 -0
  28. data/Tests/Pdf/converter_tests.rb +74 -0
  29. data/Tests/Pdf/document_tests.rb +285 -0
  30. data/Tests/Pdf/extractor_tests.rb +37 -0
  31. data/Tests/Pdf/texteditor_tests.rb +84 -0
  32. data/Tests/Slides/converter_tests.rb +59 -0
  33. data/Tests/Slides/document_tests.rb +187 -0
  34. data/Tests/Slides/extractor_tests.rb +92 -0
  35. data/Tests/Storage/folder_tests.rb +64 -0
  36. data/Tests/Tasks/assignments_tests.rb +44 -0
  37. data/Tests/Tasks/calendar_tests.rb +45 -0
  38. data/Tests/Tasks/converter_tests.rb +32 -0
  39. data/Tests/Tasks/document_tests.rb +114 -0
  40. data/Tests/Tasks/resources_tests.rb +44 -0
  41. data/Tests/Words/builder_tests.rb +56 -0
  42. data/Tests/Words/converter_tests.rb +54 -0
  43. data/Tests/Words/document_tests.rb +208 -0
  44. data/Tests/Words/extractor_tests.rb +120 -0
  45. data/Tests/Words/mail_merge_tests.rb +120 -0
  46. data/Tests/setup.json +6 -0
  47. data/lib/Barcode/builder.rb +270 -20
  48. data/lib/Barcode/reader.rb +112 -18
  49. data/lib/Cells/chart_editor.rb +102 -0
  50. data/lib/Cells/convertor.rb +22 -2
  51. data/lib/Cells/text_editor.rb +8 -2
  52. data/lib/Cells/workbook.rb +63 -3
  53. data/lib/Cells/worksheet.rb +479 -10
  54. data/lib/Common/utils.rb +2 -0
  55. data/lib/Email/converter.rb +2 -18
  56. data/lib/Email/document.rb +32 -17
  57. data/lib/Ocr/extractor.rb +26 -20
  58. data/lib/Pdf/annotation_editor.rb +0 -17
  59. data/lib/Pdf/converter.rb +25 -17
  60. data/lib/Pdf/document.rb +167 -23
  61. data/lib/Pdf/extractor.rb +0 -17
  62. data/lib/Pdf/text_editor.rb +35 -20
  63. data/lib/Slides/converter.rb +48 -18
  64. data/lib/Slides/document.rb +186 -51
  65. data/lib/Slides/extractor.rb +35 -18
  66. data/lib/Storage/folder.rb +30 -25
  67. data/lib/Words/builder.rb +23 -29
  68. data/lib/Words/converter.rb +30 -17
  69. data/lib/Words/document.rb +336 -28
  70. data/lib/Words/extractor.rb +112 -33
  71. data/lib/Words/mail_merge.rb +2 -20
  72. data/{Tests/word_tests.rb → lib/aspose_imaging.rb} +5 -17
  73. data/lib/asposecloud.rb +3 -1
  74. data/lib/asposecloud/version.rb +1 -1
  75. data/lib/imaging/converter.rb +55 -0
  76. data/lib/imaging/document.rb +301 -0
  77. data/lib/imaging/extractor.rb +165 -0
  78. data/lib/imaging/image.rb +118 -0
  79. data/lib/restclient.rb +36 -0
  80. data/lib/tasks/assignments.rb +19 -19
  81. data/lib/tasks/calendar.rb +27 -19
  82. data/lib/tasks/converter.rb +4 -17
  83. data/lib/tasks/document.rb +79 -22
  84. data/lib/tasks/resources.rb +18 -18
  85. metadata +70 -19
  86. checksums.yaml +0 -7
  87. data/Tests/barcode_tests.rb +0 -45
  88. data/Tests/cell_tests.rb +0 -41
  89. data/Tests/email_tests.rb +0 -43
  90. data/Tests/pdf_tests.rb +0 -76
  91. data/Tests/slide_tests.rb +0 -41
  92. data/Tests/storage_tests.rb +0 -86
  93. data/Tests/tasks_tests.rb +0 -24
@@ -1,20 +1,3 @@
1
- # Copyright (c) Aspose 2002-2014. All Rights Reserved.
2
- #
3
- # LICENSE: This program is free software; you can redistribute it and/or
4
- # modify it under the terms of the GNU General Public License
5
- # as published by the Free Software Foundation; either version 3
6
- # of the License, or (at your option) any later version.
7
- # This program is distributed in the hope that it will be useful,
8
- # but WITHOUT ANY WARRANTY; without even the implied warranty of
9
- # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
10
- # GNU General Public License for more details.
11
- # You should have received a copy of the GNU General Public License
12
- # along with this program. If not, see <http://opensource.org/licenses/gpl-3.0.html>;.
13
- #
14
- # @package Aspose_Cloud_SDK_For_Ruby
15
- # @author Assad Mahmood Qazi <assad.mahmood@aspose.com>
16
- # @link https://github.com/asposeforcloud/Aspose_Cloud_SDK_For_Ruby/tree/revamp
17
-
18
1
  module Aspose
19
2
  module Cloud
20
3
  module Slides
@@ -56,7 +39,7 @@ module Aspose
56
39
  str_uri = "#{@base_uri}/slides/#{slide_number}/shapes"
57
40
  str_uri = Aspose::Cloud::Common::Utils.append_storage(str_uri,folder_name,storage_name,storage_type)
58
41
  signed_str_uri = Aspose::Cloud::Common::Utils.sign(str_uri)
59
- shapes = Hash.new
42
+ shapes = Array.new
60
43
  JSON.parse(RestClient.get(signed_str_uri, {:accept=>'application/json'}))['ShapeList']['ShapesLinks'].each { |item|
61
44
  signed_str_uri = Aspose::Cloud::Common::Utils.sign(item['Uri']['Href'])
62
45
  shapes.push(JSON.parse(RestClient.get(signed_str_uri, {:accept=>'application/json'})))
@@ -64,6 +47,24 @@ module Aspose
64
47
  shapes
65
48
  end
66
49
 
50
+ =begin
51
+ Get a Particular Shape from the Slide
52
+ @param number slide_number
53
+ @param number shape_index
54
+ =end
55
+ def get_shape(slide_number, shape_index, folder_name = '', storage_type = 'Aspose', storage_name = '')
56
+ raise 'slide_number not specified.' if slide_number <= 0
57
+ raise 'shape_index not specified.' if shape_index.nil?
58
+
59
+ str_uri = "#{@base_uri}/slides/#{slide_number}/shapes/#{shape_index}"
60
+ str_uri = Aspose::Cloud::Common::Utils.append_storage(str_uri,folder_name,storage_name,storage_type)
61
+ signed_str_uri = Aspose::Cloud::Common::Utils.sign(str_uri)
62
+
63
+ response = RestClient.get(signed_str_uri, {:accept=>'application/json'})
64
+ json = JSON.parse(response)
65
+ json['Code'] == 200 ? json['Shape'] : nil
66
+ end
67
+
67
68
  =begin
68
69
  Get color scheme from the specified slide
69
70
  @param number slide_number
@@ -129,6 +130,22 @@ module Aspose
129
130
  signed_str_uri = Aspose::Cloud::Common::Utils.sign(str_uri)
130
131
  JSON.parse(RestClient.get(signed_str_uri, {:accept=>'application/json'}))['Placeholder']
131
132
  end
133
+
134
+ =begin
135
+ Get Comments of a PowerPoint Slide
136
+ @param number slide_number
137
+ =end
138
+ def get_comments(slide_number, folder_name = '', storage_type = 'Aspose', storage_name = '')
139
+ raise 'slide_number not specified.' if slide_number <= 0
140
+
141
+ str_uri = "#{@base_uri}/slides/#{slide_number}/comments"
142
+ str_uri = Aspose::Cloud::Common::Utils.append_storage(str_uri,folder_name,storage_name,storage_type)
143
+ signed_str_uri = Aspose::Cloud::Common::Utils.sign(str_uri)
144
+
145
+ response = RestClient.get(signed_str_uri, {:accept=>'application/json'})
146
+ json = JSON.parse(response)
147
+ json['Code'] == 200 ? json['SlideComments'] : nil
148
+ end
132
149
  end
133
150
  end
134
151
  end
@@ -1,20 +1,3 @@
1
- # Copyright (c) Aspose 2002-2014. All Rights Reserved.
2
- #
3
- # LICENSE: This program is free software; you can redistribute it and/or
4
- # modify it under the terms of the GNU General Public License
5
- # as published by the Free Software Foundation; either version 3
6
- # of the License, or (at your option) any later version.
7
- # This program is distributed in the hope that it will be useful,
8
- # but WITHOUT ANY WARRANTY; without even the implied warranty of
9
- # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
10
- # GNU General Public License for more details.
11
- # You should have received a copy of the GNU General Public License
12
- # along with this program. If not, see <http://opensource.org/licenses/gpl-3.0.html>;.
13
- #
14
- # @package Aspose_Cloud_SDK_For_Ruby
15
- # @author Assad Mahmood Qazi <assad.mahmood@aspose.com>
16
- # @link https://github.com/asposeforcloud/Aspose_Cloud_SDK_For_Ruby/tree/revamp
17
-
18
1
  module Aspose
19
2
  module Cloud
20
3
  module AsposeStorage
@@ -28,9 +11,10 @@ module Aspose
28
11
  @str_uri_disc = Aspose::Cloud::Common::Product.product_uri + '/storage/disc/'
29
12
  end
30
13
 
31
- # Uploads file from the local path to the remote folder.
32
- # * :localFilePath represents full local file path and name
33
- # * :remoteFolderPath represents remote folder relative to the root. Pass empty string for the root folder.
14
+ =begin
15
+ Uploads file from the local path to the remote folder
16
+ @param string localFilePath represents full local file path and name.
17
+ =end
34
18
  def upload_file(local_file, remote_folder='', storage_type='Aspose', storage_name='')
35
19
  raise 'Local file not specified' if local_file.empty?
36
20
 
@@ -43,9 +27,9 @@ module Aspose
43
27
  response['Status'].eql? 'OK'
44
28
  end
45
29
 
46
-
47
- # Retrieves Files and Folder information from a remote folder. The method returns an Array of AppFile objects.
48
- # * :remoteFolderPath represents remote folder relative to the root. Pass empty string for the root folder.
30
+ =begin
31
+ Retrieves Files and Folder information from a remote folder
32
+ =end
49
33
  def get_files(remote_folder_path='', storage_type='Aspose', storage_name='')
50
34
  str_uri = @str_uri_folder + remote_folder_path
51
35
  str_uri = str_uri[0..-2] if str_uri[-1].eql? '/'
@@ -57,7 +41,10 @@ module Aspose
57
41
  JSON.parse(response)['Files']
58
42
  end
59
43
 
60
- # check if a file exists on the storage
44
+ =begin
45
+ Check if a file exists on the storage
46
+ @param string filename Name of the file.
47
+ =end
61
48
  def file_exists(filename, storage_type = 'Aspose', storage_name = '')
62
49
  raise('Filename cannot be empty') if filename.empty?
63
50
 
@@ -70,6 +57,10 @@ module Aspose
70
57
  JSON.parse(response_stream)['FileExist']['IsExist']
71
58
  end
72
59
 
60
+ =begin
61
+ Delete a Particular File
62
+ @param string filename Name of the file.
63
+ =end
73
64
  def delete_file(filename, storage_type = 'Aspose', storage_name = '')
74
65
  raise 'File name cannot be empty' if filename.empty?
75
66
 
@@ -82,6 +73,10 @@ module Aspose
82
73
  JSON.parse(response_stream)['Code'].eql? 200
83
74
  end
84
75
 
76
+ =begin
77
+ Create a New Folder
78
+ @param string folder_name Name of the folder.
79
+ =end
85
80
  def create_folder (folder_name, storage_type = 'Aspose', storage_name='')
86
81
  raise 'Folder name cannot be empty' if folder_name.empty?
87
82
  str_uri = @str_uri_folder + folder_name
@@ -92,6 +87,10 @@ module Aspose
92
87
  JSON.parse(response)['Code'].eql? 200
93
88
  end
94
89
 
90
+ =begin
91
+ Delete a Particular Folder
92
+ @param string folder_name Name of the folder.
93
+ =end
95
94
  def delete_folder (folder_name, storage_type = 'Aspose', storage_name='')
96
95
  raise 'Folder name cannot be empty' if folder_name.empty?
97
96
  str_uri = @str_uri_folder + folder_name
@@ -102,6 +101,9 @@ module Aspose
102
101
  JSON.parse(response)['Code'].eql? 200
103
102
  end
104
103
 
104
+ =begin
105
+ Get Disk Usage
106
+ =end
105
107
  def get_disc_usage (storage_type = 'Aspose', storage_name = '')
106
108
  str_uri = @str_uri_disc
107
109
  str_uri = Aspose::Cloud::Common::Utils.append_storage(str_uri,'',storage_name,storage_type)
@@ -111,7 +113,10 @@ module Aspose
111
113
  JSON.parse(response)['DiscUsage']
112
114
  end
113
115
 
114
- # Get file from storage
116
+ =begin
117
+ Get file from storage
118
+ @param string file_name Name of the file.
119
+ =end
115
120
  def get_file (file_name, storage_type = 'Aspose', storage_name = '')
116
121
  raise 'Filename cannot be empty' if file_name.empty?
117
122
 
@@ -1,20 +1,3 @@
1
- # Copyright (c) Aspose 2002-2014. All Rights Reserved.
2
- #
3
- # LICENSE: This program is free software; you can redistribute it and/or
4
- # modify it under the terms of the GNU General Public License
5
- # as published by the Free Software Foundation; either version 3
6
- # of the License, or (at your option) any later version.
7
- # This program is distributed in the hope that it will be useful,
8
- # but WITHOUT ANY WARRANTY; without even the implied warranty of
9
- # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
10
- # GNU General Public License for more details.
11
- # You should have received a copy of the GNU General Public License
12
- # along with this program. If not, see <http://opensource.org/licenses/gpl-3.0.html>;.
13
- #
14
- # @package Aspose_Cloud_SDK_For_Ruby
15
- # @author Assad Mahmood Qazi <assad.mahmood@aspose.com>
16
- # @link https://github.com/asposeforcloud/Aspose_Cloud_SDK_For_Ruby/tree/revamp
17
-
18
1
  module Aspose
19
2
  module Cloud
20
3
  module Words
@@ -26,9 +9,9 @@ module Aspose
26
9
  end
27
10
 
28
11
  =begin
29
- Inserts water mark text into the document.
30
- @param string text
31
- @param string rotation_angle
12
+ Inserts water mark text into the document.
13
+ @param string text Watermark text.
14
+ @param string rotation_angle Watermark angle.
32
15
  =end
33
16
  def insert_watermark_text(text, rotation_angle, folder_name = '', storage_type = 'Aspose', storage_name = '')
34
17
  raise 'text not specified.' if text.empty?
@@ -43,15 +26,15 @@ module Aspose
43
26
  end
44
27
 
45
28
  =begin
46
- Inserts water mark image into the document.
47
- @param string image_file
48
- @param string rotation_angle
29
+ Inserts water mark image into the document.
30
+ @param string image_file Name of the watermark image.
31
+ @param string rotation_angle Watermark angle.
49
32
  =end
50
33
  def insert_watermark_image(image_file, rotation_angle, folder_name = '', storage_type = 'Aspose', storage_name = '')
51
34
  raise 'image_file not specified.' if image_file.empty?
52
35
  raise 'rotation_angle not specified.' if rotation_angle.nil?
53
36
 
54
- str_uri = "#{@base_uri}/insertWatermarkImage?imageFile=#{image_file}&rotationAngle=#{rotation_angle}"
37
+ str_uri = "#{@base_uri}/watermark/insertImage?image=#{image_file}&rotationAngle=#{rotation_angle}"
55
38
  signed_str_uri = Aspose::Cloud::Common::Utils.sign(str_uri)
56
39
  response_stream = RestClient.post(signed_str_uri, '', {:content_type => :json, :accept => 'application/json'})
57
40
  valid_output = Aspose::Cloud::Common::Utils.validate_output(response_stream)
@@ -59,11 +42,22 @@ module Aspose
59
42
  end
60
43
 
61
44
  =begin
62
- Replace a text with the new value in the document
63
- @param string old_value
64
- @param string new_value
65
- @param string is_match_case
66
- @param string is_match_whole_word
45
+ Remove Watermark from a Word Document
46
+ =end
47
+ def remove_watermark(folder_name = '', storage_type = 'Aspose', storage_name = '')
48
+ str_uri = "#{@base_uri}/watermark"
49
+ signed_str_uri = Aspose::Cloud::Common::Utils.sign(str_uri)
50
+ response_stream = RestClient.delete(signed_str_uri, {:content_type => :json, :accept => 'application/json'})
51
+ valid_output = Aspose::Cloud::Common::Utils.validate_output(response_stream)
52
+ valid_output.empty? ? Aspose::Cloud::Common::Utils.download_file(@filename,@filename,folder_name,storage_name,storage_type) : valid_output
53
+ end
54
+
55
+ =begin
56
+ Replace a text with the new value in the document
57
+ @param string old_value Old text.
58
+ @param string new_value New text.
59
+ @param boolean is_match_case
60
+ @param boolean is_match_whole_word
67
61
  =end
68
62
  def replace_text(old_text, new_text, is_match_case = false, is_match_whole_word = false, folder_name = '', storage_type = 'Aspose', storage_name = '')
69
63
  raise 'old_text not specified.' if old_text.empty?
@@ -1,20 +1,3 @@
1
- # Copyright (c) Aspose 2002-2014. All Rights Reserved.
2
- #
3
- # LICENSE: This program is free software; you can redistribute it and/or
4
- # modify it under the terms of the GNU General Public License
5
- # as published by the Free Software Foundation; either version 3
6
- # of the License, or (at your option) any later version.
7
- # This program is distributed in the hope that it will be useful,
8
- # but WITHOUT ANY WARRANTY; without even the implied warranty of
9
- # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
10
- # GNU General Public License for more details.
11
- # You should have received a copy of the GNU General Public License
12
- # along with this program. If not, see <http://opensource.org/licenses/gpl-3.0.html>;.
13
- #
14
- # @package Aspose_Cloud_SDK_For_Ruby
15
- # @author Assad Mahmood Qazi <assad.mahmood@aspose.com>
16
- # @link https://github.com/asposeforcloud/Aspose_Cloud_SDK_For_Ruby/tree/revamp
17
-
18
1
  module Aspose
19
2
  module Cloud
20
3
  module Words
@@ -25,6 +8,10 @@ module Aspose
25
8
  @base_uri = Aspose::Cloud::Common::Product.product_uri + '/words/' + @filename
26
9
  end
27
10
 
11
+ =begin
12
+ Convert Word to Images, Multipage TIFF, HTML, PDF and other File Format using Cloud Storage
13
+ @param string save_format Return file format.
14
+ =end
28
15
  def convert(save_format, folder_name = '', storage_type = 'Aspose', storage_name = '')
29
16
  raise 'save_format not specified.' if save_format.empty?
30
17
 
@@ -43,6 +30,12 @@ module Aspose
43
30
  end
44
31
  end
45
32
 
33
+ =begin
34
+ Convert Word to other File Formats without using the Cloud Storage
35
+ @param string input_file_path Path of the input file.
36
+ @param string output_filename Name of the return file.
37
+ @param string save_format Return file format.
38
+ =end
46
39
  def convert_local_file(input_file_path, output_filename, save_format)
47
40
  raise 'input_file_path not specified.' if input_file_path.empty?
48
41
  raise 'output_filename not specified.' if output_filename.empty?
@@ -61,6 +54,26 @@ module Aspose
61
54
  end
62
55
  valid_output
63
56
  end
57
+
58
+ =begin
59
+ Convert web pages to Word Documents
60
+ @param xml str_xml Provide xml data.
61
+ =end
62
+ def convert_web_pages(str_xml, folder_name = '', storage_type = 'Aspose', storage_name = '')
63
+ raise 'str_xml not specified.' if str_xml.empty?
64
+
65
+ str_uri = "#{Aspose::Cloud::Common::Product.product_uri}/words/loadWebDocument"
66
+ str_uri = Aspose::Cloud::Common::Utils.append_storage(str_uri,folder_name,storage_name,storage_type)
67
+ signed_str_uri = Aspose::Cloud::Common::Utils.sign(str_uri)
68
+
69
+ response = Aspose::Cloud::Common::Utils.process_command(signed_str_uri,'POST','XML',str_xml)
70
+ json = JSON.parse(response)
71
+
72
+ if json['Code'] == 200
73
+ filename = json['SaveResult']['DestDocument']['Href']
74
+ Aspose::Cloud::Common::Utils.download_file(filename,filename,folder_name,storage_name,storage_type)
75
+ end
76
+ end
64
77
  end
65
78
  end
66
79
  end
@@ -1,20 +1,3 @@
1
- # Copyright (c) Aspose 2002-2014. All Rights Reserved.
2
- #
3
- # LICENSE: This program is free software; you can redistribute it and/or
4
- # modify it under the terms of the GNU General Public License
5
- # as published by the Free Software Foundation; either version 3
6
- # of the License, or (at your option) any later version.
7
- # This program is distributed in the hope that it will be useful,
8
- # but WITHOUT ANY WARRANTY; without even the implied warranty of
9
- # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
10
- # GNU General Public License for more details.
11
- # You should have received a copy of the GNU General Public License
12
- # along with this program. If not, see <http://opensource.org/licenses/gpl-3.0.html>;.
13
- #
14
- # @package Aspose_Cloud_SDK_For_Ruby
15
- # @author Assad Mahmood Qazi <assad.mahmood@aspose.com>
16
- # @link https://github.com/asposeforcloud/Aspose_Cloud_SDK_For_Ruby/tree/revamp
17
-
18
1
  module Aspose
19
2
  module Cloud
20
3
  module Words
@@ -25,11 +8,79 @@ module Aspose
25
8
  @base_uri = "#{Aspose::Cloud::Common::Product.product_uri}/words/#{@filename}"
26
9
  end
27
10
 
11
+ =begin
12
+ Convert Word Documents to any Format with Additional Settings
13
+ @param xml options_xml Provide options in xml format.
14
+ =end
15
+ def save_as(options_xml, folder_name = '', storage_type = 'Aspose', storage_name = '')
16
+ raise 'options not specified.' if options_xml.empty?
17
+
18
+ str_uri = "#{@base_uri}/saveAs"
19
+ str_uri = Aspose::Cloud::Common::Utils.append_storage(str_uri, folder_name, storage_name, storage_type)
20
+ signed_str_uri = Aspose::Cloud::Common::Utils.sign(str_uri)
21
+ response_stream = RestClient.post(signed_str_uri, options_xml, {:content_type=>'application/xml', :accept=>'application/json'})
22
+ valid_output = Aspose::Cloud::Common::Utils.validate_output(response_stream)
23
+
24
+ return valid_output unless valid_output.empty?
25
+
26
+ json_response = JSON.parse(response_stream)
27
+ Aspose::Cloud::Common::Utils.download_file(json_response['SaveResult']['DestDocument']['Href'],
28
+ json_response['SaveResult']['DestDocument']['Href'],
29
+ folder_name,storage_name,storage_type)
30
+ end
31
+
32
+ =begin
33
+ Split pages to new format
34
+ @param number from The start page number for splitting.
35
+ @param number to The last page number for splitting.
36
+ @param string save_format Return file format.
37
+ =end
38
+ def split_document(from='', to='', save_format='pdf', folder_name = '', storage_type = 'Aspose', storage_name = '')
39
+ str_uri = "#{@base_uri}/split"
40
+ qry = Hash.new
41
+ qry[:from] = from
42
+ qry[:to] = to
43
+ qry[:format] = save_format
44
+
45
+ str_uri = Aspose::Cloud::Common::Utils.build_uri(str_uri, qry)
46
+ str_uri = Aspose::Cloud::Common::Utils.append_storage(str_uri,folder_name,storage_name,storage_type)
47
+ signed_str_uri = Aspose::Cloud::Common::Utils.sign(str_uri)
48
+
49
+ JSON.parse(RestClient.post(signed_str_uri, nil, {:content_type=>:json, :accept=>'application/json'}))['SplitResult']
50
+ end
51
+
52
+ =begin
53
+ Extract Page Setup Information from a Word Document
54
+ @param number section_index Index of the section.
55
+ =end
56
+ def get_page_setup(section_index, folder_name = '', storage_type = 'Aspose', storage_name = '')
57
+ raise 'section_index not specified.' if section_index.nil?
58
+
59
+ str_uri = "#{@base_uri}/sections/#{section_index}/pageSetup"
60
+ str_uri = Aspose::Cloud::Common::Utils.append_storage(str_uri,folder_name,storage_name,storage_type)
61
+ signed_str_uri = Aspose::Cloud::Common::Utils.sign(str_uri)
62
+ JSON.parse(RestClient.get(signed_str_uri, {:accept=>'application/json'}))['PageSetup']
63
+ end
64
+
65
+ =begin
66
+ Update Page Setup of a Section in a Word Document
67
+ @param number section_index Index of the section.
68
+ @param xml options_xml Options to update.
69
+ =end
70
+ def update_page_setup(section_index, options_xml, folder_name = '', storage_type = 'Aspose', storage_name = '')
71
+ raise 'section_index not specified.' if section_index.nil?
72
+ raise 'options_xml not specified.' if options_xml.empty?
73
+
74
+ str_uri = "#{@base_uri}/sections/#{section_index}/pageSetup"
75
+ str_uri = Aspose::Cloud::Common::Utils.append_storage(str_uri,folder_name,storage_name,storage_type)
76
+ signed_str_uri = Aspose::Cloud::Common::Utils.sign(str_uri)
77
+ JSON.parse(RestClient.post(signed_str_uri, options_xml, {:content_type=>'application/xml', :accept=>'application/json'}))['PageSetup']
78
+ end
79
+
28
80
  =begin
29
81
  Appends a list of documents to this one.
30
- @param string append_docs
31
- @param import_format_modes
32
- @param source_folder
82
+ @param string append_docs Name of the file.
83
+ @param import_format_modes Specify formatting modes.
33
84
  =end
34
85
  def append_document(append_docs, import_format_modes, folder_name = '', storage_type = 'Aspose', storage_name = '')
35
86
  raise 'append_docs not specified.' if append_docs.empty?
@@ -50,7 +101,7 @@ module Aspose
50
101
  end
51
102
 
52
103
  =begin
53
- Get Resource Properties information like document source format, IsEncrypted, IsSigned and document properties
104
+ Get Resource Properties information like document source format, IsEncrypted, IsSigned and document properties
54
105
  =end
55
106
 
56
107
  def get_document_info(folder_name = '', storage_type = 'Aspose', storage_name = '')
@@ -61,7 +112,7 @@ module Aspose
61
112
 
62
113
  =begin
63
114
  Get Resource Properties information like document source format, IsEncrypted, IsSigned and document properties
64
- @param string property_name
115
+ @param string property_name Name of the property.
65
116
  =end
66
117
  def get_property(property_name, folder_name = '', storage_type = 'Aspose', storage_name = '')
67
118
  raise 'property_name not specified.' if property_name.empty?
@@ -74,8 +125,8 @@ module Aspose
74
125
 
75
126
  =begin
76
127
  Set document property
77
- @param string property_name
78
- @param string property_value
128
+ @param string property_name Name of the property.
129
+ @param string property_value Value of the property.
79
130
  =end
80
131
  def set_property(property_name, property_value, folder_name = '', storage_type = 'Aspose', storage_name = '')
81
132
  raise 'property_name not specified.' if property_name.empty?
@@ -90,8 +141,8 @@ module Aspose
90
141
  end
91
142
 
92
143
  =begin
93
- Delete a document property
94
- @param string property_name
144
+ Delete a document property
145
+ @param string property_name Name of the property.
95
146
  =end
96
147
  def delete_property(property_name, folder_name = '', storage_type = 'Aspose', storage_name = '')
97
148
  raise 'property_name not specified.' if property_name.empty?
@@ -103,7 +154,7 @@ module Aspose
103
154
  end
104
155
 
105
156
  =begin
106
- Get Document's properties
157
+ Get Document's properties
107
158
  =end
108
159
  def get_properties(folder_name = '', storage_type = 'Aspose', storage_name = '')
109
160
  str_uri = "#{@base_uri}/documentProperties"
@@ -111,7 +162,264 @@ module Aspose
111
162
  signed_str_uri = Aspose::Cloud::Common::Utils.sign(str_uri)
112
163
  JSON.parse(RestClient.get(signed_str_uri, {:accept=>'application/json'}))['DocumentProperties']['List']
113
164
  end
165
+
166
+ =begin
167
+ Get the Current Protection of the Word document
168
+ =end
169
+ def get_protection(folder_name = '', storage_type = 'Aspose', storage_name = '')
170
+ str_uri = "#{@base_uri}/protection"
171
+ str_uri = Aspose::Cloud::Common::Utils.append_storage(str_uri,folder_name,storage_name,storage_type)
172
+ signed_str_uri = Aspose::Cloud::Common::Utils.sign(str_uri)
173
+ JSON.parse(RestClient.get(signed_str_uri, {:accept=>'application/json'}))['ProtectionData']['ProtectionType']
174
+ end
175
+
176
+ =begin
177
+ Protect a Word Document
178
+ @param string password Document protection password.
179
+ @param string protection_type Document protection type.
180
+ =end
181
+ def protect_document(password, protection_type = 'AllowOnlyComments', folder_name = '', storage_type = 'Aspose', storage_name = '')
182
+ raise 'password not specified.' if password.empty?
183
+
184
+ str_uri = "#{@base_uri}/protection"
185
+ str_uri = Aspose::Cloud::Common::Utils.append_storage(str_uri,'',storage_name,storage_type)
186
+ signed_str_uri = Aspose::Cloud::Common::Utils.sign(str_uri)
187
+
188
+ data = Hash['Password' => password, 'ProtectionType' => protection_type]
189
+ json_data = JSON.generate(data)
190
+
191
+ response_stream = RestClient.put(signed_str_uri, json_data, {:content_type=>:json, :accept=>'application/json'})
192
+ valid_output = Aspose::Cloud::Common::Utils.validate_output(response_stream)
193
+ valid_output.empty? ? Aspose::Cloud::Common::Utils.download_file(@filename,@filename,folder_name,storage_name,storage_type) : valid_output
194
+ end
195
+
196
+ =begin
197
+ Unprotect a Word Document
198
+ @param string password Document protection password.
199
+ @param string protection_type Document protection type.
200
+ =end
201
+ def unprotect_document(password, protection_type, folder_name = '', storage_type = 'Aspose', storage_name = '')
202
+ raise 'password not specified.' if password.empty?
203
+ raise 'protection_type not specified.' if protection_type.empty?
204
+
205
+ str_uri = "#{@base_uri}/protection"
206
+ str_uri = Aspose::Cloud::Common::Utils.append_storage(str_uri,'',storage_name,storage_type)
207
+ signed_str_uri = Aspose::Cloud::Common::Utils.sign(str_uri)
208
+
209
+ data = Hash['Password' => password, 'ProtectionType' => protection_type]
210
+ json_data = JSON.generate(data)
211
+
212
+ #response_stream = RestClient.put(signed_str_uri, json_data, {:content_type=>:json, :accept=>'application/json'})
213
+ response_stream = Aspose::Cloud::Common::Utils.process_command(signed_str_uri,'DELETE','JSON',json_data)
214
+ valid_output = Aspose::Cloud::Common::Utils.validate_output(response_stream)
215
+ valid_output.empty? ? Aspose::Cloud::Common::Utils.download_file(@filename,@filename,folder_name,storage_name,storage_type) : valid_output
216
+ end
217
+
218
+ =begin
219
+ Modify Protection of the Word Document
220
+ @param string old_password Current document protection password.
221
+ @param string new_password New document protection password.
222
+ @param string protection_type Document protection type.
223
+ =end
224
+ def update_protection(old_password, new_password, protection_type = 'AllowOnlyComments', folder_name = '', storage_type = 'Aspose', storage_name = '')
225
+ raise 'old_password not specified.' if old_password.empty?
226
+ raise 'new_password not specified.' if new_password.empty?
227
+
228
+ str_uri = "#{@base_uri}/protection"
229
+ str_uri = Aspose::Cloud::Common::Utils.append_storage(str_uri,'',storage_name,storage_type)
230
+ signed_str_uri = Aspose::Cloud::Common::Utils.sign(str_uri)
231
+
232
+ data = Hash['Password' => old_password, 'NewPassword' => new_password, 'ProtectionType' => protection_type]
233
+ json_data = JSON.generate(data)
234
+
235
+ response_stream = RestClient.post(signed_str_uri, json_data, {:content_type=>:json, :accept=>'application/json'})
236
+ valid_output = Aspose::Cloud::Common::Utils.validate_output(response_stream)
237
+ valid_output.empty? ? Aspose::Cloud::Common::Utils.download_file(@filename,@filename,folder_name,storage_name,storage_type) : valid_output
238
+ end
239
+
240
+ =begin
241
+ Get all Hyperlinks from a Word
242
+ =end
243
+ def get_hyperlinks(folder_name = '', storage_type = 'Aspose', storage_name = '')
244
+ str_uri = "#{@base_uri}/hyperlinks"
245
+ str_uri = Aspose::Cloud::Common::Utils.append_storage(str_uri,folder_name,storage_name,storage_type)
246
+ signed_str_uri = Aspose::Cloud::Common::Utils.sign(str_uri)
247
+ JSON.parse(RestClient.get(signed_str_uri, {:accept=>'application/json'}))['Hyperlinks']['HyperlinkList']
248
+ end
249
+
250
+ =begin
251
+ Get a Particular Hyperlink from a Word
252
+ @param number hyperlink_index Index of the hyperlink.
253
+ =end
254
+ def get_hyperlink(hyperlink_index, folder_name = '', storage_type = 'Aspose', storage_name = '')
255
+ raise 'Hyperlink index not provided.' if hyperlink_index.nil?
256
+
257
+ str_uri = "#{@base_uri}/hyperlinks/#{hyperlink_index}"
258
+ str_uri = Aspose::Cloud::Common::Utils.append_storage(str_uri,folder_name,storage_name,storage_type)
259
+ signed_str_uri = Aspose::Cloud::Common::Utils.sign(str_uri)
260
+ JSON.parse(RestClient.get(signed_str_uri, {:accept=>'application/json'}))['Hyperlink']
261
+ end
262
+
263
+ =begin
264
+ Get Hyperlinks Count from a Word
265
+ =end
266
+ def get_hyperlinks_count(folder_name = '', storage_type = 'Aspose', storage_name = '')
267
+ str_uri = "#{@base_uri}/hyperlinks"
268
+ str_uri = Aspose::Cloud::Common::Utils.append_storage(str_uri,folder_name,storage_name,storage_type)
269
+ signed_str_uri = Aspose::Cloud::Common::Utils.sign(str_uri)
270
+ response = RestClient.get(signed_str_uri, {:accept=>'application/json'})
271
+ json = JSON.parse(response)
272
+ json['Code'] == 200 ? json['Hyperlinks']['HyperlinkList'].count : nil
273
+ end
274
+
275
+ =begin
276
+ Get all Bookmarks from a Word
277
+ =end
278
+ def get_bookmarks(folder_name = '', storage_type = 'Aspose', storage_name = '')
279
+ str_uri = "#{@base_uri}/bookmarks"
280
+ str_uri = Aspose::Cloud::Common::Utils.append_storage(str_uri,folder_name,storage_name,storage_type)
281
+ signed_str_uri = Aspose::Cloud::Common::Utils.sign(str_uri)
282
+ JSON.parse(RestClient.get(signed_str_uri, {:accept=>'application/json'}))['Bookmarks']['BookmarkList']
283
+ end
284
+
285
+ =begin
286
+ Get a Particular Bookmark from a Word
287
+ @param string bookmark_name Name of the bookmark.
288
+ =end
289
+ def get_bookmark(bookmark_name, folder_name = '', storage_type = 'Aspose', storage_name = '')
290
+ raise 'Bookmark name not specified.' if bookmark_name.empty?
291
+
292
+ str_uri = "#{@base_uri}/bookmarks/#{bookmark_name}"
293
+ str_uri = Aspose::Cloud::Common::Utils.append_storage(str_uri,folder_name,storage_name,storage_type)
294
+ signed_str_uri = Aspose::Cloud::Common::Utils.sign(str_uri)
295
+ JSON.parse(RestClient.get(signed_str_uri, {:accept=>'application/json'}))['Bookmark']
296
+ end
297
+
298
+ =begin
299
+ Get Bookmarks Count from a Word
300
+ =end
301
+ def get_bookmarks_count(folder_name = '', storage_type = 'Aspose', storage_name = '')
302
+ str_uri = "#{@base_uri}/bookmarks"
303
+ str_uri = Aspose::Cloud::Common::Utils.append_storage(str_uri,folder_name,storage_name,storage_type)
304
+ signed_str_uri = Aspose::Cloud::Common::Utils.sign(str_uri)
305
+ response = RestClient.get(signed_str_uri, {:accept=>'application/json'})
306
+ json = JSON.parse(response)
307
+ json['Code'] == 200 ? json['Bookmarks']['BookmarkList'].count : nil
308
+ end
309
+
310
+ =begin
311
+ Update Bookmark Text of a Word
312
+ @param string bookmark_name Name of the bookmark.
313
+ @param string bookmark_text New text of the bookmark.
314
+ =end
315
+ def update_bookmark(bookmark_name, bookmark_text, folder_name = '', storage_type = 'Aspose', storage_name = '')
316
+ raise 'bookmark_name not specified.' if bookmark_name.empty?
317
+ raise 'bookmark_text not specified.' if bookmark_text.empty?
318
+
319
+ str_uri = "#{@base_uri}/bookmarks/#{bookmark_name}"
320
+ str_uri = Aspose::Cloud::Common::Utils.append_storage(str_uri,folder_name,storage_name,storage_type)
321
+ signed_str_uri = Aspose::Cloud::Common::Utils.sign(str_uri)
322
+
323
+ json_data = JSON.generate({ "Text" => "#{bookmark_text}" })
324
+
325
+ response = Aspose::Cloud::Common::Utils.process_command(signed_str_uri,'POST','JSON',json_data)
326
+ json = JSON.parse(response)
327
+ json['Code'] == 200 ? json['Bookmark'] : nil
328
+ end
329
+
330
+ =begin
331
+ Remove all Headers and Footers
332
+ =end
333
+ def delete_headers_footers(folder_name = '', storage_type = 'Aspose', storage_name = '')
334
+ str_uri = "#{@base_uri}/headersFooters"
335
+ str_uri = Aspose::Cloud::Common::Utils.append_storage(str_uri,folder_name,storage_name,storage_type)
336
+ signed_str_uri = Aspose::Cloud::Common::Utils.sign(str_uri)
337
+ JSON.parse(RestClient.delete(signed_str_uri, {:accept=>'application/json'}))['Code'] == 200 ? true : false
338
+ end
339
+
340
+ =begin
341
+ Accept All Tracking Changes in the Document
342
+ =end
343
+ def accept_tracking_changes(folder_name = '', storage_type = 'Aspose', storage_name = '')
344
+ str_uri = "#{@base_uri}/revisions/acceptAll"
345
+ str_uri = Aspose::Cloud::Common::Utils.append_storage(str_uri,'',storage_name,storage_type)
346
+ signed_str_uri = Aspose::Cloud::Common::Utils.sign(str_uri)
347
+
348
+ response_stream = RestClient.post(signed_str_uri, {:content_type=>:json, :accept=>'application/json'})
349
+ valid_output = Aspose::Cloud::Common::Utils.validate_output(response_stream)
350
+ valid_output.empty? ? Aspose::Cloud::Common::Utils.download_file(@filename,@filename,folder_name,storage_name,storage_type) : valid_output
351
+ end
352
+
353
+ =begin
354
+ Reject All Tracking Changes in the Document
355
+ =end
356
+ def reject_tracking_changes(folder_name = '', storage_type = 'Aspose', storage_name = '')
357
+ str_uri = "#{@base_uri}/revisions/rejectAll"
358
+ str_uri = Aspose::Cloud::Common::Utils.append_storage(str_uri,'',storage_name,storage_type)
359
+ signed_str_uri = Aspose::Cloud::Common::Utils.sign(str_uri)
360
+
361
+ response_stream = RestClient.post(signed_str_uri, {:content_type=>:json, :accept=>'application/json'})
362
+ valid_output = Aspose::Cloud::Common::Utils.validate_output(response_stream)
363
+ valid_output.empty? ? Aspose::Cloud::Common::Utils.download_file(@filename,@filename,folder_name,storage_name,storage_type) : valid_output
364
+ end
365
+
366
+ =begin
367
+ Insert Page Number Field into the Document
368
+ @param string alignment Alignment of page number.
369
+ @param string format Specify format.
370
+ @param boolean is_top
371
+ @param boolean set_page_number_on_first_page
372
+ =end
373
+ def insert_page_number(alignment, format, is_top = false, set_page_number_on_first_page = false, folder_name = '', storage_type = 'Aspose', storage_name = '')
374
+ raise 'alignment not specified.' if alignment.empty?
375
+ raise 'format not specified.' if format.empty?
376
+
377
+ str_uri = "#{@base_uri}/insertPageNumbers"
378
+ str_uri = Aspose::Cloud::Common::Utils.append_storage(str_uri,'',storage_name,storage_type)
379
+ signed_str_uri = Aspose::Cloud::Common::Utils.sign(str_uri)
380
+
381
+ data = Hash['Format' => format, 'Alignment' => alignment, 'IsTop' => is_top, 'SetPageNumberOnFirstPage' => set_page_number_on_first_page]
382
+ json_data = JSON.generate(data)
383
+
384
+ response_stream = RestClient.post(signed_str_uri, json_data, {:content_type=>:json, :accept=>'application/json'})
385
+ valid_output = Aspose::Cloud::Common::Utils.validate_output(response_stream)
386
+ valid_output.empty? ? Aspose::Cloud::Common::Utils.download_file(@filename,@filename,folder_name,storage_name,storage_type) : valid_output
387
+ end
388
+
389
+ =begin
390
+ Update All Fields in the World Document
391
+ =end
392
+ def update_fields(folder_name = '', storage_type = 'Aspose', storage_name = '')
393
+ str_uri = "#{@base_uri}/updateFields"
394
+ str_uri = Aspose::Cloud::Common::Utils.append_storage(str_uri,folder_name,storage_name,storage_type)
395
+ signed_str_uri = Aspose::Cloud::Common::Utils.sign(str_uri)
396
+ response = RestClient.post(signed_str_uri, '', {:accept=>'application/json'})
397
+ json = JSON.parse(response)
398
+ json['Code'] == 200 ? true : false
399
+ end
400
+
401
+ =begin
402
+ Update Font of a Run in a Word Document
403
+ @param number para_id ID of the paragraph.
404
+ @param number run_index Index of the paragraph run.
405
+ @param string font_name Name of the font.
406
+ =end
407
+ def update_paragraph_run_font(para_id, run_index, font_name, folder_name = '', storage_type = 'Aspose', storage_name = '')
408
+ raise 'para_id not specified.' if para_id.nil?
409
+ raise 'run_index not specified.' if run_index.nil?
410
+ raise 'font_name not specified.' if font_name.empty?
411
+
412
+ str_uri = "#{@base_uri}/paragraphs/#{para_id}/runs/run_index/font"
413
+ str_uri = Aspose::Cloud::Common::Utils.append_storage(str_uri,folder_name,storage_name,storage_type)
414
+ signed_str_uri = Aspose::Cloud::Common::Utils.sign(str_uri)
415
+
416
+ str_xml = "<Font><Name>#{font_name}</Name></Font>"
417
+
418
+ response = RestClient.post(signed_str_uri, str_xml, {:accept=>'application/json'})
419
+ json = JSON.parse(response)
420
+ json['Code'] == 200 ? json['Font'] : false
421
+ end
114
422
  end
115
423
  end
116
424
  end
117
- end
425
+ end