API Documentation

Zend/Gdata/Docs.php

Show: inherited
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-2012 Zend Technologies USA Inc. (http://www.zend.com)  
License
New BSD License  
Package
Zend_Gdata  
Subpackage
Docs  
Version
$Id: Docs.php 24593 2012-01-05 20:35:02Z matthew $  

\Zend_Gdata_Docs

Package: Zend\Gdata\Docs

Service class for interacting with the Google Document List data API

Parent(s)
\Zend_Gdata < \Zend_Gdata_App
Category
Zend  
Copyright
Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)  
License
New BSD License  
Link
http://code.google.com/apis/documents/  

Constants

Constant  DOCUMENTS_LIST_FEED_URI = 'https://docs.google.com/feeds/documents/private/full'
Constant  DOCUMENTS_FOLDER_FEED_URI = 'https://docs.google.com/feeds/folders/private/full'
Constant  DOCUMENTS_CATEGORY_SCHEMA = 'http://schemas.google.com/g/2005#kind'
Constant  DOCUMENTS_CATEGORY_TERM = 'http://schemas.google.com/docs/2007#folder'
Constant  AUTH_SERVICE_NAME = 'writely'

Properties

Propertyprivate  $SUPPORTED_FILETYPES= 'array( 'TXT'=>'text/plain''
static
Default valuearray( 'TXT'=>'text/plain'Details
Type
Propertyprotected  $_defaultPostUri= 'self::DOCUMENTS_LIST_FEED_URI'
Default valueself::DOCUMENTS_LIST_FEED_URIDetails
Type

Methods

methodpublic__construct( \Zend_Http_Client $client = null, string $applicationId = 'MyCompany-MyApp-1.0' ) : void

Create Gdata_Docs object

Parameters
Name Type Description
$client \Zend_Http_Client

(optional) The HTTP client to use when when communicating with the Google servers.

$applicationId string

The identity of the app in the form of Company-AppName-Version

methodpubliccreateFolder( string $folderName, string|null $folderResourceId = null ) : \Zend_Gdata_Entry

Creates a new folder in Google Docs

Parameters
Name Type Description
$folderName string

The folder name to create

$folderResourceId string|null

The parent folder to create it in ("folder%3Amy_parent_folder")

Returns
Type Description
\Zend_Gdata_Entry The folder entry created.
Details
Todo
ZF-8732: This should return a *subclass* of Zend_Gdata_Entry, but the appropriate type doesn't exist yet.  
methodpublicgetDoc( string $docId, string $docType ) : \Zend_Gdata_Docs_DocumentListEntry

Retreive entry object representing a single document.

This method builds the URL where this item is stored using the type and the id of the document.

Parameters
Name Type Description
$docId string

The URL key for the document. Examples: dcmg89gw_62hfjj8m, pKq0CzjiF3YmGd0AIlHKqeg

$docType string

The type of the document as used in the Google Document List URLs. Examples: document, spreadsheet, presentation

Returns
Type Description
\Zend_Gdata_Docs_DocumentListEntry
methodpublicgetDocument( string $id ) : void

Retreive entry object for the desired word processing document.

Parameters
Name Type Description
$id string

The URL id for the document. Example: dcmg89gw_62hfjj8m

methodpublicgetDocumentListEntry( mixed $location = null ) : \Zend_Gdata_Docs_DocumentListEntry

Retreive entry object representing a single document.

Parameters
Name Type Description
$location mixed

The location for the entry, as a URL or Query

Returns
Type Description
\Zend_Gdata_Docs_DocumentListEntry
methodpublicgetDocumentListFeed( mixed $location = null ) : \Zend_Gdata_Docs_DocumentListFeed

Retreive feed object containing entries for the user's documents.

Parameters
Name Type Description
$location mixed

The location for the feed, as a URL or Query

Returns
Type Description
\Zend_Gdata_Docs_DocumentListFeed
methodpublicgetPresentation( string $id ) : void

Retreive entry object for the desired presentation.

Parameters
Name Type Description
$id string

The URL id for the document. Example: dcmg89gw_21gtrjcn

methodpublicgetSpreadsheet( string $id ) : void

Retreive entry object for the desired spreadsheet.

Parameters
Name Type Description
$id string

The URL id for the document. Example: pKq0CzjiF3YmGd0AIlHKqeg

methodpublicinsertDocument( mixed $data, string $uri, string $className = 'Zend_Gdata_Docs_DocumentListEntry' ) : \Zend_Gdata_Docs_DocumentListEntry

Inserts an entry to a given URI and returns the response as an Entry.

Parameters
Name Type Description
$data mixed

The Zend_Gdata_Docs_DocumentListEntry or media source to post. If it is a DocumentListEntry, the mediaSource should already have been set. If $data is a mediaSource, it should have the correct slug header and mime type.

$uri string

POST URI

$className string

(optional) The class of entry to be returned. The default is a 'Zend_Gdata_Docs_DocumentListEntry'.

Returns
Type Description
\Zend_Gdata_Docs_DocumentListEntry The entry returned by the service after insertion.
methodpubliclookupMimeType( string $fileExtension ) : string
static

Looks up the mime type based on the file name extension. For example, calling this method with 'csv' would return 'text/comma-separated-values'. The Mime type is sent as a header in the upload HTTP POST request.

Parameters
Name Type Description
$fileExtension string
Returns
Type Description
string The mime type to be sent to the server to tell it how the multipart mime data should be interpreted.
methodpublicuploadFile( string $fileLocation, string $title = null, string $mimeType = null, string $uri = null ) : \Zend_Gdata_Docs_DocumentListEntry

Upload a local file to create a new Google Document entry.

Parameters
Name Type Description
$fileLocation string

The full or relative path of the file to be uploaded.

$title string

The name that this document should have on the server. If set, the title is used as the slug header in the POST request. If no title is provided, the location of the file will be used as the slug header in the request. If no mimeType is provided, this method attempts to determine the mime type based on the slugHeader by looking for .doc, .csv, .txt, etc. at the end of the file name. Example value: 'test.doc'.

$mimeType string

Describes the type of data which is being sent to the server. This must be one of the accepted mime types which are enumerated in SUPPORTED_FILETYPES.

$uri string

(optional) The URL to which the upload should be made. Example: 'https://docs.google.com/feeds/documents/private/full'.

Returns
Type Description
\Zend_Gdata_Docs_DocumentListEntry The entry for the newly created Google Document.
Documentation was generated by DocBlox 0.15.1.