Pcloud is online storage upload/download/share from pcloud.com. Currently not supports all API URLs. Please, check available methods in Github Doc...


Keywords
pcloud
License
MIT
Install
gem install pcloud-storage -v 1.0.0

Documentation

pcloud-storage

Website: https://www.pcloud.com

Api: https://docs.pcloud.com/methods/intro/

Gem Compatibility

  • Ruby >= 2.x
  • Rails >= 4.0

Installing

Add into Gemfile add:

gem 'pcloud-storage'

Then bundle install to install it

rails generate pcloud_storage

which will generate config/pcloud_storage.yml file to set auth_type, user name and password or OAuth token

auth_type: plain
username: YOUR_USERNAME
password: YOUR_PASSWORD

You can also supply your username and password through environment variables to avoid hardcoding them:

auth_type: plain
username: <%= ENV["USERNAME_ENV_VARIABLE"] %>
password: <%= ENV["PASSWORD_ENV_VARIABLE"] %>

Not required, in case of an issue.

require 'pcloud_storage'

Custom Urls:

Since, Not all methods are available right now. You can paste custom url and params and fetch it.

PcloudStorage.custom.get(url, headers)
PcloudStorage.custom.post(url, params, headers)

#sample
PcloudStorage.custom.get(https://api.pcloud.com/getip)
authentication based:
if authentication required, use post method. 
PcloudStorage.custom.post(url, params)

Currently available methods below:

Folder:

https://docs.pcloud.com/methods/folder/

Folder Create
PcloudStorage.folder.create(folder_id, new_folder_name)
Folder List
PcloudStorage.folder.list            #parent folder or .list(0)
PcloudStorage.folder.list(folder_id) 
Folder Rename
PcloudStorage.folder.rename(folder_id, new_folder_name)
Folder Move
PcloudStorage.folder.move(old_folder_id, to_new_folder_id)
Folder Delete
PcloudStorage.folder.delete(folder_id)
Folder Delete Recursive
PcloudStorage.folder.delete_recursive(folder_id)

General:

https://docs.pcloud.com/methods/general/
Current Server
PcloudStorage.general.current_server
Diff
# default all or to access options just pass in object `diff({limit: 5, last: 2})`
PcloudStorage.general.diff 
Feedback
PcloudStorage.general.feedback(email, subject, message, username = nil)
Get Digest
PcloudStorage.general.get_digest
Get File History
PcloudStorage.general.get_file_history(file_id)
Get Ip Address
PcloudStorage.general.get_ip
Set Language
PcloudStorage.general.set_language(language)
Supported Languages
PcloudStorage.general.supported_languages
User Info
PcloudStorage.general.user_info