Class: Storage::Folder
- Inherits:
-
Object
- Object
- Storage::Folder
- Defined in:
- lib/saaspose_storage.rb
Overview
This class provides functionality to manage files in a Remote Saaspose Folder
Class Method Summary collapse
-
.getFiles(remoteFolderPath) ⇒ Object
Retrieves Files and Folder information from a remote folder.
-
.uploadFile(localFilePath, remoteFolderPath) ⇒ Object
-
:remoteFolderPath represents remote folder relative to the root.
-
Class Method Details
.getFiles(remoteFolderPath) ⇒ Object
Retrieves Files and Folder information from a remote folder. The method returns an Array of AppFile objects.
-
:remoteFolderPath represents remote folder relative to the root. Pass empty string for the root folder.
36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 |
# File 'lib/saaspose_storage.rb', line 36 def self.getFiles(remoteFolderPath) urlFolder = $productURI + '/storage/folder' urlFile = '' urlExist = '' urlDisc = '' if not remoteFolderPath.empty? urlFile = $productURI + '/storage/folder/' + remoteFolderPath end signedURL = Common::Utils.sign(urlFolder) response = RestClient.get(signedURL, :accept => 'application/json') result = JSON.parse(response.body) apps = Array.new(result["Files"].size) for i in 0..result["Files"].size - 1 apps[i] = AppFile.new apps[i].Name = result["Files"][i]["Name"] apps[i].IsFolder = result["Files"][i]["IsFolder"] apps[i].Size = result["Files"][i]["Size"] apps[i].ModifiedDate = Common::Utils.parse_date(result["Files"][i]["ModifiedDate"]) end return apps end |
.uploadFile(localFilePath, remoteFolderPath) ⇒ Object
-
:remoteFolderPath represents remote folder relative to the root. Pass empty string for the root folder.
25 26 27 28 29 30 31 32 33 |
# File 'lib/saaspose_storage.rb', line 25 def self.uploadFile(localFilePath,remoteFolderPath) fileName = File.basename(localFilePath) urlFile = $productURI + '/storage/file/' + fileName if not remoteFolderPath.empty? urlFile = $productURI + '/storage/file/' + remoteFolderPath + '/' + fileName end signedURL = Common::Utils.sign(urlFile) Common::Utils.uploadFileBinary(localFilePath,signedURL) end |