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.
- data/README.md +31 -9
- data/Tests/Barcode/builder_tests.rb +95 -0
- data/Tests/Barcode/reader_tests.rb +70 -0
- data/Tests/Cells/charteditor_tests.rb +139 -0
- data/Tests/Cells/converter_tests.rb +83 -0
- data/Tests/Cells/extractor_tests.rb +40 -0
- data/Tests/Cells/texteditor_tests.rb +52 -0
- data/Tests/Cells/workbook_tests.rb +167 -0
- data/Tests/Cells/worksheet_tests.rb +435 -0
- data/Tests/Data/barcodeQR.bmp +0 -0
- data/Tests/Data/barcodeQR.jpg +0 -0
- data/Tests/Data/barcodeQR.tiff +0 -0
- data/Tests/Data/bizcard.psd +0 -0
- data/Tests/Data/macbook.gif +0 -0
- data/Tests/Data/mail_merge_regions.docx +0 -0
- data/Tests/Data/mail_merge_template.docx +0 -0
- data/Tests/Data/test_cells.xlsx +0 -0
- data/Tests/Data/test_multi_pages.docx +0 -0
- data/Tests/Data/test_slides.pptx +0 -0
- data/Tests/Email/converter_tests.rb +30 -0
- data/Tests/Email/document_tests.rb +55 -0
- data/Tests/Imaging/converter_tests.rb +32 -0
- data/Tests/Imaging/document_tests.rb +132 -0
- data/Tests/Imaging/extractor_tests.rb +67 -0
- data/Tests/Imaging/image_tests.rb +55 -0
- data/Tests/Ocr/extractor_tests.rb +34 -0
- data/Tests/Pdf/annotationeditor_tests.rb +128 -0
- data/Tests/Pdf/converter_tests.rb +74 -0
- data/Tests/Pdf/document_tests.rb +285 -0
- data/Tests/Pdf/extractor_tests.rb +37 -0
- data/Tests/Pdf/texteditor_tests.rb +84 -0
- data/Tests/Slides/converter_tests.rb +59 -0
- data/Tests/Slides/document_tests.rb +187 -0
- data/Tests/Slides/extractor_tests.rb +92 -0
- data/Tests/Storage/folder_tests.rb +64 -0
- data/Tests/Tasks/assignments_tests.rb +44 -0
- data/Tests/Tasks/calendar_tests.rb +45 -0
- data/Tests/Tasks/converter_tests.rb +32 -0
- data/Tests/Tasks/document_tests.rb +114 -0
- data/Tests/Tasks/resources_tests.rb +44 -0
- data/Tests/Words/builder_tests.rb +56 -0
- data/Tests/Words/converter_tests.rb +54 -0
- data/Tests/Words/document_tests.rb +208 -0
- data/Tests/Words/extractor_tests.rb +120 -0
- data/Tests/Words/mail_merge_tests.rb +120 -0
- data/Tests/setup.json +6 -0
- data/lib/Barcode/builder.rb +270 -20
- data/lib/Barcode/reader.rb +112 -18
- data/lib/Cells/chart_editor.rb +102 -0
- data/lib/Cells/convertor.rb +22 -2
- data/lib/Cells/text_editor.rb +8 -2
- data/lib/Cells/workbook.rb +63 -3
- data/lib/Cells/worksheet.rb +479 -10
- data/lib/Common/utils.rb +2 -0
- data/lib/Email/converter.rb +2 -18
- data/lib/Email/document.rb +32 -17
- data/lib/Ocr/extractor.rb +26 -20
- data/lib/Pdf/annotation_editor.rb +0 -17
- data/lib/Pdf/converter.rb +25 -17
- data/lib/Pdf/document.rb +167 -23
- data/lib/Pdf/extractor.rb +0 -17
- data/lib/Pdf/text_editor.rb +35 -20
- data/lib/Slides/converter.rb +48 -18
- data/lib/Slides/document.rb +186 -51
- data/lib/Slides/extractor.rb +35 -18
- data/lib/Storage/folder.rb +30 -25
- data/lib/Words/builder.rb +23 -29
- data/lib/Words/converter.rb +30 -17
- data/lib/Words/document.rb +336 -28
- data/lib/Words/extractor.rb +112 -33
- data/lib/Words/mail_merge.rb +2 -20
- data/{Tests/word_tests.rb → lib/aspose_imaging.rb} +5 -17
- data/lib/asposecloud.rb +3 -1
- data/lib/asposecloud/version.rb +1 -1
- data/lib/imaging/converter.rb +55 -0
- data/lib/imaging/document.rb +301 -0
- data/lib/imaging/extractor.rb +165 -0
- data/lib/imaging/image.rb +118 -0
- data/lib/restclient.rb +36 -0
- data/lib/tasks/assignments.rb +19 -19
- data/lib/tasks/calendar.rb +27 -19
- data/lib/tasks/converter.rb +4 -17
- data/lib/tasks/document.rb +79 -22
- data/lib/tasks/resources.rb +18 -18
- metadata +70 -19
- checksums.yaml +0 -7
- data/Tests/barcode_tests.rb +0 -45
- data/Tests/cell_tests.rb +0 -41
- data/Tests/email_tests.rb +0 -43
- data/Tests/pdf_tests.rb +0 -76
- data/Tests/slide_tests.rb +0 -41
- data/Tests/storage_tests.rb +0 -86
- data/Tests/tasks_tests.rb +0 -24
@@ -0,0 +1,165 @@
|
|
1
|
+
module Aspose
|
2
|
+
module Cloud
|
3
|
+
module Imaging
|
4
|
+
class Extractor
|
5
|
+
def initialize(filename)
|
6
|
+
@filename = filename
|
7
|
+
raise 'filename not specified.' if filename.empty?
|
8
|
+
@base_uri = "#{Aspose::Cloud::Common::Product.product_uri}/imaging/#{@filename}"
|
9
|
+
end
|
10
|
+
|
11
|
+
=begin
|
12
|
+
Get TIFF Frame Properties
|
13
|
+
@param number frame_id ID of the frame.
|
14
|
+
=end
|
15
|
+
def get_tiff_frame_properties(frame_id, folder_name = '', storage_type = 'Aspose', storage_name = '')
|
16
|
+
raise 'frame_id not specified.' if frame_id.nil?
|
17
|
+
|
18
|
+
str_uri = "#{@base_uri}/frames/#{frame_id}/properties"
|
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
|
+
|
22
|
+
response = JSON.parse(RestClient.get(signed_str_uri, {:accept=>'application/json'}))
|
23
|
+
end
|
24
|
+
|
25
|
+
def extract_frame(frame_id, output_filename, folder_name = '', storage_type = 'Aspose', storage_name = '')
|
26
|
+
raise 'frame_id not specified.' if frame_id.nil?
|
27
|
+
raise 'output_filename not specified.' if output_filename.empty?
|
28
|
+
|
29
|
+
str_uri = "#{@base_uri}/frames/#{frame_id}?saveOtherFrames=false&outPath=#{output_filename}"
|
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
|
+
|
33
|
+
response_stream = RestClient.get(signed_str_uri, {:accept=>'application/json'})
|
34
|
+
valid_output = Aspose::Cloud::Common::Utils.validate_output(response_stream)
|
35
|
+
|
36
|
+
if valid_output.empty?
|
37
|
+
output_path = "#{Aspose::Cloud::Common::AsposeApp.output_location}#{Aspose::Cloud::Common::Utils.get_filename(output_filename)}_updated.tiff"
|
38
|
+
Aspose::Cloud::Common::Utils.save_file(response_stream,output_path)
|
39
|
+
end
|
40
|
+
valid_output
|
41
|
+
end
|
42
|
+
|
43
|
+
=begin
|
44
|
+
Resize a TIFF Frame
|
45
|
+
@param number frame_id ID of the frame.
|
46
|
+
@param number new_width New width of the frame.
|
47
|
+
@param number new_height New height of the frame.
|
48
|
+
@param string output_filename Name of the output file.
|
49
|
+
=end
|
50
|
+
def resize_frame(frame_id, new_width, new_height, output_filename, folder_name = '', storage_type = 'Aspose', storage_name = '')
|
51
|
+
raise 'frame_id not specified.' if frame_id.nil?
|
52
|
+
raise 'new_width not specified.' if new_width.nil?
|
53
|
+
raise 'new_height not specified.' if new_height.nil?
|
54
|
+
raise 'output_filename not specified.' if output_filename.empty?
|
55
|
+
|
56
|
+
str_uri = "#{@base_uri}/frames/#{frame_id}?saveOtherFrames=false&newWidth=#{new_width}&newHeight=#{new_height}&outPath=#{output_filename}"
|
57
|
+
str_uri = Aspose::Cloud::Common::Utils.append_storage(str_uri,folder_name,storage_name,storage_type)
|
58
|
+
signed_str_uri = Aspose::Cloud::Common::Utils.sign(str_uri)
|
59
|
+
|
60
|
+
response_stream = RestClient.get(signed_str_uri, {:accept=>'application/json'})
|
61
|
+
valid_output = Aspose::Cloud::Common::Utils.validate_output(response_stream)
|
62
|
+
|
63
|
+
if valid_output.empty?
|
64
|
+
output_path = "#{Aspose::Cloud::Common::AsposeApp.output_location}#{Aspose::Cloud::Common::Utils.get_filename(output_filename)}_updated.tiff"
|
65
|
+
Aspose::Cloud::Common::Utils.save_file(response_stream,output_path)
|
66
|
+
end
|
67
|
+
valid_output
|
68
|
+
end
|
69
|
+
|
70
|
+
=begin
|
71
|
+
Crop a TIFF Frame
|
72
|
+
@param number frame_id ID of the frame.
|
73
|
+
@param number x_position X position of start point for cropping rectangle.
|
74
|
+
@param number y_position Y position of start point for cropping rectangle.
|
75
|
+
@param number rect_width New width of the scaled image.
|
76
|
+
@param number rect_height New height of the scaled image.
|
77
|
+
@param string output_filename Name of the output file.
|
78
|
+
=end
|
79
|
+
def crop_frame(frame_id, x_position, y_position, rect_width, rect_height, output_filename, folder_name = '', storage_type = 'Aspose', storage_name = '')
|
80
|
+
raise 'frame_id not specified.' if frame_id.nil?
|
81
|
+
raise 'x_position not specified.' if x_position.nil?
|
82
|
+
raise 'y_position not specified.' if y_position.nil?
|
83
|
+
raise 'rect_width not specified.' if rect_width.nil?
|
84
|
+
raise 'rect_height not specified.' if rect_height.nil?
|
85
|
+
raise 'output_filename not specified.' if output_filename.empty?
|
86
|
+
|
87
|
+
str_uri = "#{@base_uri}/frames/#{frame_id}?saveOtherFrames=false&x=#{x_position}&y=#{y_position}&rectWidth=#{rect_width}&rectHeight=#{rect_height}&outPath=#{output_filename}"
|
88
|
+
str_uri = Aspose::Cloud::Common::Utils.append_storage(str_uri,folder_name,storage_name,storage_type)
|
89
|
+
signed_str_uri = Aspose::Cloud::Common::Utils.sign(str_uri)
|
90
|
+
|
91
|
+
response_stream = RestClient.get(signed_str_uri, {:accept=>'application/json'})
|
92
|
+
valid_output = Aspose::Cloud::Common::Utils.validate_output(response_stream)
|
93
|
+
|
94
|
+
if valid_output.empty?
|
95
|
+
output_path = "#{Aspose::Cloud::Common::AsposeApp.output_location}#{Aspose::Cloud::Common::Utils.get_filename(output_filename)}_updated.tiff"
|
96
|
+
Aspose::Cloud::Common::Utils.save_file(response_stream,output_path)
|
97
|
+
end
|
98
|
+
valid_output
|
99
|
+
end
|
100
|
+
|
101
|
+
=begin
|
102
|
+
RotateFlip a TIFF Frame
|
103
|
+
@param number frame_id ID of the frame.
|
104
|
+
@param string rotate_flip_method RotateFlip method.
|
105
|
+
@param string output_filename Name of the output file.
|
106
|
+
=end
|
107
|
+
def rotate_frame(frame_id, rotate_flip_method, output_filename, folder_name = '', storage_type = 'Aspose', storage_name = '')
|
108
|
+
raise 'frame_id not specified.' if frame_id.nil?
|
109
|
+
raise 'rotate_flip_method not specified.' if rotate_flip_method.empty?
|
110
|
+
raise 'output_filename not specified.' if output_filename.empty?
|
111
|
+
|
112
|
+
str_uri = "#{@base_uri}/frames/#{frame_id}?saveOtherFrames=false&rotateFlipMethod=#{rotate_flip_method}&outPath=#{output_filename}"
|
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
|
+
|
116
|
+
response_stream = RestClient.get(signed_str_uri, {:accept=>'application/json'})
|
117
|
+
valid_output = Aspose::Cloud::Common::Utils.validate_output(response_stream)
|
118
|
+
|
119
|
+
if valid_output.empty?
|
120
|
+
output_path = "#{Aspose::Cloud::Common::AsposeApp.output_location}#{Aspose::Cloud::Common::Utils.get_filename(output_filename)}_updated.tiff"
|
121
|
+
Aspose::Cloud::Common::Utils.save_file(response_stream,output_path)
|
122
|
+
end
|
123
|
+
valid_output
|
124
|
+
end
|
125
|
+
|
126
|
+
=begin
|
127
|
+
Manipulate a Frame and Save the Modified Frame Along with Unmodified Frames
|
128
|
+
@param number frame_id ID of the frame.
|
129
|
+
@param string rotate_flip_method RotateFlip method.
|
130
|
+
@param number rect_width New width of the scaled image.
|
131
|
+
@param number rect_height New height of the scaled image.
|
132
|
+
@param number x_position X position of start point for cropping rectangle.
|
133
|
+
@param number y_position Y position of start point for cropping rectangle.
|
134
|
+
@param number rect_width Width of cropping rectangle.
|
135
|
+
@param number rect_height Height of cropping rectangle.
|
136
|
+
@param string output_filename Name of the output file.
|
137
|
+
=end
|
138
|
+
def manipulate_frame(frame_id, rotate_flip_method, new_width, new_height, x_position, y_position, rect_width, rect_height, output_filename, folder_name = '', storage_type = 'Aspose', storage_name = '')
|
139
|
+
raise 'frame_id not specified.' if frame_id.nil?
|
140
|
+
raise 'rotate_flip_method not specified.' if rotate_flip_method.empty?
|
141
|
+
raise 'new_width not specified.' if new_width.nil?
|
142
|
+
raise 'new_height not specified.' if new_height.nil?
|
143
|
+
raise 'x_position not specified.' if x_position.nil?
|
144
|
+
raise 'y_position not specified.' if y_position.nil?
|
145
|
+
raise 'rect_width not specified.' if rect_width.nil?
|
146
|
+
raise 'rect_height not specified.' if rect_height.nil?
|
147
|
+
raise 'output_filename not specified.' if output_filename.empty?
|
148
|
+
|
149
|
+
str_uri = "#{@base_uri}/frames/#{frame_id}?saveOtherFrames=true&rotateFlipMethod=#{rotate_flip_method}&newWidth=#{new_width}&newHeight=#{new_height}&x=#{x_position}&y=#{x_position}&rectWidth=#{rect_width}&rectHeight=#{rect_height}&outPath=#{output_filename}"
|
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
|
+
|
153
|
+
response_stream = RestClient.get(signed_str_uri, {:accept=>'application/json'})
|
154
|
+
valid_output = Aspose::Cloud::Common::Utils.validate_output(response_stream)
|
155
|
+
|
156
|
+
if valid_output.empty?
|
157
|
+
output_path = "#{Aspose::Cloud::Common::AsposeApp.output_location}#{Aspose::Cloud::Common::Utils.get_filename(output_filename)}_updated.tiff"
|
158
|
+
Aspose::Cloud::Common::Utils.save_file(response_stream,output_path)
|
159
|
+
end
|
160
|
+
valid_output
|
161
|
+
end
|
162
|
+
end
|
163
|
+
end
|
164
|
+
end
|
165
|
+
end
|
@@ -0,0 +1,118 @@
|
|
1
|
+
module Aspose
|
2
|
+
module Cloud
|
3
|
+
module Imaging
|
4
|
+
class Image
|
5
|
+
def initialize(filename)
|
6
|
+
@filename = filename
|
7
|
+
raise 'filename not specified.' if filename.empty?
|
8
|
+
@base_uri = "#{Aspose::Cloud::Common::Product.product_uri}/imaging/#{@filename}"
|
9
|
+
end
|
10
|
+
|
11
|
+
=begin
|
12
|
+
Resize Image without Storage
|
13
|
+
@param string input_file_path Path of the input file.
|
14
|
+
@param number new_width New width of the image.
|
15
|
+
@param number new_height New height of the image.
|
16
|
+
@param string output_filename Name of the output file.
|
17
|
+
@param string save_format Output file format.
|
18
|
+
=end
|
19
|
+
def resize_image(input_file_path, new_width, new_height, output_filename, save_format)
|
20
|
+
raise 'input_file_path not specified.' if input_file_path.empty?
|
21
|
+
raise 'output_filename not specified.' if output_filename.empty?
|
22
|
+
raise 'save_format not specified.' if save_format.empty?
|
23
|
+
|
24
|
+
str_uri = "#{Aspose::Cloud::Common::Product.product_uri}/imaging/resize"
|
25
|
+
str_uri = Aspose::Cloud::Common::Utils.build_uri(str_uri, {:newWidth=> new_width,
|
26
|
+
:newHeight=> new_height, :format=> save_format})
|
27
|
+
signed_str_uri = Aspose::Cloud::Common::Utils.sign(str_uri)
|
28
|
+
|
29
|
+
response_stream = RestClient.post(signed_str_uri, File.new(input_file_path, 'rb'), {:accept=>'application/json'})
|
30
|
+
|
31
|
+
valid_output = Aspose::Cloud::Common::Utils.validate_output(response_stream)
|
32
|
+
|
33
|
+
if valid_output.empty?
|
34
|
+
save_format = 'zip' if save_format.eql?('html')
|
35
|
+
output_path = "#{Aspose::Cloud::Common::AsposeApp.output_location}#{Aspose::Cloud::Common::Utils.get_filename(output_filename)}.#{save_format}"
|
36
|
+
Aspose::Cloud::Common::Utils.save_file(response_stream,output_path)
|
37
|
+
end
|
38
|
+
valid_output
|
39
|
+
end
|
40
|
+
|
41
|
+
=begin
|
42
|
+
Crop Image with Format Change
|
43
|
+
@param number x X position of start point for cropping rectangle.
|
44
|
+
@param number y Y position of start point for cropping rectangle.
|
45
|
+
@param number width New width of the image.
|
46
|
+
@param number height New height of the image.
|
47
|
+
@param string output_path Name of the output file.
|
48
|
+
@param string save_format Output file format.
|
49
|
+
=end
|
50
|
+
def crop_image(x, y, width, height, output_path, save_format)
|
51
|
+
raise 'output_path not specified.' if output_path.empty?
|
52
|
+
raise 'save_format not specified.' if save_format.empty?
|
53
|
+
|
54
|
+
str_uri = "#{Aspose::Cloud::Common::Product.product_uri}/imaging/#{@filename}/crop"
|
55
|
+
str_uri = Aspose::Cloud::Common::Utils.build_uri(str_uri, {:width=> width,
|
56
|
+
:height=> height,
|
57
|
+
:x=> x,
|
58
|
+
:y=> y,
|
59
|
+
:outputPath=> output_path,
|
60
|
+
:format=> save_format})
|
61
|
+
signed_str_uri = Aspose::Cloud::Common::Utils.sign(str_uri)
|
62
|
+
|
63
|
+
response_stream = RestClient.get(signed_str_uri, {:accept=>'application/json'})
|
64
|
+
|
65
|
+
valid_output = Aspose::Cloud::Common::Utils.validate_output(response_stream)
|
66
|
+
|
67
|
+
if valid_output.empty?
|
68
|
+
save_format = 'zip' if save_format.eql?('html')
|
69
|
+
output_path = "#{Aspose::Cloud::Common::AsposeApp.output_location}#{Aspose::Cloud::Common::Utils.get_filename(@filename)}.#{save_format}"
|
70
|
+
Aspose::Cloud::Common::Utils.save_file(response_stream,output_path)
|
71
|
+
end
|
72
|
+
valid_output
|
73
|
+
end
|
74
|
+
|
75
|
+
=begin
|
76
|
+
RotateFlip Image on Storage
|
77
|
+
@param string method RotateFlip method.
|
78
|
+
@param string output_path Name of the output file.
|
79
|
+
@param string save_format Output file format.
|
80
|
+
=end
|
81
|
+
def rotate_image(method, output_path, save_format)
|
82
|
+
|
83
|
+
str_uri = "#{Aspose::Cloud::Common::Product.product_uri}/imaging/#{@filename}/rotateflip"
|
84
|
+
str_uri = Aspose::Cloud::Common::Utils.build_uri(str_uri, {:method=> method,
|
85
|
+
:outputPath=> output_path,
|
86
|
+
:format=> save_format})
|
87
|
+
signed_str_uri = Aspose::Cloud::Common::Utils.sign(str_uri)
|
88
|
+
|
89
|
+
response_stream = RestClient.get(signed_str_uri, {:accept=>'application/json'})
|
90
|
+
|
91
|
+
valid_output = Aspose::Cloud::Common::Utils.validate_output(response_stream)
|
92
|
+
|
93
|
+
if valid_output.empty?
|
94
|
+
save_format = 'zip' if save_format.eql?('html')
|
95
|
+
output_path = "#{Aspose::Cloud::Common::AsposeApp.output_location}#{Aspose::Cloud::Common::Utils.get_filename(@filename)}.#{save_format}"
|
96
|
+
Aspose::Cloud::Common::Utils.save_file(response_stream,output_path)
|
97
|
+
end
|
98
|
+
valid_output
|
99
|
+
end
|
100
|
+
|
101
|
+
=begin
|
102
|
+
Merge Tiff Images
|
103
|
+
@param string append_file Name of the file.
|
104
|
+
=end
|
105
|
+
def append_tiff(append_file)
|
106
|
+
raise 'append_file not specified.' if append_file.empty?
|
107
|
+
|
108
|
+
str_uri = "#{Aspose::Cloud::Common::Product.product_uri}/imaging/tiff/#{@filename}/appendTiff?appendFile=#{append_file}"
|
109
|
+
signed_str_uri = Aspose::Cloud::Common::Utils.sign(str_uri)
|
110
|
+
|
111
|
+
response_stream = RestClient.post(signed_str_uri, '', {:accept=>'application/json'})
|
112
|
+
json = JSON.parse(response_stream)
|
113
|
+
json['Code'] == 200 ? Aspose::Cloud::Common::Utils.download_file(@filename,@filename) : nil
|
114
|
+
end
|
115
|
+
end
|
116
|
+
end
|
117
|
+
end
|
118
|
+
end
|
data/lib/restclient.rb
ADDED
@@ -0,0 +1,36 @@
|
|
1
|
+
module RestClient
|
2
|
+
def self.get(url, headers={}, &block)
|
3
|
+
headers['x-aspose-client'] = 'RubySDK/v1.0'
|
4
|
+
Request.execute(:method => :get, :url => url, :headers => headers, &block)
|
5
|
+
end
|
6
|
+
|
7
|
+
def self.post(url, payload, headers={}, &block)
|
8
|
+
headers['x-aspose-client'] = 'RubySDK/v1.0'
|
9
|
+
Request.execute(:method => :post, :url => url, :payload => payload, :headers => headers, &block)
|
10
|
+
end
|
11
|
+
|
12
|
+
def self.patch(url, payload, headers={}, &block)
|
13
|
+
headers['x-aspose-client'] = 'RubySDK/v1.0'
|
14
|
+
Request.execute(:method => :patch, :url => url, :payload => payload, :headers => headers, &block)
|
15
|
+
end
|
16
|
+
|
17
|
+
def self.put(url, payload, headers={}, &block)
|
18
|
+
headers['x-aspose-client'] = 'RubySDK/v1.0'
|
19
|
+
Request.execute(:method => :put, :url => url, :payload => payload, :headers => headers, &block)
|
20
|
+
end
|
21
|
+
|
22
|
+
def self.delete(url, headers={}, &block)
|
23
|
+
headers['x-aspose-client'] = 'RubySDK/v1.0'
|
24
|
+
Request.execute(:method => :delete, :url => url, :headers => headers, &block)
|
25
|
+
end
|
26
|
+
|
27
|
+
def self.head(url, headers={}, &block)
|
28
|
+
headers['x-aspose-client'] = 'RubySDK/v1.0'
|
29
|
+
Request.execute(:method => :head, :url => url, :headers => headers, &block)
|
30
|
+
end
|
31
|
+
|
32
|
+
def self.options(url, headers={}, &block)
|
33
|
+
headers['x-aspose-client'] = 'RubySDK/v1.0'
|
34
|
+
Request.execute(:method => :options, :url => url, :headers => headers, &block)
|
35
|
+
end
|
36
|
+
end
|
data/lib/tasks/assignments.rb
CHANGED
@@ -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 Tasks
|
@@ -25,6 +8,9 @@ module Aspose
|
|
25
8
|
@base_uri = Aspose::Cloud::Common::Product.product_uri + '/tasks/' + @filename
|
26
9
|
end
|
27
10
|
|
11
|
+
=begin
|
12
|
+
Get all Assignments form Project
|
13
|
+
=end
|
28
14
|
def get_assignments(folder_name = '', storage_type = 'Aspose', storage_name = '')
|
29
15
|
str_uri = "#{@base_uri}/assignments"
|
30
16
|
str_uri = Aspose::Cloud::Common::Utils.append_storage(str_uri,folder_name,storage_name,storage_type)
|
@@ -32,6 +18,10 @@ module Aspose
|
|
32
18
|
JSON.parse(RestClient.get(signed_str_uri, {:accept=>'application/json'}))['Assignments']['AssignmentItem']
|
33
19
|
end
|
34
20
|
|
21
|
+
=begin
|
22
|
+
Get a Particular Assignment form Project
|
23
|
+
@param number assignment_id The id of the assignment.
|
24
|
+
=end
|
35
25
|
def get_assignment(assignment_id, folder_name = '', storage_type = 'Aspose', storage_name = '')
|
36
26
|
raise 'assignment_id not specified.' if assignment_id.nil?
|
37
27
|
|
@@ -41,6 +31,12 @@ module Aspose
|
|
41
31
|
JSON.parse(RestClient.get(signed_str_uri, {:accept=>'application/json'}))['Assignment']
|
42
32
|
end
|
43
33
|
|
34
|
+
=begin
|
35
|
+
Add Assignment to Project
|
36
|
+
@param number task_id The unique id of the task to be assigned.
|
37
|
+
@param number resource_id The unique id of the resource to be assigned.
|
38
|
+
@param number units The units for the new assignment.
|
39
|
+
=end
|
44
40
|
def add_assignment(task_id, resource_id, units, folder_name = '', storage_type = 'Aspose', storage_name = '')
|
45
41
|
raise 'task_id not specified.' if task_id.nil?
|
46
42
|
raise 'resource_id not specified.' if resource_id.nil?
|
@@ -56,15 +52,19 @@ module Aspose
|
|
56
52
|
JSON.parse(RestClient.post(signed_str_uri, '', {:accept=>'application/json'}))['AssignmentItem']
|
57
53
|
end
|
58
54
|
|
55
|
+
=begin
|
56
|
+
Delete an Assignment from a Project
|
57
|
+
@param number assignment_id The id of the assignment.
|
58
|
+
=end
|
59
59
|
def delete_assignment(assignment_id, folder_name = '', storage_type = 'Aspose', storage_name = '')
|
60
60
|
raise 'assignment_id not specified.' if assignment_id.nil?
|
61
61
|
|
62
62
|
str_uri = "#{@base_uri}/assignments/#{assignment_id}"
|
63
63
|
str_uri = Aspose::Cloud::Common::Utils.append_storage(str_uri,folder_name,storage_name,storage_type)
|
64
64
|
signed_str_uri = Aspose::Cloud::Common::Utils.sign(str_uri)
|
65
|
-
JSON.parse(RestClient.delete(signed_str_uri, {:accept=>'application/json'}))
|
65
|
+
json = JSON.parse(RestClient.delete(signed_str_uri, {:accept=>'application/json'}))
|
66
|
+
json['Code'] == 200 ? true : false
|
66
67
|
end
|
67
|
-
|
68
68
|
end
|
69
69
|
end
|
70
70
|
end
|
data/lib/tasks/calendar.rb
CHANGED
@@ -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 Tasks
|
@@ -25,6 +8,9 @@ module Aspose
|
|
25
8
|
@base_uri = Aspose::Cloud::Common::Product.product_uri + '/tasks/' + @filename
|
26
9
|
end
|
27
10
|
|
11
|
+
=begin
|
12
|
+
Get all Calendars form Project
|
13
|
+
=end
|
28
14
|
def get_calendars(folder_name = '', storage_type = 'Aspose', storage_name = '')
|
29
15
|
str_uri = "#{@base_uri}/calendars"
|
30
16
|
str_uri = Aspose::Cloud::Common::Utils.append_storage(str_uri,folder_name,storage_name,storage_type)
|
@@ -32,6 +18,10 @@ module Aspose
|
|
32
18
|
JSON.parse(RestClient.get(signed_str_uri, {:accept=>'application/json'}))['Calendars']['List']
|
33
19
|
end
|
34
20
|
|
21
|
+
=begin
|
22
|
+
Get a Particular Calendar form Project
|
23
|
+
@param number calendar_id The id of the calendar.
|
24
|
+
=end
|
35
25
|
def get_calendar(calendar_id, folder_name = '', storage_type = 'Aspose', storage_name = '')
|
36
26
|
raise 'calendar_id not specified.' if calendar_id.nil?
|
37
27
|
|
@@ -41,15 +31,33 @@ module Aspose
|
|
41
31
|
JSON.parse(RestClient.get(signed_str_uri, {:accept=>'application/json'}))['Calendar']
|
42
32
|
end
|
43
33
|
|
34
|
+
=begin
|
35
|
+
Add Calendar to Project
|
36
|
+
@param json json_data Provide data in json format.
|
37
|
+
=end
|
38
|
+
def add_calendar(json_data, folder_name = '', storage_type = 'Aspose', storage_name = '')
|
39
|
+
raise 'json_data not specified.' if json_data.empty?
|
40
|
+
|
41
|
+
str_uri = "#{@base_uri}/calendars"
|
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 = JSON.parse(Aspose::Cloud::Common::Utils.process_command(signed_str_uri,'POST','JSON',json_data))
|
45
|
+
json['Status'] == 'Created' ? json['CalendarItem'] : nil
|
46
|
+
end
|
47
|
+
|
48
|
+
=begin
|
49
|
+
Delete a Calendar from Project
|
50
|
+
@param number calendar_id The id of the calendar.
|
51
|
+
=end
|
44
52
|
def delete_calendar(calendar_id, folder_name = '', storage_type = 'Aspose', storage_name = '')
|
45
53
|
raise 'calendar_id not specified.' if calendar_id.nil?
|
46
54
|
|
47
55
|
str_uri = "#{@base_uri}/calendars/#{calendar_id}"
|
48
56
|
str_uri = Aspose::Cloud::Common::Utils.append_storage(str_uri,folder_name,storage_name,storage_type)
|
49
57
|
signed_str_uri = Aspose::Cloud::Common::Utils.sign(str_uri)
|
50
|
-
JSON.parse(RestClient.delete(signed_str_uri, {:accept=>'application/json'}))
|
58
|
+
json = JSON.parse(RestClient.delete(signed_str_uri, {:accept=>'application/json'}))
|
59
|
+
json['Code'] == 200 ? true : false
|
51
60
|
end
|
52
|
-
|
53
61
|
end
|
54
62
|
end
|
55
63
|
end
|