-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathCommon.rb
More file actions
32 lines (25 loc) · 958 Bytes
/
Common.rb
File metadata and controls
32 lines (25 loc) · 958 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
# Load the gem
require 'groupdocs_editor_cloud'
$config = ""
class Common
def self.UploadSampleFiles()
@TestFiles= Dir.glob("Resources/**/*.*")
# Api initialization
storageApi = GroupDocsEditorCloud::StorageApi.from_config($config)
fileApi = GroupDocsEditorCloud::FileApi.from_config($config)
puts("Files Count: "+((@TestFiles).length).to_s)
@TestFiles.each do |item|
dstPath = item.gsub('Resources/', '')
puts("File to Upload: " + dstPath)
fileExistRequest = GroupDocsEditorCloud::ObjectExistsRequest.new(dstPath)
fileExistsResponse = storageApi.object_exists(fileExistRequest)
if fileExistsResponse.exists == false
file = File.open(item, "r")
uploadRequest = GroupDocsEditorCloud::UploadFileRequest.new(dstPath, file)
fileApi.upload_file(uploadRequest)
puts("Uploaded missing file: " + item)
end
end
puts("File Uploading completed..")
end
end