Services_Scribd
[ class tree: Services_Scribd ] [ index: Services_Scribd ] [ all elements ]

Class: Services_Scribd_Common

Source Location: /Services_Scribd-0.2.0/Services/Scribd/Common.php

Class Overview

Services_Scribd
   |
   --Services_Scribd_Common

This class contains common logic needed for all the API endpoints. Handles tasks such as sending requests, signing the requests, etc.


Author(s):

Copyright:

  • 2009 Rich Schumacher <rich.schu@gmail.com>

Variables

Methods


Child classes:

Services_Scribd_Dummy
Contains two simple methods that are only used to satisfy unit testing.
Services_Scribd_Collections
The interface for the "collections" API endpoints. Provides all interaction that is associated with a collection of documents, such as creating and deleting collections as well as adding and removing documents to those collections.
Services_Scribd_User
The interface for the "user" API endpoint. Allows the user to create an account and login to different accounts.
Services_Scribd_Docs
The interface for the "docs" API endpoint. Provides all interaction that is associated with a specific document or several documents, such as uploading, editing, etc.
Services_Scribd_Thumbnail
The interface for the "thumbnail" API endpoint. Allows the user to retrieve a URL to the thumbnail of a document in a given size.

Inherited Variables

Inherited Methods

Class: Services_Scribd

Services_Scribd::__construct()
Sets the API key and optional API secret
Services_Scribd::getAccount()
Returns the current account instance
Services_Scribd::setAccount()
Sets the Scribd account to use
Services_Scribd::__get()
Loads individual endpoint drivers

Class Details

[line 36]
This class contains common logic needed for all the API endpoints. Handles tasks such as sending requests, signing the requests, etc.


[ Top ]


Class Variables

$account =  null

[line 50]

The Scribd account to use for requests
  • Access: protected

Type:   Services_Scribd_Account
Overrides:   Array


[ Top ]

$arguments = array()

[line 43]

An array of arguments to send to the API
  • Access: protected

Type:   array


[ Top ]

$requestAdapter =  null

[line 57]

The HTTP request adapter to use
  • Access: protected

Type:   string|HTTP_Request2_Adapter


[ Top ]



Method Detail

__construct (Constructor)   [line 76]

void __construct( Services_Scribd_Account $account)

Prevents calls from bubbling up to Serices_Scribd::_construct()
  • Access: public

Overrides Services_Scribd::__construct() (Sets the API key and optional API secret)

Parameters:

Services_Scribd_Account   $account     The account to use

[ Top ]

call   [line 131]

mixed call( string $endpoint, [string $method = HTTP_Request2::METHOD_GET])

Builds, sends, and returns the response for an API request

Using curl, actually send the request to the Scribd API. Delegates to helper methods to format the arguments, send request, response, etc.

  • Throws: Services_Scribd_Exception
  • Access: protected

Parameters:

string   $endpoint     The requested endpoint
string   $method     The HTTP method to use, defaults to GET

[ Top ]

getAvailableEndpoints   [line 86]

array getAvailableEndpoints( )

Returns an array of endpoints for this driver
  • Access: public

[ Top ]

sendRequest   [line 156]

void sendRequest( string $uri, string $method)

Sends the request to the Scribd API
  • Throws: Services_Scribd_Exception
  • Access: protected

Parameters:

string   $uri     The API URI to request
string   $method     The HTTP method to use

[ Top ]

setRequestAdapter   [line 114]

void setRequestAdapter( $adapter)

Sets the request adapter to use for this request
  • Access: public

Parameters:

HTTP_Request2_Adapter   $adapter     An instance of th adapter

[ Top ]

__call   [line 100]

null __call( string $endpoint, $params)

Traps any requests to endpoints that are not defined
  • Throws: Services_Scribd_Exception
  • Access: public

Parameters:

string   $endpoint     The invalid endpoint requested
array   $params     Array of params for this endpoint

[ Top ]


Documentation generated on Sat, 06 Apr 2013 14:30:03 +0000 by phpDocumentor 1.4.3. PEAR Logo Copyright © PHP Group 2004.