Service/Delicious.php

Show: PublicProtectedPrivateinherited
Table of Contents
Zend Framework
LICENSE This source file is subject to the new BSD license that is bundled with this package in the file LICENSE.txt. It is also available through the world-wide-web at this URL: http://framework.zend.com/license/new-bsd If you did not receive a copy of the license and are unable to obtain it through the world-wide-web, please send an email to license@zend.com so we can send you a copy immediately.
Category
Zend  
Copyright
Copyright (c) 2005-2014 Zend Technologies USA Inc. (http://www.zend.com)  
License
New BSD License  
Package
Zend_Service  
Subpackage
Delicious  
Version
$Id$  

\Zend_Service_Delicious

Package: Zend_Service\Delicious
Zend_Service_Delicious is a concrete implementation of the del.icio.us web service
Category
Zend  
Copyright
Copyright (c) 2005-2014 Zend Technologies USA Inc. (http://www.zend.com)  
License
New BSD License  

Constants

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

Properties

>VPropertyprotectedstring $_authPass
Password
Details
Type
string
>VPropertyprotectedstring $_authUname
Username
Details
Type
string
>VPropertyprotectedfloat $_lastRequestTime = 0
static
Microtime of last request
Default value0Details
Type
float
>VPropertyprotected\Zend_Service_Rest $_rest
Zend_Service_Rest instance

Methods

methodpublic__construct(string $uname = null, string $pass = null) : void

Constructs a new del.icio.us Web Services Client

Parameters
NameTypeDescription
$unamestring

Client username

$passstring

Client password

methodprivate_evalXmlResult(\DOMDocument $response) : void
static

Evaluates XML response

Parameters
NameTypeDescription
$response\DOMDocument
Throws
ExceptionDescription
\Zend_Service_Delicious_Exception
methodprivate_parseXmlPostList(\DOMDocument $response) : \Zend_Service_Delicious_PostList

Constructs Zend_Service_Delicious_PostList from XML response

Parameters
NameTypeDescription
$response\DOMDocument
Returns
TypeDescription
\Zend_Service_Delicious_PostList
Throws
ExceptionDescription
\Zend_Service_Delicious_Exception
methodprivate_xmlResponseToArray(\DOMDocument $response, string $root, string $child, string $attKey, string $attValue) : array
static

Transform XML string to array

Parameters
NameTypeDescription
$response\DOMDocument
$rootstring

Name of root tag

$childstring

Name of children tags

$attKeystring

Attribute of child tag to be used as a key

$attValuestring

Attribute of child tag to be used as a value

Returns
TypeDescription
array
Throws
ExceptionDescription
\Zend_Service_Delicious_Exception
methodpublicaddBundle(string $bundle, array $tags) : \Zend_Service_Delicious

Adds a new bundle

Parameters
NameTypeDescription
$bundlestring

Name of new bundle

$tagsarray

Array of tags

Returns
TypeDescription
\Zend_Service_DeliciousProvides a fluent interface
methodpubliccreateNewPost( $title,  $url) : \Zend_Service_Delicious_Post

Create new post

Parameters
NameTypeDescription
$title
$url
Returns
TypeDescription
\Zend_Service_Delicious_Post
methodpublicdeleteBundle(string $bundle) : \Zend_Service_Delicious

Delete a bundle

Parameters
NameTypeDescription
$bundlestring

Name of bundle to be deleted

Returns
TypeDescription
\Zend_Service_DeliciousProvides a fluent interface
methodpublicdeletePost(string $url) : \Zend_Service_Delicious

Delete a post

Parameters
NameTypeDescription
$urlstring

URL of post to be deleted

Returns
TypeDescription
\Zend_Service_DeliciousProvides a fluent interface
methodpublicgetAllPosts(string $tag = null) : \Zend_Service_Delicious_PostList

Get all posts

Parameters
NameTypeDescription
$tagstring

Optional filtering by tag

Returns
TypeDescription
\Zend_Service_Delicious_PostList
methodpublicgetBundles() : array

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

Returns
TypeDescription
arraylist of bundles
methodpublicgetDates(string $tag = null) : array

Get number of posts by date

Returns array where keys are dates and values are numbers of posts
Parameters
NameTypeDescription
$tagstring

Optional filtering by tag

Returns
TypeDescription
arraylist of dates
methodpublicgetLastUpdate() : \Zend_Date

Get time of the last update

Returns
TypeDescription
\Zend_Date
Throws
ExceptionDescription
\Zend_Service_Delicious_Exception
methodpublicgetPosts(string $tag = null, \Zend_Date $dt = null, string $url = null) : \Zend_Service_Delicious_PostList

Get posts matching the arguments

If no date or url is given, most recent date will be used
Parameters
NameTypeDescription
$tagstring

Optional filtering by tag

$dt\Zend_Date

Optional filtering by date

$urlstring

Optional filtering by url

Returns
TypeDescription
\Zend_Service_Delicious_PostList
Throws
ExceptionDescription
\Zend_Service_Delicious_Exception
methodpublicgetRecentPosts(string $tag = null, string $count = 15) : \Zend_Service_Delicious_PostList

Get recent posts

Parameters
NameTypeDescription
$tagstring

Optional filtering by tag

$countstring

Maximum number of posts to be returned (default 15)

Returns
TypeDescription
\Zend_Service_Delicious_PostList
methodpublicgetTags() : array

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

Returns
TypeDescription
arraylist of tags
methodpublicgetUrlDetails(string $url) : array

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
NameTypeDescription
$urlstring

URL for which to get details

Returns
TypeDescription
array
methodpublicgetUserFans(string $user) : array

Get fans of a user

Parameters
NameTypeDescription
$userstring

Owner of the fans

Returns
TypeDescription
array
methodpublicgetUserNetwork(string $user) : array

Get network of a user

Parameters
NameTypeDescription
$userstring

Owner of the network

Returns
TypeDescription
array
methodpublicgetUserPosts(string $user, int $count = null, string $tag = null) : \Zend_Service_Delicious_PostList

Get posts of a user

Parameters
NameTypeDescription
$userstring

Owner of the posts

$countint

Number of posts (default 15, max. 100)

$tagstring

Optional filtering by tag

Returns
TypeDescription
\Zend_Service_Delicious_PostList
methodpublicgetUserTags(string $user, int $atleast = null, int $count = null, string $sort = 'alpha') : array

Get tags of a user

Returned array has tags as keys and number of posts as values
Parameters
NameTypeDescription
$userstring

Owner of the posts

$atleastint

Include only tags for which there are at least ### number of posts

$countint

Number of tags to get (default all)

$sortstring

Order of returned tags ('alpha' || 'count')

Returns
TypeDescription
array
methodpublicmakeRequest(string $path, array $parms = array(), string $type = 'xml') : mixed

Handles all GET requests to a web service

Parameters
NameTypeDescription
$pathstring

Path

$parmsarray

Array of GET parameters

$typestring

Type of a request ("xml"|"json")

Returns
TypeDescription
mixeddecoded response from web service
Throws
ExceptionDescription
\Zend_Service_Delicious_Exception
methodpublicrenameTag(string $old, string $new) : \Zend_Service_Delicious

Rename a tag

Parameters
NameTypeDescription
$oldstring

Old tag name

$newstring

New tag name

Returns
TypeDescription
\Zend_Service_DeliciousProvides a fluent interface
methodpublicsetAuth(string $uname, string $pass) : \Zend_Service_Delicious

Set client username and password

Parameters
NameTypeDescription
$unamestring

Client user name

$passstring

Client password

Returns
TypeDescription
\Zend_Service_DeliciousProvides a fluent interface
Documentation was generated by phpDocumentor 2.2.0 .