Project

clouddrive

0.0
No commit activity in last 3 years
No release in over 3 years
Ruby SDK and command line application for Amazon's CloudDrive
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
 Dependencies

Development

~> 1.9
~> 10.0

Runtime

~> 1.3
~> 0.19
 Project Readme

CloudDrive SDK and CLI

This i a Ruby project built to interact with Amazon's CloudDrive API. It works as both an SDK and a CLI in the sense that I've built the code to easily be implemented in your own projects but it also includes an executable to run many common processes right from the command line.

Installation

Add this line to your application's Gemfile:

gem 'clouddrive'

And then execute:

$ bundle

Or install it yourself as:

$ gem install clouddrive

CLI Usage

The CLI is used by running clouddrive with one of the following commands followed by any necessary arguments (use help argument before any of the following commands for more information).

init        Initialize the CLI with your Amazon email and CloudDrive API credentials
sync        Sync the local cache with Amazon CloudDrive
clearcache  Clear the local cache
metadata    Output JSON-formatted metadata related to the remote file give its remote path

SDK Usage

Account

Initialization

The CloudDrive SDK first needs have an authenticated Account object which can then be passed into the different classes for API calls.

The Account class is created by passing in the email, client_id, and client_secret into the constructor and calling the authorize method. This will handle authorizing and (if necessary) renewing authorization.

The initial authorize method call will return false with an auth_url key in its data. This URL can then be passed into a second authorize call which will parse out the code parameter and complete the initial OAuth process.

account = CloudDrive::Account.new("me@example.com", "my-client-id", "clientsecret")
account.authorize
...
account.authorize(auth_url)

The authorize method call will still need to be called periodically to renew its authorization as the OAuth token expires every 60 minutes.

Local Cache

By default, the SDK stores all necessary information (OAuth token information, local account caches, etc) into ~/.clouddrive. Each account (email), has its own cache file and local cache database of its remote filesystem. Once authenticated, the local cache is initially synced with the remote CloudDrive by calling the sync method.

account.sync

Every time sync is called, it will update the local cache with all changes since the last sync call. The local cache can be cleared out and reset by calling clear_cache.

account.clear_cache

Contributing

  1. Fork it ( https://github.com/[my-github-username]/clouddrive/fork )
  2. Create your feature branch (git checkout -b my-new-feature)
  3. Commit your changes (git commit -am 'Add some feature')
  4. Push to the branch (git push origin my-new-feature)
  5. Create a new Pull Request