Class SpazImageUploader

Defined in: spazimageuploader.js.

Class Summary
Constructor Attributes Constructor Name and Description
 

An image uploader library for SpazCore.

Field Summary
Field Attributes Field Name and Description
 

a hash of service objects.

Method Summary
Method Attributes Method Name and Description
 

Retrieves the auth_header

 

returns an array of labels for the services

 
setOpts(opts)

this lets us set options after instantiation

 

this actually does the upload.

Class Detail

SpazImageUploader(opts)

An image uploader library for SpazCore. Probably this will supercede spazfileuploader.js

Parameters:
{object} opts Optional
options hash
{object} opts.auth_obj Optional
A SpazAuth object that's filled with proper authentication info
{string} opts.username Optional
a username, in case we're doing that kind of thing
{string} opts.password Optional
a password, in case we're doing that kind of thing
{string} opts.auth_method Optional
the method of authentication: 'echo' or 'basic'. Default is 'echo'
{object} opts.extra Optional
Extra params to pass in the upload request
Field Detail

services

a hash of service objects. Each object has a URL endpoint, a parseResponse callback, and an optional "extra" set of params to pass on upload parseResponse should return one of these key/val pairs: - {'url':'http://foo.bar/XXXX'} - {'error':'Error message'}

Method Detail

getAuthHeader()

Retrieves the auth_header

getServiceLabels()

returns an array of labels for the services

Returns:
array

setOpts(opts)

this lets us set options after instantiation

Parameters:
{object} opts
options hash
{object} opts.auth_obj Optional
A SpazAuth object that's filled with proper authentication info
{string} opts.username Optional
a username, in case we're doing that kind of thing
{string} opts.password Optional
a password, in case we're doing that kind of thing
{string} opts.auth_method Optional
the method of authentication: 'echo' or 'basic'. Default is 'echo'
{string} opts.statusnet_api_base Optional
the api base URL for statusnet, if that service is used
{object} opts.extra Optional
Extra params to pass in the upload request

upload()

this actually does the upload. Well, really it preps the data and uses sc.helpers.HTTPFileUpload