NAME
WebService::Box - manage your documents on Box.com
VERSION
version 0.02
SYNOPSIS
my $box = WebService::Box->new(
api_url => $api_url, # usually no need to use this parameter
upload_url => $upload_url, # the library knows the standard box urls
on_error => sub {}, # what should happen when an
# error occurs. valid values: subroutine, undef, die, warn
);
my $client = $box->create_session(
client_id => $client_id,
client_secret => $secret,
auth_token => $auth_token, # optional
refresh_token => $refresh_token,
redirect_url => 'http://host.example/',
);
my $file = $client->file;
my $uploaded_file = $file->upload( '/path/to/local.file', $folder_id );
my $new_file = $file->upload( '/path/to/local.file', $folder_object );
my $data = $new_file->download;
my $folder = $client->folder( $id );
my $files = $folder->files;
my $subfolder = $folder->folder;
METHODS
new
create_session
file
folder
FILE METHODS
upload
comment
delete
folder
FILE ATTRIBUTES
FOLDER METHODS
Those methods belong to WebService::Box::Folder
.
files
Returns a list of WebService::Box::File
objects. Each object represents a file in the Box. If the request was not successful undef
is returned.
my $folder = $client->folder( $id );
my $files = $folder->files;
for my $file ( @{ $files } ) {
print $file->id, ": ", $file->name;
}
folder
Returns a list ob folder objects. Each object is a subfolder.
my $subfolders = $folder->folder;
my $subfolders = $client->folder( $id )->folder;
parent
Returns an object for the parent object
my $parent_folder = $folder->parent;
my $parent_folder = $client->folder( $id )->parent;
create
Create a new folder in the Box. Returns an object that represents that new folder. You can pass either the ID of the parent folder or a WebService::Box::Folder
object. The second para
my $new_folder = $client->folder->create( 'new_folder_name', $parent_id );
# alternatively
my $new_folder = $client->folder->create(
name => 'new_folder_name',
parent_id => $parent_id,
);
FOLDER ATTRIBUTES
ADDITIONAL INFORMATION
All methods that need information from Box do request once and cache the results of those requests. So a second call of that method on the same object will use the cached results.
The client caches the access_token it its expiration. When the access_token is expired it requests a new one. That's why the refresh_token is needed.
AUTHOR
Renee Baecker <reneeb@cpan.org>
COPYRIGHT AND LICENSE
This software is Copyright (c) 2013 by Renee Baecker.
This is free software, licensed under:
The Artistic License 2.0 (GPL Compatible)