asposecloud 1.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (93) hide show
  1. checksums.yaml +7 -0
  2. data/.gitignore +17 -0
  3. data/.project +18 -0
  4. data/Gemfile +4 -0
  5. data/LICENSE +21 -0
  6. data/README.md +71 -0
  7. data/Rakefile +1 -0
  8. data/Samples/Barcode/Test_Builder.rb +35 -0
  9. data/Samples/Barcode/Test_Reader.rb +34 -0
  10. data/Samples/Cells/Test_Converter.rb +34 -0
  11. data/Samples/Email/Test_Converter.rb +31 -0
  12. data/Samples/Email/Test_Document.rb +31 -0
  13. data/Samples/Pdf/Test_Converter.rb +38 -0
  14. data/Samples/Pdf/Test_TextEditor.rb +33 -0
  15. data/Samples/Slides/Test_Converter.rb +35 -0
  16. data/Samples/Storage/Test_Folder.rb +42 -0
  17. data/Samples/Words/Test_Converter.rb +34 -0
  18. data/Samples/tasks/Test_Converter.rb +31 -0
  19. data/Samples/tasks/Test_Document.rb +33 -0
  20. data/Tests/Data/barcodeQR.png +0 -0
  21. data/Tests/Data/email_test.eml +21 -0
  22. data/Tests/Data/email_test_attach.eml +64 -0
  23. data/Tests/Data/test_convert_cell.xlsx +0 -0
  24. data/Tests/Data/test_convert_slide.pptx +0 -0
  25. data/Tests/Data/test_convertlocal.docx +0 -0
  26. data/Tests/Data/test_convertlocal.pdf +0 -0
  27. data/Tests/Data/test_file_on_storage.pdf +0 -0
  28. data/Tests/Data/test_replace_text.pdf +0 -0
  29. data/Tests/Data/test_tasks.mpp +0 -0
  30. data/Tests/Data/test_uploadfile.docx +0 -0
  31. data/Tests/Output/barcodeQR.png +0 -0
  32. data/Tests/Output/converted_file.doc +0 -0
  33. data/Tests/Output/converted_file.pdf +0 -0
  34. data/Tests/Output/converted_file.tiff +0 -0
  35. data/Tests/Output/email_test.msg +0 -0
  36. data/Tests/Output/test_convert_slide.png +0 -0
  37. data/Tests/Output/test_file_on_storage.doc +0 -0
  38. data/Tests/Output/testfile.jpeg +0 -0
  39. data/Tests/barcode_tests.rb +45 -0
  40. data/Tests/cell_tests.rb +41 -0
  41. data/Tests/email_tests.rb +43 -0
  42. data/Tests/pdf_tests.rb +76 -0
  43. data/Tests/slide_tests.rb +41 -0
  44. data/Tests/storage_tests.rb +86 -0
  45. data/Tests/tasks_tests.rb +24 -0
  46. data/Tests/word_tests.rb +34 -0
  47. data/asposecloud.gemspec +24 -0
  48. data/lib/Barcode/builder.rb +45 -0
  49. data/lib/Barcode/reader.rb +65 -0
  50. data/lib/Cells/chart_editor.rb +91 -0
  51. data/lib/Cells/convertor.rb +144 -0
  52. data/lib/Cells/extractor.rb +86 -0
  53. data/lib/Cells/text_editor.rb +94 -0
  54. data/lib/Cells/workbook.rb +224 -0
  55. data/lib/Cells/worksheet.rb +375 -0
  56. data/lib/Common/aspose_app.rb +51 -0
  57. data/lib/Common/product.rb +34 -0
  58. data/lib/Common/utils.rb +172 -0
  59. data/lib/Email/converter.rb +50 -0
  60. data/lib/Email/document.rb +67 -0
  61. data/lib/Ocr/extractor.rb +105 -0
  62. data/lib/Pdf/annotation_editor.rb +263 -0
  63. data/lib/Pdf/converter.rb +127 -0
  64. data/lib/Pdf/document.rb +220 -0
  65. data/lib/Pdf/extractor.rb +107 -0
  66. data/lib/Pdf/text_editor.rb +121 -0
  67. data/lib/Slides/converter.rb +79 -0
  68. data/lib/Slides/document.rb +208 -0
  69. data/lib/Slides/extractor.rb +135 -0
  70. data/lib/Storage/folder.rb +128 -0
  71. data/lib/Words/builder.rb +82 -0
  72. data/lib/Words/converter.rb +67 -0
  73. data/lib/Words/document.rb +117 -0
  74. data/lib/Words/extractor.rb +153 -0
  75. data/lib/Words/mail_merge.rb +65 -0
  76. data/lib/aspose_barcode.rb +21 -0
  77. data/lib/aspose_cells.rb +24 -0
  78. data/lib/aspose_common.rb +29 -0
  79. data/lib/aspose_email.rb +20 -0
  80. data/lib/aspose_ocr.rb +21 -0
  81. data/lib/aspose_pdf.rb +23 -0
  82. data/lib/aspose_slides.rb +21 -0
  83. data/lib/aspose_storage.rb +19 -0
  84. data/lib/aspose_tasks.rb +23 -0
  85. data/lib/aspose_words.rb +23 -0
  86. data/lib/asposecloud.rb +29 -0
  87. data/lib/asposecloud/version.rb +3 -0
  88. data/lib/tasks/assignments.rb +71 -0
  89. data/lib/tasks/calendar.rb +56 -0
  90. data/lib/tasks/converter.rb +48 -0
  91. data/lib/tasks/document.rb +143 -0
  92. data/lib/tasks/resources.rb +69 -0
  93. metadata +187 -0
@@ -0,0 +1,86 @@
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
+ module Aspose
19
+ module Cloud
20
+ module Cells
21
+ class Extractor
22
+ def initialize(filename)
23
+ @filename = filename
24
+ raise 'filename not specified.' if filename.empty?
25
+ @base_uri = "#{Aspose::Cloud::Common::Product.product_uri}/cells/#{@filename}"
26
+ end
27
+
28
+ def get_picture(worksheet_name, picture_index, image_format, folder_name = '', storage_type = 'Aspose', storage_name = '')
29
+ raise 'worksheet_name not specified.' if worksheet_name.empty?
30
+ raise 'picture_index not specified.' if picture_index.nil?
31
+ raise 'image_format not specified.' if image_format.empty?
32
+
33
+ str_uri = "#{@base_uri}/worksheets/#{worksheet_name}/pictures/#{picture_index}?format=#{image_format}"
34
+ str_uri = Aspose::Cloud::Common::Utils.append_storage(str_uri,folder_name,storage_name,storage_type)
35
+ signed_str_uri = Aspose::Cloud::Common::Utils.sign(str_uri)
36
+ response_stream = RestClient.get(signed_str_uri, {:accept=>'application/json'})
37
+ valid_output = Aspose::Cloud::Common::Utils.validate_output(response_stream)
38
+ output_path = "#{Aspose::Cloud::Common::AsposeApp.output_location}#{Aspose::Cloud::Common::Utils.get_filename(@filename)}_#{worksheet_name}.#{image_format}"
39
+ valid_output.empty? ? Aspose::Cloud::Common::Utils.save_file(response_stream,output_path) : valid_output
40
+ end
41
+
42
+ def get_ole_object(worksheet_name, object_index, image_format, folder_name = '', storage_type = 'Aspose', storage_name = '')
43
+ raise 'worksheet_name not specified.' if worksheet_name.empty?
44
+ raise 'object_index not specified.' if object_index.nil?
45
+ raise 'image_format not specified.' if image_format.empty?
46
+
47
+ str_uri = "#{@base_uri}/worksheets/#{worksheet_name}/oleobjects/#{object_index}?format=#{image_format}"
48
+ str_uri = Aspose::Cloud::Common::Utils.append_storage(str_uri,folder_name,storage_name,storage_type)
49
+ signed_str_uri = Aspose::Cloud::Common::Utils.sign(str_uri)
50
+ response_stream = RestClient.get(signed_str_uri, {:accept=>'application/json'})
51
+ valid_output = Aspose::Cloud::Common::Utils.validate_output(response_stream)
52
+ output_path = "#{Aspose::Cloud::Common::AsposeApp.output_location}#{Aspose::Cloud::Common::Utils.get_filename(@filename)}_#{worksheet_name}.#{image_format}"
53
+ valid_output.empty? ? Aspose::Cloud::Common::Utils.save_file(response_stream,output_path) : valid_output
54
+ end
55
+
56
+ def get_chart(worksheet_name, chart_index, image_format, folder_name = '', storage_type = 'Aspose', storage_name = '')
57
+ raise 'worksheet_name not specified.' if worksheet_name.empty?
58
+ raise 'chart_index not specified.' if chart_index.nil?
59
+ raise 'image_format not specified.' if image_format.empty?
60
+
61
+ str_uri = "#{@base_uri}/worksheets/#{worksheet_name}/charts/#{chart_index}?format=#{image_format}"
62
+ str_uri = Aspose::Cloud::Common::Utils.append_storage(str_uri,folder_name,storage_name,storage_type)
63
+ signed_str_uri = Aspose::Cloud::Common::Utils.sign(str_uri)
64
+ response_stream = RestClient.get(signed_str_uri, {:accept=>'application/json'})
65
+ valid_output = Aspose::Cloud::Common::Utils.validate_output(response_stream)
66
+ output_path = "#{Aspose::Cloud::Common::AsposeApp.output_location}#{Aspose::Cloud::Common::Utils.get_filename(@filename)}_#{worksheet_name}.#{image_format}"
67
+ valid_output.empty? ? Aspose::Cloud::Common::Utils.save_file(response_stream,output_path) : valid_output
68
+ end
69
+
70
+ def get_auto_shape(worksheet_name, shape_index, image_format, folder_name = '', storage_type = 'Aspose', storage_name = '')
71
+ raise 'worksheet_name not specified.' if worksheet_name.empty?
72
+ raise 'shape_index not specified.' if shape_index.nil?
73
+ raise 'image_format not specified.' if image_format.empty?
74
+
75
+ str_uri = "#{@base_uri}/worksheets/#{worksheet_name}/autoshapes/#{shape_index}?format=#{image_format}"
76
+ str_uri = Aspose::Cloud::Common::Utils.append_storage(str_uri,folder_name,storage_name,storage_type)
77
+ signed_str_uri = Aspose::Cloud::Common::Utils.sign(str_uri)
78
+ response_stream = RestClient.get(signed_str_uri, {:accept=>'application/json'})
79
+ valid_output = Aspose::Cloud::Common::Utils.validate_output(response_stream)
80
+ output_path = "#{Aspose::Cloud::Common::AsposeApp.output_location}#{Aspose::Cloud::Common::Utils.get_filename(@filename)}_#{worksheet_name}.#{image_format}"
81
+ valid_output.empty? ? Aspose::Cloud::Common::Utils.save_file(response_stream,output_path) : valid_output
82
+ end
83
+ end
84
+ end
85
+ end
86
+ end
@@ -0,0 +1,94 @@
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
+ module Aspose
19
+ module Cloud
20
+ module Cells
21
+ class TextEditor
22
+ def initialize(filename)
23
+ @filename = filename
24
+ raise 'filename not specified.' if filename.empty?
25
+ @base_uri = "#{Aspose::Cloud::Common::Product.product_uri}/cells/#{@filename}"
26
+ end
27
+
28
+ def find_text(text, folder_name='', storage_type = 'Aspose', storage_name = '')
29
+ raise 'text not specified.' if text.empty?
30
+
31
+ str_uri = "#{@base_uri}/findText?text=#{text}"
32
+ str_uri = Aspose::Cloud::Common::Utils.append_storage(str_uri,folder_name,storage_name,storage_type)
33
+ signed_str_uri = Aspose::Cloud::Common::Utils.sign(str_uri)
34
+ JSON.parse(RestClient.post(signed_str_uri, '', {:accept=>'application/json'}))['TextItems']['TextItemList']
35
+ end
36
+
37
+ def find_text_in_worksheet(text, worksheet_name, folder_name='', storage_type = 'Aspose', storage_name = '')
38
+ raise 'text not specified.' if text.empty?
39
+ raise 'worksheet_name not specified.' if worksheet_name.empty?
40
+
41
+ str_uri = "#{@base_uri}/worksheets/#{worksheet_name}/findText?text=#{text}"
42
+ str_uri = Aspose::Cloud::Common::Utils.append_storage(str_uri,folder_name,storage_name,storage_type)
43
+ signed_str_uri = Aspose::Cloud::Common::Utils.sign(str_uri)
44
+ JSON.parse(RestClient.post(signed_str_uri, '', {:accept=>'application/json'}))['TextItems']['TextItemList']
45
+ end
46
+
47
+ def get_text_items(worksheet_name, folder_name='', storage_type = 'Aspose', storage_name = '')
48
+ raise 'text not specified.' if text.empty?
49
+ raise 'worksheet_name not specified.' if worksheet_name.empty?
50
+
51
+ str_uri = "#{@base_uri}/worksheets/#{worksheet_name}/textItems"
52
+ str_uri = Aspose::Cloud::Common::Utils.append_storage(str_uri,folder_name,storage_name,storage_type)
53
+ signed_str_uri = Aspose::Cloud::Common::Utils.sign(str_uri)
54
+ JSON.parse(RestClient.get(signed_str_uri, {:accept=>'application/json'}))['TextItems']['TextItemList']
55
+ end
56
+
57
+ def replace_text(old_text, new_text, folder_name = '', storage_type = 'Aspose', storage_name = '')
58
+ raise 'old_text not specified.' if old_text.empty?
59
+ raise 'new_text not specified.' if new_text.empty?
60
+
61
+ str_uri = "#{@base_uri}/replaceText"
62
+ qry = Hash.new
63
+ qry[:oldValue] = old_text
64
+ qry[:newValue] = new_text
65
+ str_uri = Aspose::Cloud::Common::Utils.build_uri(str_uri,qry)
66
+ str_uri = Aspose::Cloud::Common::Utils.append_storage(str_uri,folder_name,storage_name,storage_type)
67
+
68
+ signed_str_uri = Aspose::Cloud::Common::Utils.sign(str_uri)
69
+ response_stream = RestClient.post(signed_str_uri,'',{ :accept => 'application/json' })
70
+ valid_output = Aspose::Cloud::Common::Utils.validate_output(response_stream)
71
+ valid_output.empty? ? true : valid_output
72
+ end
73
+
74
+ def replace_text_in_worksheet(worksheet_name, old_text, new_text, folder_name = '', storage_type = 'Aspose', storage_name = '')
75
+ raise 'worksheet_name not specified.' if worksheet_name.empty?
76
+ raise 'old_text not specified.' if old_text.empty?
77
+ raise 'new_text not specified.' if new_text.empty?
78
+
79
+ str_uri = "#{@base_uri}/worksheets/#{worksheet_name}/replaceText"
80
+ qry = Hash.new
81
+ qry[:oldValue] = old_text
82
+ qry[:newValue] = new_text
83
+ str_uri = Aspose::Cloud::Common::Utils.build_uri(str_uri,qry)
84
+ str_uri = Aspose::Cloud::Common::Utils.append_storage(str_uri,folder_name,storage_name,storage_type)
85
+
86
+ signed_str_uri = Aspose::Cloud::Common::Utils.sign(str_uri)
87
+ response_stream = RestClient.post(signed_str_uri,'',{ :accept => 'application/json' })
88
+ valid_output = Aspose::Cloud::Common::Utils.validate_output(response_stream)
89
+ valid_output.empty? ? true : valid_output
90
+ end
91
+ end
92
+ end
93
+ end
94
+ end
@@ -0,0 +1,224 @@
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
+ module Aspose
19
+ module Cloud
20
+ module Cells
21
+ class Workbook
22
+ def initialize(filename)
23
+ @filename = filename
24
+ raise 'filename not specified.' if filename.empty?
25
+ @base_uri = "#{Aspose::Cloud::Common::Product.product_uri}/cells/#{@filename}"
26
+ end
27
+
28
+ def get_properties(folder_name = '', storage_type = 'Aspose', storage_name = '')
29
+ str_uri = "#{@base_uri}/documentProperties"
30
+ str_uri = Aspose::Cloud::Common::Utils.append_storage(str_uri,folder_name,storage_name,storage_type)
31
+ signed_str_uri = Aspose::Cloud::Common::Utils.sign(str_uri)
32
+ JSON.parse(RestClient.get(signed_str_uri, {:accept=>'application/json'}))['DocumentProperties']['List']
33
+ end
34
+
35
+ def get_property(property_name, folder_name = '', storage_type = 'Aspose', storage_name = '')
36
+ raise 'property_name not specified.' if property_name.empty?
37
+
38
+ str_uri = "#{@base_uri}/documentProperties/#{property_name}"
39
+ str_uri = Aspose::Cloud::Common::Utils.append_storage(str_uri,folder_name,storage_name,storage_type)
40
+ signed_str_uri = Aspose::Cloud::Common::Utils.sign(str_uri)
41
+ JSON.parse(RestClient.get(signed_str_uri, {:accept=>'application/json'}))['DocumentProperty']
42
+ end
43
+
44
+ def set_property(property_name, property_value, folder_name = '', storage_type = 'Aspose', storage_name = '')
45
+ raise 'property_name not specified.' if property_name.empty?
46
+ raise 'property_value not specified.' if property_value.empty?
47
+
48
+ json_data = JSON.generate('Value'=>property_value)
49
+
50
+ str_uri = "#{@base_uri}/documentProperties/#{property_name}"
51
+ str_uri = Aspose::Cloud::Common::Utils.append_storage(str_uri,folder_name,storage_name,storage_type)
52
+ signed_str_uri = Aspose::Cloud::Common::Utils.sign(str_uri)
53
+ JSON.parse(RestClient.put(signed_str_uri, json_data, {:content_type=>:json, :accept=>'application/json'}))['DocumentProperty']
54
+ end
55
+
56
+ def remove_all_properties(folder_name = '', storage_type = 'Aspose', storage_name = '')
57
+ str_uri = "#{@base_uri}/documentProperties"
58
+ str_uri = Aspose::Cloud::Common::Utils.append_storage(str_uri,folder_name,storage_name,storage_type)
59
+ signed_str_uri = Aspose::Cloud::Common::Utils.sign(str_uri)
60
+ JSON.parse(RestClient.delete(signed_str_uri, {:accept=>'application/json'}))['Code'] == 200 ? true : false
61
+ end
62
+
63
+ def remove_property(property_name, folder_name = '', storage_type = 'Aspose', storage_name = '')
64
+ raise 'property_name not specified.' if property_name.empty?
65
+
66
+ str_uri = "#{@base_uri}/documentProperties/#{property_name}"
67
+ str_uri = Aspose::Cloud::Common::Utils.append_storage(str_uri,folder_name,storage_name,storage_type)
68
+ signed_str_uri = Aspose::Cloud::Common::Utils.sign(str_uri)
69
+ JSON.parse(RestClient.delete(signed_str_uri, {:accept=>'application/json'}))['Code'] == 200 ? true : false
70
+ end
71
+
72
+ def create_empty_workbook(folder_name = '', storage_type = 'Aspose', storage_name = '')
73
+ str_uri = "#{@base_uri}"
74
+ str_uri = Aspose::Cloud::Common::Utils.append_storage(str_uri,folder_name,storage_name,storage_type)
75
+ signed_str_uri = Aspose::Cloud::Common::Utils.sign(str_uri)
76
+ JSON.parse(RestClient.put(signed_str_uri, '', {:accept=>'application/json'}))
77
+ end
78
+
79
+ def create_workbook_from_template(template_file_name, folder_name = '', storage_type = 'Aspose', storage_name = '')
80
+ raise 'template_file_name not specified.' if template_file_name.empty?
81
+
82
+ str_uri = "#{@base_uri}?templatefile=#{template_file_name}"
83
+ str_uri = Aspose::Cloud::Common::Utils.append_storage(str_uri,folder_name,storage_name,storage_type)
84
+ signed_str_uri = Aspose::Cloud::Common::Utils.sign(str_uri)
85
+ JSON.parse(RestClient.put(signed_str_uri, '', {:accept=>'application/json'}))
86
+ end
87
+
88
+ def create_from_smart_template(template_file_name, data_file, folder_name = '', storage_type = 'Aspose', storage_name = '')
89
+ raise 'template_file_name not specified.' if template_file_name.empty?
90
+ raise 'data_file not specified.' if data_file.empty?
91
+
92
+ str_uri = "#{@base_uri}"
93
+ qry = { :templateFile => template_file_name, :dataFile => data_file}
94
+ str_uri = Aspose::Cloud::Common::Utils.build_uri(str_uri,qry)
95
+ str_uri = Aspose::Cloud::Common::Utils.append_storage(str_uri,folder_name,storage_name,storage_type)
96
+ signed_str_uri = Aspose::Cloud::Common::Utils.sign(str_uri)
97
+ JSON.parse(RestClient.put(signed_str_uri, '', {:accept=>'application/json'}))
98
+ end
99
+
100
+ def process_smart_marker(data_file, folder_name = '', storage_type = 'Aspose', storage_name = '')
101
+ raise 'data_file not specified.' if data_file.empty?
102
+
103
+ str_uri = "#{@base_uri}"
104
+ qry = { :xmlFile => data_file}
105
+ str_uri = Aspose::Cloud::Common::Utils.build_uri(str_uri,qry)
106
+ str_uri = Aspose::Cloud::Common::Utils.append_storage(str_uri,folder_name,storage_name,storage_type)
107
+ signed_str_uri = Aspose::Cloud::Common::Utils.sign(str_uri)
108
+ JSON.parse(RestClient.post(signed_str_uri, '', {:accept=>'application/json'}))
109
+ end
110
+
111
+ def get_worksheets_count(folder_name = '', storage_type = 'Aspose', storage_name = '')
112
+ str_uri = "#{@base_uri}/worksheets"
113
+ str_uri = Aspose::Cloud::Common::Utils.append_storage(str_uri,folder_name,storage_name,storage_type)
114
+ signed_str_uri = Aspose::Cloud::Common::Utils.sign(str_uri)
115
+ JSON.parse(RestClient.get(signed_str_uri, {:accept=>'application/json'}))['Worksheets']['WorksheetList'].length
116
+ end
117
+
118
+ def get_name_count(folder_name = '', storage_type = 'Aspose', storage_name = '')
119
+ str_uri = "#{@base_uri}/names"
120
+ str_uri = Aspose::Cloud::Common::Utils.append_storage(str_uri,folder_name,storage_name,storage_type)
121
+ signed_str_uri = Aspose::Cloud::Common::Utils.sign(str_uri)
122
+ JSON.parse(RestClient.get(signed_str_uri, {:accept=>'application/json'}))['Names'].length
123
+ end
124
+
125
+ def get_default_style(folder_name = '', storage_type = 'Aspose', storage_name = '')
126
+ str_uri = "#{@base_uri}/defaultStyle"
127
+ str_uri = Aspose::Cloud::Common::Utils.append_storage(str_uri,folder_name,storage_name,storage_type)
128
+ signed_str_uri = Aspose::Cloud::Common::Utils.sign(str_uri)
129
+ JSON.parse(RestClient.get(signed_str_uri, {:accept=>'application/json'}))['Style']
130
+ end
131
+
132
+ def encrypt_workbook(encryption_type, password, key_length, folder_name = '', storage_type = 'Aspose', storage_name = '')
133
+ raise 'encryption_type not specified.' if encryption_type.empty?
134
+ raise 'password not specified.' if password.empty?
135
+ raise 'key_length not specified.' if key_length.nil?
136
+
137
+ json_data = { :EncryptionType => encryption_type, :KeyLength => key_length, :Password => password }.to_json
138
+ str_uri = "#{@base_uri}/encryption"
139
+ str_uri = Aspose::Cloud::Common::Utils.append_storage(str_uri,folder_name,storage_name,storage_type)
140
+ signed_str_uri = Aspose::Cloud::Common::Utils.sign(str_uri)
141
+ JSON.parse(RestClient.post(signed_str_uri, json_data, {:content_type=>:json, :accept=>'application/json'}))['Code'] == 200 ? true : false
142
+ end
143
+
144
+ def protect_workbook(protection_type, password, folder_name = '', storage_type = 'Aspose', storage_name = '')
145
+ raise 'protection_type not specified.' if protection_type.empty?
146
+ raise 'password not specified.' if password.empty?
147
+
148
+ json_data = { :ProtectionType => protection_type, :Password => password }.to_json
149
+ str_uri = "#{@base_uri}/protection"
150
+ str_uri = Aspose::Cloud::Common::Utils.append_storage(str_uri,folder_name,storage_name,storage_type)
151
+ signed_str_uri = Aspose::Cloud::Common::Utils.sign(str_uri)
152
+ JSON.parse(RestClient.post(signed_str_uri, json_data, {:content_type=>:json, :accept=>'application/json'}))['Code'] == 200 ? true : false
153
+ end
154
+
155
+ def unprotect_workbook(password, folder_name = '', storage_type = 'Aspose', storage_name = '')
156
+ raise 'password not specified.' if password.empty?
157
+
158
+ json_data = { :Password => password }.to_json
159
+ str_uri = "#{@base_uri}/protection"
160
+ str_uri = Aspose::Cloud::Common::Utils.append_storage(str_uri,folder_name,storage_name,storage_type)
161
+ signed_str_uri = Aspose::Cloud::Common::Utils.sign(str_uri)
162
+ JSON.parse(Aspose::Cloud::Common::Utils.process_command(signed_str_uri,'DELETE','JSON',json_data))['Code'] == 200 ? true : false
163
+ end
164
+
165
+ def set_modify_password(password, folder_name = '', storage_type = 'Aspose', storage_name = '')
166
+ raise 'password not specified.' if password.empty?
167
+
168
+ json_data = { :Password => password }.to_json
169
+ str_uri = "#{@base_uri}/writeProtection"
170
+ str_uri = Aspose::Cloud::Common::Utils.append_storage(str_uri,folder_name,storage_name,storage_type)
171
+ signed_str_uri = Aspose::Cloud::Common::Utils.sign(str_uri)
172
+ JSON.parse(RestClient.put(signed_str_uri, json_data, {:content_type=>:json, :accept=>'application/json'}))['Code'] == 200 ? true : false
173
+ end
174
+
175
+ def clear_modify_password(password, folder_name = '', storage_type = 'Aspose', storage_name = '')
176
+ raise 'password not specified.' if password.empty?
177
+
178
+ json_data = { :Password => password }.to_json
179
+ str_uri = "#{@base_uri}/writeProtection"
180
+ str_uri = Aspose::Cloud::Common::Utils.append_storage(str_uri,folder_name,storage_name,storage_type)
181
+ signed_str_uri = Aspose::Cloud::Common::Utils.sign(str_uri)
182
+ JSON.parse(Aspose::Cloud::Common::Utils.process_command(signed_str_uri,'DELETE','JSON',json_data))['Code'] == 200 ? true : false
183
+ end
184
+
185
+ def decrypt_password(password, folder_name = '', storage_type = 'Aspose', storage_name = '')
186
+ raise 'password not specified.' if password.empty?
187
+
188
+ json_data = { :Password => password }.to_json
189
+ str_uri = "#{@base_uri}/encryption"
190
+ str_uri = Aspose::Cloud::Common::Utils.append_storage(str_uri,folder_name,storage_name,storage_type)
191
+ signed_str_uri = Aspose::Cloud::Common::Utils.sign(str_uri)
192
+ JSON.parse(Aspose::Cloud::Common::Utils.process_command(signed_str_uri,'DELETE','JSON',json_data))['Code'] == 200 ? true : false
193
+ end
194
+
195
+ def add_worksheet(worksheet_name, folder_name = '', storage_type = 'Aspose', storage_name = '')
196
+ raise 'worksheet_name not specified.' if worksheet_name.empty?
197
+
198
+ str_uri = "#{@base_uri}/worksheets/#{worksheet_name}"
199
+ str_uri = Aspose::Cloud::Common::Utils.append_storage(str_uri,folder_name,storage_name,storage_type)
200
+ signed_str_uri = Aspose::Cloud::Common::Utils.sign(str_uri)
201
+ JSON.parse(RestClient.put(signed_str_uri, '', {:accept=>'application/json'}))['Code'] == 201 ? true : false
202
+ end
203
+
204
+ def remove_worksheet(worksheet_name, folder_name = '', storage_type = 'Aspose', storage_name = '')
205
+ raise 'worksheet_name not specified.' if worksheet_name.empty?
206
+
207
+ str_uri = "#{@base_uri}/worksheets/#{worksheet_name}"
208
+ str_uri = Aspose::Cloud::Common::Utils.append_storage(str_uri,folder_name,storage_name,storage_type)
209
+ signed_str_uri = Aspose::Cloud::Common::Utils.sign(str_uri)
210
+ JSON.parse(RestClient.delete(signed_str_uri, {:accept=>'application/json'}))['Code'] == 201 ? true : false
211
+ end
212
+
213
+ def merge_workbook(merge_filename, folder_name = '', storage_type = 'Aspose', storage_name = '')
214
+ raise 'merge_filename not specified.' if merge_filename.empty?
215
+
216
+ str_uri = "#{@base_uri}/merge?mergeWith=#{merge_filename}"
217
+ str_uri = Aspose::Cloud::Common::Utils.append_storage(str_uri,folder_name,storage_name,storage_type)
218
+ signed_str_uri = Aspose::Cloud::Common::Utils.sign(str_uri)
219
+ JSON.parse(RestClient.post(signed_str_uri, '', {:accept=>'application/json'}))['Code'] == 200 ? true : false
220
+ end
221
+ end
222
+ end
223
+ end
224
+ end
@@ -0,0 +1,375 @@
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
+ module Aspose
19
+ module Cloud
20
+ module Cells
21
+ class Worksheet
22
+ def initialize(filename, worksheet_name)
23
+ @filename = filename
24
+ @worksheet_name = worksheet_name
25
+ raise 'filename not specified.' if filename.empty?
26
+ raise 'worksheet_name not specified.' if worksheet_name.empty?
27
+ @base_uri = "#{Aspose::Cloud::Common::Product.product_uri}/cells/#{@filename}/worksheets/#{@worksheet_name}"
28
+ end
29
+
30
+ def get_cells_list(offset, count, folder_name = '', storage_type = 'Aspose', storage_name = '')
31
+ raise 'offset not specified.' if offset.nil?
32
+ raise 'count not specified.' if count.nil?
33
+
34
+ str_uri = "#{@base_uri}/cells"
35
+ qry = { :offset => offset, :count => count}
36
+ str_uri = Aspose::Cloud::Common::Utils.build_uri(str_uri,qry)
37
+ str_uri = Aspose::Cloud::Common::Utils.append_storage(str_uri,folder_name,storage_name,storage_type)
38
+ signed_str_uri = Aspose::Cloud::Common::Utils.sign(str_uri)
39
+ JSON.parse(RestClient.get(signed_str_uri, {:accept=>'application/json'}))['Cells']['CellList']
40
+ end
41
+
42
+ def get_row_list(offset, count, folder_name = '', storage_type = 'Aspose', storage_name = '')
43
+ raise 'offset not specified.' if offset.nil?
44
+ raise 'count not specified.' if count.nil?
45
+
46
+ str_uri = "#{@base_uri}/cells/rows"
47
+ qry = { :offset => offset, :count => count}
48
+ str_uri = Aspose::Cloud::Common::Utils.build_uri(str_uri,qry)
49
+ str_uri = Aspose::Cloud::Common::Utils.append_storage(str_uri,folder_name,storage_name,storage_type)
50
+ signed_str_uri = Aspose::Cloud::Common::Utils.sign(str_uri)
51
+ JSON.parse(RestClient.get(signed_str_uri, {:accept=>'application/json'}))['Rows']['RowsList']
52
+ end
53
+
54
+ def get_columns_list(offset, count, folder_name = '', storage_type = 'Aspose', storage_name = '')
55
+ raise 'offset not specified.' if offset.nil?
56
+ raise 'count not specified.' if count.nil?
57
+
58
+ str_uri = "#{@base_uri}/cells/columns"
59
+ qry = { :offset => offset, :count => count}
60
+ str_uri = Aspose::Cloud::Common::Utils.build_uri(str_uri,qry)
61
+ str_uri = Aspose::Cloud::Common::Utils.append_storage(str_uri,folder_name,storage_name,storage_type)
62
+ signed_str_uri = Aspose::Cloud::Common::Utils.sign(str_uri)
63
+ JSON.parse(RestClient.get(signed_str_uri, {:accept=>'application/json'}))['Columns']['ColumnsList']
64
+ end
65
+
66
+ def get_max_columns(offset, count, folder_name = '', storage_type = 'Aspose', storage_name = '')
67
+ raise 'offset not specified.' if offset.nil?
68
+ raise 'count not specified.' if count.nil?
69
+
70
+ str_uri = "#{@base_uri}/cells"
71
+ qry = { :offset => offset, :count => count}
72
+ str_uri = Aspose::Cloud::Common::Utils.build_uri(str_uri,qry)
73
+ str_uri = Aspose::Cloud::Common::Utils.append_storage(str_uri,folder_name,storage_name,storage_type)
74
+ signed_str_uri = Aspose::Cloud::Common::Utils.sign(str_uri)
75
+ JSON.parse(RestClient.get(signed_str_uri, {:accept=>'application/json'}))['Cells']['MaxColumn']
76
+ end
77
+
78
+ def get_max_row(offset, count, folder_name = '', storage_type = 'Aspose', storage_name = '')
79
+ raise 'offset not specified.' if offset.nil?
80
+ raise 'count not specified.' if count.nil?
81
+
82
+ str_uri = "#{@base_uri}/cells"
83
+ qry = { :offset => offset, :count => count}
84
+ str_uri = Aspose::Cloud::Common::Utils.build_uri(str_uri,qry)
85
+ str_uri = Aspose::Cloud::Common::Utils.append_storage(str_uri,folder_name,storage_name,storage_type)
86
+ signed_str_uri = Aspose::Cloud::Common::Utils.sign(str_uri)
87
+ JSON.parse(RestClient.get(signed_str_uri, {:accept=>'application/json'}))['Cells']['MaxRow']
88
+ end
89
+
90
+ def get_cells_count(offset, count, folder_name = '', storage_type = 'Aspose', storage_name = '')
91
+ raise 'offset not specified.' if offset.nil?
92
+ raise 'count not specified.' if count.nil?
93
+
94
+ str_uri = "#{@base_uri}/cells"
95
+ qry = { :offset => offset, :count => count}
96
+ str_uri = Aspose::Cloud::Common::Utils.build_uri(str_uri,qry)
97
+ str_uri = Aspose::Cloud::Common::Utils.append_storage(str_uri,folder_name,storage_name,storage_type)
98
+ signed_str_uri = Aspose::Cloud::Common::Utils.sign(str_uri)
99
+ JSON.parse(RestClient.get(signed_str_uri, {:accept=>'application/json'}))['Cells']['CellCount']
100
+ end
101
+
102
+ def get_auto_shapes_count(folder_name = '', storage_type = 'Aspose', storage_name = '')
103
+ str_uri = "#{@base_uri}/autoshapes"
104
+ str_uri = Aspose::Cloud::Common::Utils.append_storage(str_uri,folder_name,storage_name,storage_type)
105
+ signed_str_uri = Aspose::Cloud::Common::Utils.sign(str_uri)
106
+ JSON.parse(RestClient.get(signed_str_uri, {:accept=>'application/json'}))['AutoShapes']['AuotShapeList'].length
107
+ end
108
+
109
+ def get_auto_shapes_by_index(shape_index, folder_name = '', storage_type = 'Aspose', storage_name = '')
110
+ raise 'count not specified.' if count.nil?
111
+
112
+ str_uri = "#{@base_uri}/autoshapes/#{shape_index}"
113
+ str_uri = Aspose::Cloud::Common::Utils.append_storage(str_uri,folder_name,storage_name,storage_type)
114
+ signed_str_uri = Aspose::Cloud::Common::Utils.sign(str_uri)
115
+ JSON.parse(RestClient.get(signed_str_uri, {:accept=>'application/json'}))['AutoShapes']
116
+ end
117
+
118
+ def get_cell(cell_name, folder_name = '', storage_type = 'Aspose', storage_name = '')
119
+ raise 'cell_name not specified.' if cell_name.empty?
120
+
121
+ str_uri = "#{@base_uri}/cells/#{cell_name}"
122
+ str_uri = Aspose::Cloud::Common::Utils.append_storage(str_uri,folder_name,storage_name,storage_type)
123
+ signed_str_uri = Aspose::Cloud::Common::Utils.sign(str_uri)
124
+ JSON.parse(RestClient.get(signed_str_uri, {:accept=>'application/json'}))['Cell']
125
+ end
126
+
127
+ def get_cell_style(cell_name, folder_name = '', storage_type = 'Aspose', storage_name = '')
128
+ raise 'cell_name not specified.' if cell_name.empty?
129
+
130
+ str_uri = "#{@base_uri}/cells/#{cell_name}/style"
131
+ str_uri = Aspose::Cloud::Common::Utils.append_storage(str_uri,folder_name,storage_name,storage_type)
132
+ signed_str_uri = Aspose::Cloud::Common::Utils.sign(str_uri)
133
+ JSON.parse(RestClient.get(signed_str_uri, {:accept=>'application/json'}))['Style']
134
+ end
135
+
136
+ def set_cell_style(cell_name, style, folder_name = '', storage_type = 'Aspose', storage_name = '')
137
+ raise 'cell_name not specified.' if cell_name.empty?
138
+ raise 'style not specified.' if style.empty?
139
+
140
+ str_uri = "#{@base_uri}/cells/#{cell_name}/style"
141
+ str_uri = Aspose::Cloud::Common::Utils.append_storage(str_uri,folder_name,storage_name,storage_type)
142
+ signed_str_uri = Aspose::Cloud::Common::Utils.sign(str_uri)
143
+ JSON.parse(RestClient.post(signed_str_uri, style.to_json, { :content_type => :json, :accept=>'application/json'}))['Code'] == 200 ? true : false
144
+ end
145
+
146
+ def get_chart_by_index(chart_index, folder_name = '', storage_type = 'Aspose', storage_name = '')
147
+ raise 'chart_index not specified.' if chart_index.nil?
148
+
149
+ str_uri = "#{@base_uri}/charts/#{chart_index}"
150
+ str_uri = Aspose::Cloud::Common::Utils.append_storage(str_uri,folder_name,storage_name,storage_type)
151
+ signed_str_uri = Aspose::Cloud::Common::Utils.sign(str_uri)
152
+ JSON.parse(RestClient.get(signed_str_uri, {:accept=>'application/json'}))['Chart']
153
+ end
154
+
155
+ def get_hyperlink_by_index(link_index, folder_name = '', storage_type = 'Aspose', storage_name = '')
156
+ raise 'link_index not specified.' if link_index.nil?
157
+
158
+ str_uri = "#{@base_uri}/hyperlinks/#{link_index}"
159
+ str_uri = Aspose::Cloud::Common::Utils.append_storage(str_uri,folder_name,storage_name,storage_type)
160
+ signed_str_uri = Aspose::Cloud::Common::Utils.sign(str_uri)
161
+ JSON.parse(RestClient.get(signed_str_uri, {:accept=>'application/json'}))['Hyperlink']
162
+ end
163
+
164
+ def get_comment(cell_name, folder_name = '', storage_type = 'Aspose', storage_name = '')
165
+ raise 'cell_name not specified.' if cell_name.empty?
166
+
167
+ str_uri = "#{@base_uri}/comments/#{cell_name}"
168
+ str_uri = Aspose::Cloud::Common::Utils.append_storage(str_uri,folder_name,storage_name,storage_type)
169
+ signed_str_uri = Aspose::Cloud::Common::Utils.sign(str_uri)
170
+ JSON.parse(RestClient.get(signed_str_uri, {:accept=>'application/json'}))['Comment']
171
+ end
172
+
173
+ def get_oleobject_by_index(ole_index, folder_name = '', storage_type = 'Aspose', storage_name = '')
174
+ raise 'ole_index not specified.' if ole_index.nil?
175
+
176
+ str_uri = "#{@base_uri}/oleobjects/#{ole_index}"
177
+ str_uri = Aspose::Cloud::Common::Utils.append_storage(str_uri,folder_name,storage_name,storage_type)
178
+ signed_str_uri = Aspose::Cloud::Common::Utils.sign(str_uri)
179
+ JSON.parse(RestClient.get(signed_str_uri, {:accept=>'application/json'}))['OleObject']
180
+ end
181
+
182
+ def get_picture_by_index(image_index, folder_name = '', storage_type = 'Aspose', storage_name = '')
183
+ raise 'image_index not specified.' if image_index.nil?
184
+
185
+ str_uri = "#{@base_uri}/pictures/#{image_index}"
186
+ str_uri = Aspose::Cloud::Common::Utils.append_storage(str_uri,folder_name,storage_name,storage_type)
187
+ signed_str_uri = Aspose::Cloud::Common::Utils.sign(str_uri)
188
+ JSON.parse(RestClient.get(signed_str_uri, {:accept=>'application/json'}))['Picture']
189
+ end
190
+
191
+ def get_validation_by_index(index, folder_name = '', storage_type = 'Aspose', storage_name = '')
192
+ raise 'index not specified.' if index.nil?
193
+
194
+ str_uri = "#{@base_uri}/validations/#{index}"
195
+ str_uri = Aspose::Cloud::Common::Utils.append_storage(str_uri,folder_name,storage_name,storage_type)
196
+ signed_str_uri = Aspose::Cloud::Common::Utils.sign(str_uri)
197
+ JSON.parse(RestClient.get(signed_str_uri, {:accept=>'application/json'}))['Validation']
198
+ end
199
+
200
+ def get_mergedcell_by_index(index, folder_name = '', storage_type = 'Aspose', storage_name = '')
201
+ raise 'index not specified.' if index.nil?
202
+
203
+ str_uri = "#{@base_uri}/mergedCells/#{index}"
204
+ str_uri = Aspose::Cloud::Common::Utils.append_storage(str_uri,folder_name,storage_name,storage_type)
205
+ signed_str_uri = Aspose::Cloud::Common::Utils.sign(str_uri)
206
+ JSON.parse(RestClient.get(signed_str_uri, {:accept=>'application/json'}))['MergedCell']
207
+ end
208
+
209
+ def get_mergedcells_count(folder_name = '', storage_type = 'Aspose', storage_name = '')
210
+ str_uri = "#{@base_uri}/mergedCells"
211
+ str_uri = Aspose::Cloud::Common::Utils.append_storage(str_uri,folder_name,storage_name,storage_type)
212
+ signed_str_uri = Aspose::Cloud::Common::Utils.sign(str_uri)
213
+ JSON.parse(RestClient.get(signed_str_uri, {:accept=>'application/json'}))['MergedCell']['Count']
214
+ end
215
+
216
+ def get_validations_count(folder_name = '', storage_type = 'Aspose', storage_name = '')
217
+ str_uri = "#{@base_uri}/validations"
218
+ str_uri = Aspose::Cloud::Common::Utils.append_storage(str_uri,folder_name,storage_name,storage_type)
219
+ signed_str_uri = Aspose::Cloud::Common::Utils.sign(str_uri)
220
+ JSON.parse(RestClient.get(signed_str_uri, {:accept=>'application/json'}))['Validations']['Count']
221
+ end
222
+
223
+ def get_pictures_count(folder_name = '', storage_type = 'Aspose', storage_name = '')
224
+ str_uri = "#{@base_uri}/pictures"
225
+ str_uri = Aspose::Cloud::Common::Utils.append_storage(str_uri,folder_name,storage_name,storage_type)
226
+ signed_str_uri = Aspose::Cloud::Common::Utils.sign(str_uri)
227
+ JSON.parse(RestClient.get(signed_str_uri, {:accept=>'application/json'}))['Pictures']['PictureList'].length
228
+ end
229
+
230
+ def get_oleobjects_count(folder_name = '', storage_type = 'Aspose', storage_name = '')
231
+ str_uri = "#{@base_uri}/oleobjects"
232
+ str_uri = Aspose::Cloud::Common::Utils.append_storage(str_uri,folder_name,storage_name,storage_type)
233
+ signed_str_uri = Aspose::Cloud::Common::Utils.sign(str_uri)
234
+ JSON.parse(RestClient.get(signed_str_uri, {:accept=>'application/json'}))['OleObjects']['OleOjectList'].length
235
+ end
236
+
237
+ def get_charts_count(folder_name = '', storage_type = 'Aspose', storage_name = '')
238
+ str_uri = "#{@base_uri}/oleobjects"
239
+ str_uri = Aspose::Cloud::Common::Utils.append_storage(str_uri,folder_name,storage_name,storage_type)
240
+ signed_str_uri = Aspose::Cloud::Common::Utils.sign(str_uri)
241
+ JSON.parse(RestClient.get(signed_str_uri, {:accept=>'application/json'}))['Charts']['ChartList'].length
242
+ end
243
+
244
+ def get_comments_count(folder_name = '', storage_type = 'Aspose', storage_name = '')
245
+ str_uri = "#{@base_uri}/comments"
246
+ str_uri = Aspose::Cloud::Common::Utils.append_storage(str_uri,folder_name,storage_name,storage_type)
247
+ signed_str_uri = Aspose::Cloud::Common::Utils.sign(str_uri)
248
+ JSON.parse(RestClient.get(signed_str_uri, {:accept=>'application/json'}))['Comments']['CommentList'].length
249
+ end
250
+
251
+ def get_hyperlinks_count(folder_name = '', storage_type = 'Aspose', storage_name = '')
252
+ str_uri = "#{@base_uri}/hyperlinks"
253
+ str_uri = Aspose::Cloud::Common::Utils.append_storage(str_uri,folder_name,storage_name,storage_type)
254
+ signed_str_uri = Aspose::Cloud::Common::Utils.sign(str_uri)
255
+ JSON.parse(RestClient.get(signed_str_uri, {:accept=>'application/json'}))['Hyperlinks']['HyperlinkList'].length
256
+ end
257
+
258
+ def hide_worksheet(folder_name = '', storage_type = 'Aspose', storage_name = '')
259
+ str_uri = "#{@base_uri}/visible?isVisible=false"
260
+ str_uri = Aspose::Cloud::Common::Utils.append_storage(str_uri,folder_name,storage_name,storage_type)
261
+ signed_str_uri = Aspose::Cloud::Common::Utils.sign(str_uri)
262
+ JSON.parse(RestClient.put(signed_str_uri, '', {:accept=>'application/json'}))['Code'] == 200 ? true : false
263
+ end
264
+
265
+ def unhide_worksheet(folder_name = '', storage_type = 'Aspose', storage_name = '')
266
+ str_uri = "#{@base_uri}/visible?isVisible=true"
267
+ str_uri = Aspose::Cloud::Common::Utils.append_storage(str_uri,folder_name,storage_name,storage_type)
268
+ signed_str_uri = Aspose::Cloud::Common::Utils.sign(str_uri)
269
+ JSON.parse(RestClient.put(signed_str_uri, '', {:accept=>'application/json'}))['Code'] == 200 ? true : false
270
+ end
271
+
272
+ def get_rows_count(offset, count, folder_name = '', storage_type = 'Aspose', storage_name = '')
273
+ raise 'offset not specified.' if offset.nil?
274
+ raise 'count not specified.' if count.nil?
275
+
276
+ str_uri = "#{@base_uri}/cells/rows"
277
+ qry = { :offset => offset, :count => count}
278
+ str_uri = Aspose::Cloud::Common::Utils.build_uri(str_uri,qry)
279
+ str_uri = Aspose::Cloud::Common::Utils.append_storage(str_uri,folder_name,storage_name,storage_type)
280
+ signed_str_uri = Aspose::Cloud::Common::Utils.sign(str_uri)
281
+ JSON.parse(RestClient.get(signed_str_uri, {:accept=>'application/json'}))['Rows']['RowsCount']
282
+ end
283
+
284
+ def get_row(index, folder_name = '', storage_type = 'Aspose', storage_name = '')
285
+ raise 'index not specified.' if index.nil?
286
+
287
+ str_uri = "#{@base_uri}/cells/rows/#{index}"
288
+ str_uri = Aspose::Cloud::Common::Utils.append_storage(str_uri,folder_name,storage_name,storage_type)
289
+ signed_str_uri = Aspose::Cloud::Common::Utils.sign(str_uri)
290
+ JSON.parse(RestClient.get(signed_str_uri, {:accept=>'application/json'}))['Row']
291
+ end
292
+
293
+ def delete_row(index, folder_name = '', storage_type = 'Aspose', storage_name = '')
294
+ raise 'index not specified.' if index.nil?
295
+
296
+ str_uri = "#{@base_uri}/cells/rows/#{index}"
297
+ str_uri = Aspose::Cloud::Common::Utils.append_storage(str_uri,folder_name,storage_name,storage_type)
298
+ signed_str_uri = Aspose::Cloud::Common::Utils.sign(str_uri)
299
+ JSON.parse(RestClient.delete(signed_str_uri, {:accept=>'application/json'}))['Code'] == 200 ? true : false
300
+ end
301
+
302
+ def sort_data(data_sort, cell_area, folder_name = '', storage_type = 'Aspose', storage_name = '')
303
+ raise 'data_sort not specified.' if data_sort.nil?
304
+ raise 'cell_area not specified.' if cell_area.nil?
305
+
306
+ str_uri = "#{@base_uri}/sort"
307
+ qry = { :CellArea => cell_area }
308
+
309
+ str_uri = Aspose::Cloud::Common::Utils.build_uri(str_uri,qry)
310
+ str_uri = Aspose::Cloud::Common::Utils.append_storage(str_uri,folder_name,storage_name,storage_type)
311
+ signed_str_uri = Aspose::Cloud::Common::Utils.sign(str_uri)
312
+ JSON.parse(RestClient.post(signed_str_uri, data_sort.to_json, { :content_type => :json, :accept=>'application/json'}))['Code'] == 200 ? true : false
313
+ end
314
+
315
+ def get_column(index, folder_name = '', storage_type = 'Aspose', storage_name = '')
316
+ raise 'index not specified.' if index.nil?
317
+
318
+ str_uri = "#{@base_uri}/cells/columns/#{index}"
319
+ str_uri = Aspose::Cloud::Common::Utils.append_storage(str_uri,folder_name,storage_name,storage_type)
320
+ signed_str_uri = Aspose::Cloud::Common::Utils.sign(str_uri)
321
+ JSON.parse(RestClient.get(signed_str_uri, {:accept=>'application/json'}))['Column']
322
+ end
323
+
324
+
325
+ def move_worksheet(position, folder_name = '', storage_type = 'Aspose', storage_name = '')
326
+ raise 'position not specified.' if position.nil?
327
+
328
+ json_data = { :DestinationWorksheet => @worksheet_name, :Position => position }
329
+ str_uri = "#{@base_uri}/position"
330
+ str_uri = Aspose::Cloud::Common::Utils.append_storage(str_uri,folder_name,storage_name,storage_type)
331
+ signed_str_uri = Aspose::Cloud::Common::Utils.sign(str_uri)
332
+ JSON.parse(RestClient.post(signed_str_uri, json_data, { :content_type => :json, :accept=>'application/json'}))['Code'] == 200 ? true : false
333
+ end
334
+
335
+ def calculate_formula(formula, folder_name = '', storage_type = 'Aspose', storage_name = '')
336
+ raise 'formula not specified.' if formula.empty?
337
+
338
+ str_uri = "#{@base_uri}/formulaResult?formula=#{formula}"
339
+ str_uri = Aspose::Cloud::Common::Utils.append_storage(str_uri,folder_name,storage_name,storage_type)
340
+ signed_str_uri = Aspose::Cloud::Common::Utils.sign(str_uri)
341
+ JSON.parse(RestClient.get(signed_str_uri, {:accept=>'application/json'}))['Value']
342
+ end
343
+
344
+ def set_cell_value(cell_name, value_type, value, folder_name = '', storage_type = 'Aspose', storage_name = '')
345
+ raise 'cell_name not specified.' if cell_name.empty?
346
+ raise 'value_type not specified.' if value_type.empty?
347
+ raise 'value not specified.' if value.empty?
348
+
349
+ str_uri = "#{@base_uri}/cells/#{cell_name}"
350
+ qry = { :value => value, :type => value_type }
351
+ str_uri = Aspose::Cloud::Common::Utils.build_uri(str_uri,qry)
352
+ str_uri = Aspose::Cloud::Common::Utils.append_storage(str_uri,folder_name,storage_name,storage_type)
353
+ signed_str_uri = Aspose::Cloud::Common::Utils.sign(str_uri)
354
+ JSON.parse(RestClient.post(signed_str_uri, '', { :accept=>'application/json'}))['Code'] == 200 ? true : false
355
+ end
356
+
357
+ def add_picture(picture_path, upper_left_row, upper_left_column, lower_right_row, lower_right_column, folder_name = '', storage_type = 'Aspose', storage_name = '')
358
+ raise 'picture_file not specified.' if picture_path.empty?
359
+ raise 'upper_left_row not specified.' if upper_left_row.empty?
360
+ raise 'upper_left_column not specified.' if upper_left_column.empty?
361
+ raise 'lower_right_row not specified.' if lower_right_row.empty?
362
+ raise 'lower_right_column not specified.' if lower_right_column.empty?
363
+
364
+ qry = { :upperLeftRow => upper_left_row, :upperLeftColumn => upper_left_column, :lowerRightRow => lower_right_row,
365
+ :lowerRightColumn => lower_right_column, :picturePath => picture_path}
366
+ str_uri = "#{@base_uri}/pictures"
367
+ str_uri = Aspose::Cloud::Common::Utils.build_uri(str_uri,qry)
368
+ str_uri = Aspose::Cloud::Common::Utils.append_storage(str_uri,folder_name,storage_name,storage_type)
369
+ signed_str_uri = Aspose::Cloud::Common::Utils.sign(str_uri)
370
+ JSON.parse(RestClient.put(signed_str_uri, '', { :accept=>'application/json'}))['Code'] == 200 ? true : false
371
+ end
372
+ end
373
+ end
374
+ end
375
+ end