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
+ require 'test/unit'
19
+ require_relative '../lib/asposecloud'
20
+
21
+ class StorageTests < Test::Unit::TestCase
22
+
23
+ def test_get_files
24
+ Aspose::Cloud::Common::AsposeApp.app_key = '8356c76c7412f32bb85ae7472e842da4'
25
+ Aspose::Cloud::Common::AsposeApp.app_sid = '8EB6E644-4A40-4B50-8012-135D1F8F7513'
26
+ Aspose::Cloud::Common::AsposeApp.output_location = './Output/'
27
+ Aspose::Cloud::Common::Product.set_base_product_uri('http://test.aspose.com/v1.1')
28
+
29
+ # Create object of folder class
30
+ folder = Aspose::Cloud::AsposeStorage::Folder.new
31
+
32
+ response = folder.get_files
33
+ assert_instance_of(Array,response)
34
+ end
35
+
36
+ def test_file_exists
37
+ Aspose::Cloud::Common::AsposeApp.app_key = '8356c76c7412f32bb85ae7472e842da4'
38
+ Aspose::Cloud::Common::AsposeApp.app_sid = '8EB6E644-4A40-4B50-8012-135D1F8F7513'
39
+ Aspose::Cloud::Common::AsposeApp.output_location = './Output/'
40
+ Aspose::Cloud::Common::Product.set_base_product_uri('http://test.aspose.com/v1.1')
41
+
42
+ # Create object of folder class
43
+ folder = Aspose::Cloud::AsposeStorage::Folder.new
44
+ assert_nothing_thrown 'Error' do
45
+ folder.file_exists('testfile.jpeg')
46
+ end
47
+ end
48
+
49
+ def test_create_folder
50
+ Aspose::Cloud::Common::AsposeApp.app_key = '8356c76c7412f32bb85ae7472e842da4'
51
+ Aspose::Cloud::Common::AsposeApp.app_sid = '8EB6E644-4A40-4B50-8012-135D1F8F7513'
52
+ Aspose::Cloud::Common::AsposeApp.output_location = './Output/'
53
+ Aspose::Cloud::Common::Product.set_base_product_uri('http://test.aspose.com/v1.1')
54
+
55
+ # Create object of folder class
56
+ folder = Aspose::Cloud::AsposeStorage::Folder.new
57
+ response = folder.create_folder('testing123')
58
+ assert_equal true, response
59
+ end
60
+
61
+ def test_upload_file
62
+ Aspose::Cloud::Common::AsposeApp.app_key = '8356c76c7412f32bb85ae7472e842da4'
63
+ Aspose::Cloud::Common::AsposeApp.app_sid = '8EB6E644-4A40-4B50-8012-135D1F8F7513'
64
+ Aspose::Cloud::Common::AsposeApp.output_location = './Output/'
65
+ Aspose::Cloud::Common::Product.set_base_product_uri('http://test.aspose.com/v1.1')
66
+
67
+ # Create object of folder class
68
+ folder = Aspose::Cloud::AsposeStorage::Folder.new
69
+ response = folder.upload_file './Data/test_uploadfile.docx'
70
+ assert_equal true, response
71
+ end
72
+
73
+ def test_get_file
74
+ Aspose::Cloud::Common::AsposeApp.app_key = '8356c76c7412f32bb85ae7472e842da4'
75
+ Aspose::Cloud::Common::AsposeApp.app_sid = '8EB6E644-4A40-4B50-8012-135D1F8F7513'
76
+ Aspose::Cloud::Common::AsposeApp.output_location = './Output/'
77
+ Aspose::Cloud::Common::Product.set_base_product_uri('http://test.aspose.com/v1.1')
78
+
79
+ # Create object of folder class
80
+ folder = Aspose::Cloud::AsposeStorage::Folder.new
81
+ response = folder.get_file 'testfile.jpeg'
82
+ Aspose::Cloud::Common::Utils.save_file response, Aspose::Cloud::Common::AsposeApp.output_location + 'testfile.jpeg'
83
+ assert_equal true, File.exist?(Aspose::Cloud::Common::AsposeApp.output_location + 'testfile.jpeg')
84
+ end
85
+
86
+ end
@@ -0,0 +1,24 @@
1
+ require 'test/unit'
2
+ require_relative '../lib/asposecloud'
3
+
4
+ class TasksTests < Test::Unit::TestCase
5
+ def test_convert_storage_file
6
+ Aspose::Cloud::Common::AsposeApp.app_key = '8356c76c7412f32bb85ae7472e842da4'
7
+ Aspose::Cloud::Common::AsposeApp.app_sid = '8EB6E644-4A40-4B50-8012-135D1F8F7513'
8
+ Aspose::Cloud::Common::AsposeApp.output_location = './Output/'
9
+ Aspose::Cloud::Common::Product.set_base_product_uri('http://test.aspose.com/v1.1')
10
+
11
+ # Create Object of folder class
12
+ folder = Aspose::Cloud::AsposeStorage::Folder.new
13
+ response = folder.upload_file './Data/test_tasks.mpp'
14
+ assert_equal true, response
15
+
16
+ # Create object of pdf converter class
17
+ converter = Aspose::Cloud::Tasks::Converter.new('test_tasks.mpp')
18
+ assert_nothing_thrown 'Error' do
19
+ converter.convert('pdf')
20
+ end
21
+
22
+ assert_equal true, File.exist?('./Output/test_tasks.pdf')
23
+ end
24
+ end
@@ -0,0 +1,34 @@
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
+ require 'test/unit'
19
+ require_relative '../lib/asposecloud'
20
+
21
+ class WordTests < Test::Unit::TestCase
22
+ def test_convert_local_file
23
+ Aspose::Cloud::Common::AsposeApp.app_key = '8356c76c7412f32bb85ae7472e842da4'
24
+ Aspose::Cloud::Common::AsposeApp.app_sid = '8EB6E644-4A40-4B50-8012-135D1F8F7513'
25
+ Aspose::Cloud::Common::AsposeApp.output_location = './Output/'
26
+ Aspose::Cloud::Common::Product.set_base_product_uri('http://test.aspose.com/v1.1')
27
+
28
+ # Create object of word converter class
29
+ converter = Aspose::Cloud::Words::Converter.new('file_on_storage.doc')
30
+
31
+ converter.convert_local_file('./Data/test_convertlocal.docx','./Output/converted_file.pdf','pdf')
32
+ assert_equal true, File.exist?('./Output/converted_file.pdf')
33
+ end
34
+ end
@@ -0,0 +1,24 @@
1
+ # coding: utf-8
2
+ lib = File.expand_path('../lib', __FILE__)
3
+ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
+ require 'asposecloud/version'
5
+
6
+ Gem::Specification.new do |spec|
7
+ spec.name = "asposecloud"
8
+ spec.version = Asposecloud::VERSION
9
+ spec.authors = ["Assad Mahmood Qazi"]
10
+ spec.email = ["assadvirgo@gmail.com"]
11
+ spec.description = "Aspose Cloud SDK for Ruby allows you to use Aspose API in your Ruby applications"
12
+ spec.summary = "Aspose Cloud SDK for Ruby allows you to use Aspose API in your Ruby applications"
13
+ spec.homepage = "http://www.aspose.com"
14
+ spec.license = "MIT"
15
+
16
+ spec.files = `git ls-files`.split($/)
17
+ spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
18
+ spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
19
+ spec.require_paths = ["lib","lib/Barcode","lib/Cells","lib/Common","lib/Ocr","lib/Pdf","lib/Slides","lib/Storage","lib/Words", "lib/tasks", "lib/Email"]
20
+
21
+ spec.add_development_dependency "bundler", "~> 1.3"
22
+ spec.add_development_dependency "rake"
23
+ spec.add_development_dependency "rest-client"
24
+ end
@@ -0,0 +1,45 @@
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 Barcode
21
+ class Builder
22
+ def save(code_text, symbology='QR', image_format='png', remote_folder='', storage_type='Aspose', storage_name='', x_resolution=nil, y_resolution=nil, x_dimension=nil, y_dimension=nil)
23
+
24
+ raise 'code_text can not be empty.' if code_text.empty?
25
+ raise 'symbology can not be empty.' if symbology.empty?
26
+ raise 'image_format can not be empty.' if image_format.empty?
27
+
28
+ str_uri = "#{Aspose::Cloud::Common::Product.product_uri}/barcode/generate?"
29
+ str_uri = "#{str_uri}text=#{code_text}&type=#{symbology}&format=#{image_format}"
30
+ str_uri = "#{str_uri}&resolutionX=#{x_resolution}" unless x_resolution.nil?
31
+ str_uri = "#{str_uri}&resolutionY=#{y_resolution}" unless y_resolution.nil?
32
+ str_uri = "#{str_uri}&dimensionX=#{x_dimension}" unless x_dimension.nil?
33
+ str_uri = "#{str_uri}&dimensionY=#{y_dimension}" unless y_dimension.nil?
34
+ str_uri = Aspose::Cloud::Common::Utils.append_storage(str_uri,remote_folder,storage_name,storage_type)
35
+
36
+ signed_uri = Aspose::Cloud::Common::Utils.sign(str_uri)
37
+ response = RestClient.get(signed_uri, :accept => 'application/json')
38
+ output_path = "#{Aspose::Cloud::Common::AsposeApp.output_location}barcode#{symbology}.#{image_format}"
39
+ Aspose::Cloud::Common::Utils.save_file(response, output_path)
40
+ output_path
41
+ end
42
+ end
43
+ end
44
+ end
45
+ end
@@ -0,0 +1,65 @@
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 Barcode
21
+ class Reader
22
+ def initialize(filename)
23
+ @filename = filename
24
+ raise 'Base file is not specified' if @filename.empty?
25
+ end
26
+
27
+ def read(symbology='', remote_folder='', storage_type='Aspose', storage_name='')
28
+
29
+ str_uri = "#{Aspose::Cloud::Common::Product.product_uri}/barcode/#{@filename}/recognize"
30
+ str_uri = "#{str_uri}?type=#{symbology}" unless symbology.empty?
31
+ str_uri = Aspose::Cloud::Common::Utils.append_storage(str_uri,remote_folder,storage_name,storage_type)
32
+
33
+ signed_uri = Aspose::Cloud::Common::Utils.sign(str_uri)
34
+ response = RestClient.get(signed_uri, :accept => 'application/json')
35
+ json = JSON.parse(response)
36
+ json['Code'] == 200 ? json['Barcodes'] : nil
37
+ end
38
+
39
+ def read_from_local_image(local_image, remote_folder='', symbology='', format='', storage_type='Aspose', storage_name='')
40
+ raise 'local image file not provided.' if local_image.empty?
41
+
42
+ folder = Aspose::Cloud::AsposeStorage::Folder.new
43
+ folder.upload_file(local_image, remote_folder, storage_type, storage_name)
44
+
45
+ readr(File.basename(local_image), remote_folder, symbology, format)
46
+ end
47
+
48
+ def readr(remote_image_name, remote_folder='', symbology='', format='', storage_type='Aspose', storage_name='')
49
+ raise 'remote image file not provided.' if remote_image_name.empty?
50
+
51
+ str_uri = "#{Aspose::Cloud::Common::Product.product_uri}/barcode/#{remote_image_name}/recognize"
52
+ str_uri = "#{str_uri}?type=#{symbology}" unless symbology.empty?
53
+ str_uri = "#{str_uri}?format=#{format}" unless format.empty?
54
+ str_uri = Aspose::Cloud::Common::Utils.append_storage(str_uri,remote_folder,storage_name,storage_type)
55
+
56
+ signed_uri = Aspose::Cloud::Common::Utils.sign(str_uri)
57
+ response = RestClient.get(signed_uri, :accept => 'application/json')
58
+ json = JSON.parse(response)
59
+ json['Code'] == 200 ? json['Barcodes'] : nil
60
+ end
61
+ end
62
+ end
63
+
64
+ end
65
+ end
@@ -0,0 +1,91 @@
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 ChartEditor
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 add_chart(worksheet_name, chart_type, upper_left_row, upper_left_column, lower_right_row, lower_right_column, folder_name='', storage_type = 'Aspose', storage_name = '')
29
+ raise 'worksheet_name not specified.' if worksheet_name.empty?
30
+ raise 'chart_type not specified.' if chart_type.empty?
31
+ raise 'upper_left_row not specified.' if upper_left_row.nil?
32
+ raise 'upper_left_column not specified.' if upper_left_column.nil?
33
+ raise 'lower_right_row not specified.' if lower_right_row.nil?
34
+ raise 'lower_right_column not specified.' if lower_right_column.nil?
35
+
36
+ str_uri = "#{@base_uri}/worksheets/#{worksheet_name}/charts"
37
+ qry = { :chartType => chart_type, :upperLeftRow => upper_left_row, :upperLeftColumn => upper_left_column,
38
+ :lowerRightRow => lower_right_row, :lowerRightColumn => lower_right_column }
39
+ str_uri = Aspose::Cloud::Common::Utils.build_uri(str_uri,qry)
40
+ str_uri = Aspose::Cloud::Common::Utils.append_storage(str_uri,folder_name,storage_name,storage_type)
41
+ signed_str_uri = Aspose::Cloud::Common::Utils.sign(str_uri)
42
+ response_stream = RestClient.put(signed_str_uri,'',{:accept=>'application/json'})
43
+ valid_output = Aspose::Cloud::Common::Utils.validate_output(response_stream)
44
+ valid_output.empty? ? Aspose::Cloud::Common::Utils.download_file(@filename,@filename,folder_name,storage_name,storage_type) : valid_output
45
+ end
46
+
47
+ def delete_chart(worksheet_name, chart_index, folder_name='', storage_type = 'Aspose', storage_name = '')
48
+ raise 'worksheet_name not specified.' if worksheet_name.empty?
49
+ raise 'chart_index not specified.' if chart_index.nil?
50
+
51
+ str_uri = "#{@base_uri}/worksheets/#{worksheet_name}/charts/#{chart_index}"
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
+ response_stream = RestClient.delete(signed_str_uri, {:accept=>'application/json'})
55
+ valid_output = Aspose::Cloud::Common::Utils.validate_output(response_stream)
56
+ valid_output.empty? ? Aspose::Cloud::Common::Utils.download_file(@filename,@filename,folder_name,storage_name,storage_type) : valid_output
57
+ end
58
+
59
+ def get_chart_area(worksheet_name, chart_index, folder_name='', storage_type = 'Aspose', storage_name = '')
60
+ raise 'worksheet_name not specified.' if worksheet_name.empty?
61
+ raise 'chart_index not specified.' if chart_index.nil?
62
+
63
+ str_uri = "#{@base_uri}/worksheets/#{worksheet_name}/charts/#{chart_index}/chartArea"
64
+ str_uri = Aspose::Cloud::Common::Utils.append_storage(str_uri,folder_name,storage_name,storage_type)
65
+ signed_str_uri = Aspose::Cloud::Common::Utils.sign(str_uri)
66
+ JSON.parse(RestClient.get(signed_str_uri, {:accept=>'application/json'}))['ChartArea']
67
+ end
68
+
69
+ def get_fill_format(worksheet_name, chart_index, folder_name='', storage_type = 'Aspose', storage_name = '')
70
+ raise 'worksheet_name not specified.' if worksheet_name.empty?
71
+ raise 'chart_index not specified.' if chart_index.nil?
72
+
73
+ str_uri = "#{@base_uri}/worksheets/#{worksheet_name}/charts/#{chart_index}/chartArea/fillFormat"
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.get(signed_str_uri, {:accept=>'application/json'}))['FillFormat']
77
+ end
78
+
79
+ def get_border(worksheet_name, chart_index, folder_name='', storage_type = 'Aspose', storage_name = '')
80
+ raise 'worksheet_name not specified.' if worksheet_name.empty?
81
+ raise 'chart_index not specified.' if chart_index.nil?
82
+
83
+ str_uri = "#{@base_uri}/worksheets/#{worksheet_name}/charts/#{chart_index}/chartArea/border"
84
+ str_uri = Aspose::Cloud::Common::Utils.append_storage(str_uri,folder_name,storage_name,storage_type)
85
+ signed_str_uri = Aspose::Cloud::Common::Utils.sign(str_uri)
86
+ JSON.parse(RestClient.get(signed_str_uri, {:accept=>'application/json'}))['Line']
87
+ end
88
+ end
89
+ end
90
+ end
91
+ end
@@ -0,0 +1,144 @@
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 Converter
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 convert(output_filename, save_format, password='', folder_name = '', storage_type = 'Aspose', storage_name = '')
29
+ raise 'output_filename not specified.' if output_filename.empty?
30
+ raise 'save_format not specified.' if save_format.empty?
31
+
32
+ str_uri = "#{@base_uri}"
33
+ qry = Hash.new
34
+ qry[:format] = save_format
35
+ qry[:password] = password unless password.empty?
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
+ response_stream = RestClient.get(signed_str_uri, {:accept => 'application/json'})
40
+ valid_output = Aspose::Cloud::Common::Utils.validate_output(response_stream)
41
+
42
+ output_path = "#{Aspose::Cloud::Common::AsposeApp.output_location}#{Aspose::Cloud::Common::Utils.get_filename(output_filename)}.#{save_format}"
43
+ valid_output.empty? ? Aspose::Cloud::Common::Utils.save_file(response_stream,output_path) : valid_output
44
+ end
45
+
46
+ def convert_to_image(output_filename, worksheet_name, save_format, password='', folder_name = '', storage_type = 'Aspose', storage_name = '')
47
+ raise 'output_filename not specified.' if output_filename.empty?
48
+ raise 'worksheet_name not specified.' if worksheet_name.empty?
49
+ raise 'save_format not specified.' if save_format.empty?
50
+
51
+ str_uri = "#{@base_uri}/worksheets/#{worksheet_name}"
52
+ qry = Hash.new
53
+ qry[:format] = save_format
54
+ qry[:password] = password unless password.empty?
55
+ str_uri = Aspose::Cloud::Common::Utils.build_uri(str_uri,qry)
56
+ str_uri = Aspose::Cloud::Common::Utils.append_storage(str_uri,folder_name,storage_name,storage_type)
57
+ signed_str_uri = Aspose::Cloud::Common::Utils.sign(str_uri)
58
+ response_stream = RestClient.get(signed_str_uri, {:accept => 'application/json'})
59
+ valid_output = Aspose::Cloud::Common::Utils.validate_output(response_stream)
60
+
61
+ output_path = "#{Aspose::Cloud::Common::AsposeApp.output_location}#{Aspose::Cloud::Common::Utils.get_filename(output_filename)}.#{save_format}"
62
+ valid_output.empty? ? Aspose::Cloud::Common::Utils.save_file(response_stream,output_path) : valid_output
63
+ end
64
+
65
+ def picture_to_image(picture_index, worksheet_name, save_format, password='', folder_name = '', storage_type = 'Aspose', storage_name = '')
66
+ raise 'picture_index not specified.' if picture_index.nil?
67
+ raise 'worksheet_name not specified.' if worksheet_name.empty?
68
+ raise 'save_format not specified.' if save_format.empty?
69
+
70
+ str_uri = "#{@base_uri}/worksheets/#{worksheet_name}/pictures/#{picture_index}"
71
+ qry = Hash.new
72
+ qry[:format] = save_format
73
+ qry[:password] = password unless password.empty?
74
+ str_uri = Aspose::Cloud::Common::Utils.build_uri(str_uri,qry)
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
+ response_stream = RestClient.get(signed_str_uri, {:accept => 'application/json'})
78
+ valid_output = Aspose::Cloud::Common::Utils.validate_output(response_stream)
79
+
80
+ output_path = "#{Aspose::Cloud::Common::AsposeApp.output_location}#{Aspose::Cloud::Common::Utils.get_filename(@filename)}.#{save_format}"
81
+ valid_output.empty? ? Aspose::Cloud::Common::Utils.save_file(response_stream,output_path) : valid_output
82
+ end
83
+
84
+ def oleobject_to_image(object_index, worksheet_name, save_format, password='', folder_name = '', storage_type = 'Aspose', storage_name = '')
85
+ raise 'object_index not specified.' if object_index.nil?
86
+ raise 'worksheet_name not specified.' if worksheet_name.empty?
87
+ raise 'save_format not specified.' if save_format.empty?
88
+
89
+ str_uri = "#{@base_uri}/worksheets/#{worksheet_name}/oleobjects/#{object_index}"
90
+ qry = Hash.new
91
+ qry[:format] = save_format
92
+ qry[:password] = password unless password.empty?
93
+ str_uri = Aspose::Cloud::Common::Utils.build_uri(str_uri,qry)
94
+ str_uri = Aspose::Cloud::Common::Utils.append_storage(str_uri,folder_name,storage_name,storage_type)
95
+ signed_str_uri = Aspose::Cloud::Common::Utils.sign(str_uri)
96
+ response_stream = RestClient.get(signed_str_uri, {:accept => 'application/json'})
97
+ valid_output = Aspose::Cloud::Common::Utils.validate_output(response_stream)
98
+
99
+ output_path = "#{Aspose::Cloud::Common::AsposeApp.output_location}#{Aspose::Cloud::Common::Utils.get_filename(@filename)}.#{save_format}"
100
+ valid_output.empty? ? Aspose::Cloud::Common::Utils.save_file(response_stream,output_path) : valid_output
101
+ end
102
+
103
+ def chart_to_image(chart_index, worksheet_name, save_format, password='', folder_name = '', storage_type = 'Aspose', storage_name = '')
104
+ raise 'chart_index not specified.' if chart_index.nil?
105
+ raise 'worksheet_name not specified.' if worksheet_name.empty?
106
+ raise 'save_format not specified.' if save_format.empty?
107
+
108
+ str_uri = "#{@base_uri}/worksheets/#{worksheet_name}/charts/#{chart_index}"
109
+ qry = Hash.new
110
+ qry[:format] = save_format
111
+ qry[:password] = password unless password.empty?
112
+ str_uri = Aspose::Cloud::Common::Utils.build_uri(str_uri,qry)
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
+ response_stream = RestClient.get(signed_str_uri, {:accept => 'application/json'})
116
+ valid_output = Aspose::Cloud::Common::Utils.validate_output(response_stream)
117
+
118
+ output_path = "#{Aspose::Cloud::Common::AsposeApp.output_location}#{Aspose::Cloud::Common::Utils.get_filename(@filename)}.#{save_format}"
119
+ valid_output.empty? ? Aspose::Cloud::Common::Utils.save_file(response_stream,output_path) : valid_output
120
+ end
121
+
122
+ def autoshape_to_image(shape_index, worksheet_name, save_format, password='', folder_name = '', storage_type = 'Aspose', storage_name = '')
123
+ raise 'shape_index not specified.' if shape_index.nil?
124
+ raise 'worksheet_name not specified.' if worksheet_name.empty?
125
+ raise 'save_format not specified.' if save_format.empty?
126
+
127
+ str_uri = "#{@base_uri}/worksheets/#{worksheet_name}/autoshapes/#{shape_index}"
128
+ qry = Hash.new
129
+ qry[:format] = save_format
130
+ qry[:password] = password unless password.empty?
131
+ str_uri = Aspose::Cloud::Common::Utils.build_uri(str_uri,qry)
132
+ str_uri = Aspose::Cloud::Common::Utils.append_storage(str_uri,folder_name,storage_name,storage_type)
133
+ signed_str_uri = Aspose::Cloud::Common::Utils.sign(str_uri)
134
+ response_stream = RestClient.get(signed_str_uri, {:accept => 'application/json'})
135
+ valid_output = Aspose::Cloud::Common::Utils.validate_output(response_stream)
136
+
137
+ output_path = "#{Aspose::Cloud::Common::AsposeApp.output_location}#{Aspose::Cloud::Common::Utils.get_filename(@filename)}.#{save_format}"
138
+ valid_output.empty? ? Aspose::Cloud::Common::Utils.save_file(response_stream,output_path) : valid_output
139
+ end
140
+ end
141
+ end
142
+
143
+ end
144
+ end