Package u1rest :: Package files :: Module resources :: Class FileStorageUser
[hide private]
[frames] | no frames]

Class FileStorageUser

source code

object --+
         |
        FileStorageUser

A File Storage User resource.

This is the main part of the API where typically every call is made.

The get, put, delete are provided for user who do not need a simplified api and plan on parsing the JSON themselves.

Other methods are provided that return serialized objects for simplified user of the API.

Instance Methods [hide private]
 
__init__(self, res_json, resource_client, content_client)
x.__init__(...) initializes x; see help(type(x)) for signature
source code
 
get(self, path, params=None)
GET a resource.
source code
 
put(self, path, data=None, params=None)
PUT a resource.
source code
 
delete(self, path, params=None)
DELETE a resource.
source code
 
make_file(self, path)
Make a File.
source code
 
make_directory(self, path)
Make a Directory.
source code
 
get_node(self, path, with_children=False)
Get a File or Directory node.
source code
 
set_file_public(self, path, public=True)
Make a file public.
source code
 
move_node(self, path, new_path)
Move a node from one path to the other.
source code
 
make_volume(self, path)
Create a new Volume (aka UDF).
source code
 
get_volume(self, path)
Get a Volume.
source code
 
delete_volume(self, path)
Get a Volume.
source code
 
get_volumes(self)
Get a list of all Volumes.
source code
 
load(self)
Reload this User Resource.
source code
 
download_file(self, path, destination=None)
Download a file.
source code
 
upload_file(self, file_name, path)
Download a file.
source code

Inherited from object: __delattr__, __format__, __getattribute__, __hash__, __new__, __reduce__, __reduce_ex__, __repr__, __setattr__, __sizeof__, __str__, __subclasshook__

Class Variables [hide private]
  resource_path = None
Properties [hide private]

Inherited from object: __class__

Method Details [hide private]

__init__(self, res_json, resource_client, content_client)
(Constructor)

source code 

x.__init__(...) initializes x; see help(type(x)) for signature

Overrides: object.__init__
(inherited documentation)

get(self, path, params=None)

source code 

GET a resource.

Parameters:
  • path - The path of the resource relative to the base API.
  • params - Optionally a dictionary of querystring values.

put(self, path, data=None, params=None)

source code 

PUT a resource.

Parameters:
  • path - The path of the resource relative to the base API.
  • data - A JSON Serializable object sent in the PUT
  • params - Optionally a dictionary of querystring values.

delete(self, path, params=None)

source code 

DELETE a resource. .

Parameters:
  • path - The path of the resource relative to the base API.
  • params - Optionally a dictionary of querystring values.

make_file(self, path)

source code 

Make a File.

Parameters:
  • path - The path of the file using the <volume path>/<node path>. For example ~/Ubuntu One/a/b/c/file.txt

make_directory(self, path)

source code 

Make a Directory.

Parameters:
  • path - The path of the file using the <volume path>/<node path>. For example ~/Ubuntu One/a/b/c/dirname

get_node(self, path, with_children=False)

source code 

Get a File or Directory node.

Parameters:
  • path - The path of the file using the <volume path>/<node path>. For example ~/Ubuntu One/a/b/c/dirname
  • with_children - If True, the children property of the directory will be filled with Node Resources of the direct children.

set_file_public(self, path, public=True)

source code 

Make a file public.

Parameters:
  • path - The path of the file using the <volume path>/<node path>. For example ~/Ubuntu One/a/b/c/file.txt
  • public - If True the file will be published else it will be unpublished. Defaults to True.

move_node(self, path, new_path)

source code 

Move a node from one path to the other.

The new_path is a path relative path within the volume.

download_file(self, path, destination=None)

source code 

Download a file.

Parameters:
  • destination - The local directory to download the file to.