Skip to content

Commit

Permalink
Merge pull request #2 from gonzaloserrano/feature/BC-909/GetJsonsById
Browse files Browse the repository at this point in the history
Add gettting spreadsheets by id
  • Loading branch information
adanlobato committed Mar 6, 2014
2 parents f8b2d61 + f926fdc commit 28fe303
Showing 1 changed file with 22 additions and 8 deletions.
30 changes: 22 additions & 8 deletions src/Google/Spreadsheet/Spreadsheet.php
Original file line number Diff line number Diff line change
Expand Up @@ -28,14 +28,14 @@ class Spreadsheet
{
/**
* The spreadsheet xml object
*
*
* @var \SimpleXMLElement
*/
private $xml;

/**
* Initializes the spreadsheet object
*
*
* @param string|\SimpleXMLElement $xml
*/
public function __construct($xml) {
Expand All @@ -47,7 +47,7 @@ public function __construct($xml) {

/**
* Get the spreadsheet xml
*
*
* @return \SimpleXMLElement
*/
public function getXml()
Expand All @@ -57,7 +57,7 @@ public function getXml()

/**
* Get all the worksheets which belong to this spreadsheet
*
*
* @return \Google\Spreadsheet\WorksheetFeed
*/
public function getWorksheets()
Expand All @@ -70,7 +70,7 @@ public function getWorksheets()

/**
* Add a new worksheet to this spreadsheet
*
*
* @param string $title
*
* @return \Google\Spreadsheet\Worksheet
Expand All @@ -97,7 +97,7 @@ public function addWorksheet($title, $rowCount=100, $colCount=10)

/**
* Returns the feed url of the spreadsheet
*
*
* @return string
*/
public function getFeedUrl() {
Expand All @@ -106,11 +106,25 @@ public function getFeedUrl() {

/**
* Returns the title (name) of the spreadsheet
*
*
* @return string
*/
public function getTitle() {
return $this->xml->title->__toString();
}

}

/**
* Returns the id of the spreadsheet
*
* @return string
*/
public function getId()
{
return str_replace(
'https://spreadsheets.google.com/feeds/spreadsheets/private/full/',
'',
$this->xml->id->__toString()
);
}
}

0 comments on commit 28fe303

Please sign in to comment.