Zend Framework  1.12
Public Member Functions | Public Attributes | Protected Attributes | Static Protected Attributes | List of all members
Zend_Service_Delicious Class Reference

Public Member Functions

 __construct ($uname=null, $pass=null)
 Constructs a new del.icio.us Web Services Client.
 
 setAuth ($uname, $pass)
 Set client username and password.
 
 getLastUpdate ()
 Get time of the last update.
 
 getTags ()
 Get all tags, returning an array with tags as keys and number of corresponding posts as values.
 
 renameTag ($old, $new)
 Rename a tag.
 
 getBundles ()
 Get all bundles, returning an array with bundles as keys and array of tags as values.
 
 addBundle ($bundle, array $tags)
 Adds a new bundle.
 
 deleteBundle ($bundle)
 Delete a bundle.
 
 deletePost ($url)
 Delete a post.
 
 getDates ($tag=null)
 Get number of posts by date.
 
 getPosts ($tag=null, Zend_Date $dt=null, $url=null)
 Get posts matching the arguments.
 
 getAllPosts ($tag=null)
 Get all posts.
 
 getRecentPosts ($tag=null, $count=15)
 Get recent posts.
 
 createNewPost ($title, $url)
 Create new post.
 
 getUserPosts ($user, $count=null, $tag=null)
 Get posts of a user.
 
 getUserTags ($user, $atleast=null, $count=null, $sort= 'alpha')
 Get tags of a user.
 
 getUserNetwork ($user)
 Get network of a user.
 
 getUserFans ($user)
 Get fans of a user.
 
 getUrlDetails ($url)
 Get details on a particular bookmarked URL.
 
 makeRequest ($path, array $parms=array(), $type= 'xml')
 Handles all GET requests to a web service.
 

Public Attributes

const API_URI = 'https://api.del.icio.us'
 
const PATH_UPDATE = '/v1/posts/update'
 
const PATH_TAGS = '/v1/tags/get'
 
const PATH_TAG_RENAME = '/v1/tags/rename'
 
const PATH_BUNDLES = '/v1/tags/bundles/all'
 
const PATH_BUNDLE_DELETE = '/v1/tags/bundles/delete'
 
const PATH_BUNDLE_ADD = '/v1/tags/bundles/set'
 
const PATH_DATES = '/v1/posts/dates'
 
const PATH_POST_DELETE = '/v1/posts/delete'
 
const PATH_POSTS_GET = '/v1/posts/get'
 
const PATH_POSTS_ALL = '/v1/posts/all'
 
const PATH_POSTS_ADD = '/v1/posts/add'
 
const PATH_POSTS_RECENT = '/v1/posts/recent'
 
const JSON_URI = 'http://del.icio.us'
 
const JSON_POSTS = '/feeds/json/%s/%s'
 
const JSON_TAGS = '/feeds/json/tags/%s'
 
const JSON_NETWORK = '/feeds/json/network/%s'
 
const JSON_FANS = '/feeds/json/fans/%s'
 
const JSON_URL = '/feeds/json/url/data'
 

Protected Attributes

 $_rest
 
 $_authUname
 
 $_authPass
 

Static Protected Attributes

static $_lastRequestTime = 0
 

Constructor & Destructor Documentation

__construct (   $uname = null,
  $pass = null 
)

Constructs a new del.icio.us Web Services Client.

Parameters
string$unameClient username
string$passClient password
Returns
void

Member Function Documentation

addBundle (   $bundle,
array  $tags 
)

Adds a new bundle.

Parameters
string$bundleName of new bundle
array$tagsArray of tags
Returns
Zend_Service_Delicious Provides a fluent interface
createNewPost (   $title,
  $url 
)

Create new post.

Returns
Zend_Service_Delicious_Post
deleteBundle (   $bundle)

Delete a bundle.

Parameters
string$bundleName of bundle to be deleted
Returns
Zend_Service_Delicious Provides a fluent interface
deletePost (   $url)

Delete a post.

Parameters
string$urlURL of post to be deleted
Returns
Zend_Service_Delicious Provides a fluent interface
getAllPosts (   $tag = null)

Get all posts.

Parameters
string$tagOptional filtering by tag
Returns
Zend_Service_Delicious_PostList
getBundles ( )

Get all bundles, returning an array with bundles as keys and array of tags as values.

Returns
array list of bundles
getDates (   $tag = null)

Get number of posts by date.

Returns array where keys are dates and values are numbers of posts

Parameters
string$tagOptional filtering by tag
Returns
array list of dates
getLastUpdate ( )

Get time of the last update.

Exceptions
Zend_Service_Delicious_Exception
Returns
Zend_Date
Todo:
replace strtotime() with Zend_Date equivalent
See Also
Zend_Service_Delicious_Exception
getPosts (   $tag = null,
Zend_Date  $dt = null,
  $url = null 
)

Get posts matching the arguments.

If no date or url is given, most recent date will be used

Parameters
string$tagOptional filtering by tag
Zend_Date$dtOptional filtering by date
string$urlOptional filtering by url
Exceptions
Zend_Service_Delicious_Exception
Returns
Zend_Service_Delicious_PostList
getRecentPosts (   $tag = null,
  $count = 15 
)

Get recent posts.

Parameters
string$tagOptional filtering by tag
string$countMaximum number of posts to be returned (default 15)
Returns
Zend_Service_Delicious_PostList
getTags ( )

Get all tags, returning an array with tags as keys and number of corresponding posts as values.

Returns
array list of tags
getUrlDetails (   $url)

Get details on a particular bookmarked URL.

Returned array contains four elements:

  • hash - md5 hash of URL
  • top_tags - array of tags and their respective usage counts
  • url - URL for which details were returned
  • total_posts - number of users that have bookmarked URL

If URL hasen't been bookmarked null is returned.

Parameters
string$urlURL for which to get details
Returns
array
getUserFans (   $user)

Get fans of a user.

Parameters
string$userOwner of the fans
Returns
array
getUserNetwork (   $user)

Get network of a user.

Parameters
string$userOwner of the network
Returns
array
getUserPosts (   $user,
  $count = null,
  $tag = null 
)

Get posts of a user.

Parameters
string$userOwner of the posts
int$countNumber of posts (default 15, max. 100)
string$tagOptional filtering by tag
Returns
Zend_Service_Delicious_PostList
getUserTags (   $user,
  $atleast = null,
  $count = null,
  $sort = 'alpha' 
)

Get tags of a user.

Returned array has tags as keys and number of posts as values

Parameters
string$userOwner of the posts
int$atleastInclude only tags for which there are at least ### number of posts
int$countNumber of tags to get (default all)
string$sortOrder of returned tags ('alpha' || 'count')
Returns
array
makeRequest (   $path,
array  $parms = array(),
  $type = 'xml' 
)

Handles all GET requests to a web service.

Parameters
string$pathPath
array$parmsArray of GET parameters
string$typeType of a request ("xml"|"json")
Returns
mixed decoded response from web service
Exceptions
Zend_Service_Delicious_Exception
See Also
Zend_Service_Delicious_Exception
Zend_Service_Delicious_Exception
Zend_Service_Delicious_Exception
renameTag (   $old,
  $new 
)

Rename a tag.

Parameters
string$oldOld tag name
string$newNew tag name
Returns
Zend_Service_Delicious Provides a fluent interface
setAuth (   $uname,
  $pass 
)

Set client username and password.

Parameters
string$unameClient user name
string$passClient password
Returns
Zend_Service_Delicious Provides a fluent interface

Member Data Documentation

$_authPass
protected
$_authUname
protected
$_lastRequestTime = 0
staticprotected
$_rest
protected
const API_URI = 'https://api.del.icio.us'
const JSON_FANS = '/feeds/json/fans/%s'
const JSON_NETWORK = '/feeds/json/network/%s'
const JSON_POSTS = '/feeds/json/%s/%s'
const JSON_TAGS = '/feeds/json/tags/%s'
const JSON_URI = 'http://del.icio.us'
const JSON_URL = '/feeds/json/url/data'
const PATH_BUNDLE_ADD = '/v1/tags/bundles/set'
const PATH_BUNDLE_DELETE = '/v1/tags/bundles/delete'
const PATH_BUNDLES = '/v1/tags/bundles/all'
const PATH_DATES = '/v1/posts/dates'
const PATH_POST_DELETE = '/v1/posts/delete'
const PATH_POSTS_ADD = '/v1/posts/add'
const PATH_POSTS_ALL = '/v1/posts/all'
const PATH_POSTS_GET = '/v1/posts/get'
const PATH_POSTS_RECENT = '/v1/posts/recent'
const PATH_TAG_RENAME = '/v1/tags/rename'
const PATH_TAGS = '/v1/tags/get'
const PATH_UPDATE = '/v1/posts/update'