Documentation

Horde_Service_Scribd
in package

Scribd client class

Tags
author

Chuck Hagenbuch chuck@horde.org

license

http://www.horde.org/licenses/bsd BSD

category

Horde

Table of Contents

ENDPOINT  = 'http://api.scribd.com/api'
$_config  : array<string|int, mixed>
$_httpClient  : Horde_Http_Client
HTTP client object to use for accessing the Scribd API.
__construct()  : mixed
Constructor
changeSettings()  : true
Change a document's settings.
delete()  : true
Delete a document.
getConversionStatus()  : string
Get the current conversion status of a document.
getHttpClient()  : Horde_Http_Client
Gets the HTTP client object.
getList()  : Traversable
Return an iterator over the authorized user's documents.
getSettings()  : array<string|int, mixed>
Get a document's settings
login()  : array<string|int, mixed>
Log in as a user
newRequest()  : Horde_Service_Scribd_Request
Create an API request for $method with $args
search()  : array<string|int, mixed>
Search the Scribd database
setHttpClient()  : mixed
Set the HTTP client instance
signup()  : array<string|int, mixed>
Sign up a new user
upload()  : array<string|int, mixed>
Upload a local file.
uploadFromUrl()  : array<string|int, mixed>
Upload a document from a publicly accessible URL.

Constants

ENDPOINT

public mixed ENDPOINT = 'http://api.scribd.com/api'

Properties

$_config

protected array<string|int, mixed> $_config = array()

$_httpClient

HTTP client object to use for accessing the Scribd API.

protected static Horde_Http_Client $_httpClient = ull

Methods

changeSettings()

Change a document's settings.

public changeSettings(mixed $docIds, array<string|int, mixed> $settings) : true
Parameters
$docIds : mixed

One or more document ids to change.

$settings : array<string|int, mixed>

The values to set for each $docId. Possible keys: title: string description: string access: ["public", "private"] license: ["by", "by-nc", "by-nc-nd", "by-nc-sa", "by-nd", "by-sa", "c", "pd" show_ads: ["default", "true", "false"] link_back_url: string tags: comma-separated stringlist (or PHP array)

Return values
true

delete()

Delete a document.

public delete(int $docId) : true
Parameters
$docId : int

The document to delete

Return values
true

getConversionStatus()

Get the current conversion status of a document.

public getConversionStatus(int $docId) : string
Parameters
$docId : int

Document id to get status for

Return values
string

"DISPLAYABLE", "DONE", "ERROR", or "PROCESSING"

getHttpClient()

Gets the HTTP client object.

public static getHttpClient() : Horde_Http_Client
Return values
Horde_Http_Client

getList()

Return an iterator over the authorized user's documents.

public getList() : Traversable
Return values
Traversable

getSettings()

Get a document's settings

public getSettings(int $docId) : array<string|int, mixed>
Parameters
$docId : int

Document id to get status for

Return values
array<string|int, mixed>

[doc_id, title, description, access, license, tags[], show_ads, access_key, thumbnail_url, secret_password]

login()

Log in as a user

public login(string $username, string $password) : array<string|int, mixed>
Parameters
$username : string

: username of user to log in

$password : string

: password of user to log in

Return values
array<string|int, mixed>

containing session_key, name, username, and user_id of the user

Search the Scribd database

public search(string $query[, int $num_results = null ][, int $num_start = null ][, string $scope = null ]) : array<string|int, mixed>
Parameters
$query : string

: search query

$num_results : int = null

: number of results to return (10 default, 1000 max)

$num_start : int = null

: number to start from

$scope : string = null

: scope of search, "all" or "user"

Return values
array<string|int, mixed>

of results, each of which contain doc_id, secret password, access_key, title, and description

setHttpClient()

Set the HTTP client instance

public static setHttpClient(Horde_Http_Client $httpClient) : mixed

Sets the HTTP client object to use for Scribd requests. If none is set, the default Horde_Http_Client will be used.

Parameters
$httpClient : Horde_Http_Client
Return values
mixed

signup()

Sign up a new user

public signup(string $username, string $password, string $email[, string $name = null ]) : array<string|int, mixed>
Parameters
$username : string

: username of user to create

$password : string

: password of user to create

$email : string

: email address of user

$name : string = null

: name of user

Return values
array<string|int, mixed>

containing session_key, name, username, and user_id of the user

upload()

Upload a local file.

public upload(string $file[, mixed $doc_type = null ][, string $access = null ][, mixed $revId = null ]) : array<string|int, mixed>
Parameters
$file : string

Local file

$doc_type : mixed = null
$access : string = null

Document visibility. 'public' or 'private', default 'public'

$revId : mixed = null
Return values
array<string|int, mixed>

[doc_id, access_key, [secret_password]]

uploadFromUrl()

Upload a document from a publicly accessible URL.

public uploadFromUrl(string $url[, mixed $doc_type = null ][, string $access = null ][, int $rev_id = null ]) : array<string|int, mixed>
Parameters
$url : string

Document location

$doc_type : mixed = null
$access : string = null

Document visibility. 'public' or 'private', default 'public'

$rev_id : int = null

The doc_id to save uploaded file as a revision to

Return values
array<string|int, mixed>

[doc_id, access_key, [secret_password]]

Search results