Skip to content

Commit

Permalink
Adding timezone first citizen for API
Browse files Browse the repository at this point in the history
  • Loading branch information
wtfzdotnet committed Apr 1, 2014
1 parent 4c20afe commit 78de26f
Show file tree
Hide file tree
Showing 4 changed files with 82 additions and 0 deletions.
21 changes: 21 additions & 0 deletions examples/timezones/api/get.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
<?php
/**
* This file is part of the Tmdb PHP API created by Michael Roterman.
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*
* @package Tmdb
* @author Michael Roterman <[email protected]>
* @copyright (c) 2013, Michael Roterman
* @version 0.0.1
*/
require_once '../../../vendor/autoload.php';
require_once '../../../apikey.php';

$token = new \Tmdb\ApiToken(TMDB_API_KEY);
$client = new \Tmdb\Client($token);

$timezones = $client->getTimezonesApi()->getTimezones();

var_dump($timezones);
22 changes: 22 additions & 0 deletions examples/timezones/model/get.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
<?php
/**
* This file is part of the Tmdb PHP API created by Michael Roterman.
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*
* @package Tmdb
* @author Michael Roterman <[email protected]>
* @copyright (c) 2013, Michael Roterman
* @version 0.0.1
*/
require_once '../../../vendor/autoload.php';
require_once '../../../apikey.php';

$token = new \Tmdb\ApiToken(TMDB_API_KEY);
$client = new \Tmdb\Client($token);

$repository = new \Tmdb\Repository\CollectionRepository($client);
$collection = $repository->load(10);

var_dump($collection);
31 changes: 31 additions & 0 deletions lib/Tmdb/Api/Timezones.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
<?php
/**
* This file is part of the Tmdb PHP API created by Michael Roterman.
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*
* @package Tmdb
* @author Michael Roterman <[email protected]>
* @copyright (c) 2013, Michael Roterman
* @version 0.0.1
*/
namespace Tmdb\Api;

/**
* Class Timezones
* @package Tmdb\Api
* @see http://docs.themoviedb.apiary.io/#timezones
*/
class Timezones extends AbstractApi
{
/**
* Get the list of supported timezones for the API methods that support them.
*
* @return mixed
*/
public function getTimezones()
{
return $this->get('timezones/list');
}
}
8 changes: 8 additions & 0 deletions lib/Tmdb/Client.php
Original file line number Diff line number Diff line change
Expand Up @@ -408,6 +408,14 @@ public function getCertificationsApi()
return new Api\Certifications($this);
}

/**
* @return Api\Timezones
*/
public function getTimezonesApi()
{
return new Api\Timezones($this);
}

/**
* @return HttpClient|HttpClientInterface
*/
Expand Down

0 comments on commit 78de26f

Please sign in to comment.