Module: CrateAPI

Defined in:
lib/crate_api.rb,
lib/crate_api/base.rb,
lib/crate_api/item.rb,
lib/crate_api/crate.rb,
lib/crate_api/items.rb,
lib/crate_api/crates.rb,
lib/crate_api/crateobject.rb

Overview

The CrateAPI Gem is a lightweight Ruby interface to the Crate file-sharing site. A few examples will follow in order to get everyone up to speed.

Examples:

Create a new Crate client.

client = CrateAPI.new("username", "password")

Retreive all crates for a user.

crates = client.crates.all

Create a new crate.

client.crate.add("YourNewAwesomeCrateName")

Upload a new file to a crate.

crates[0].add_file("/Path/to/your/file")

Author:

  • Brian Michel

Defined Under Namespace

Classes: Base, Crate, CrateDestroyError, CrateFileAlreadyExistsError, CrateLimitReachedError, CrateObject, CrateRenameError, Crates, FileDestroyError, Item, Items, NotValidUserError

Class Method Summary collapse

Class Method Details

.new(username, password) ⇒ CrateAPI::Base

Default initializer for a new CrateAPI instace

Parameters:

  • Username (String)

    for the client.

  • password (String)

    Password for the client.

Returns:



30
31
32
# File 'lib/crate_api.rb', line 30

def self.new(username, password)
  CrateAPI::Base.new(username, password)
end