-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathCommon.rb
More file actions
30 lines (23 loc) · 910 Bytes
/
Common.rb
File metadata and controls
30 lines (23 loc) · 910 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
$config = ""
class Common
def self.UploadSampleFiles()
@TestFiles = Dir.glob("Resources/**/*.*")
# Api initialization
storageApi = GroupDocsViewerCloud::StorageApi.from_config($config)
fileApi = GroupDocsViewerCloud::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 = GroupDocsViewerCloud::ObjectExistsRequest.new(dstPath)
fileExistsResponse = storageApi.object_exists(fileExistRequest)
if fileExistsResponse.exists == false
file = File.open(item, "r")
uploadRequest = GroupDocsViewerCloud::UploadFileRequest.new(dstPath, file)
fileApi.upload_file(uploadRequest)
puts("Uploaded missing file: " + item)
end
end
puts("File Uploading completed..")
end
end