diff --git a/.travis.yml b/.travis.yml index b014898..ff4e109 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,6 +1,5 @@ language: php php: - - 5.3 - 5.4 - 5.5 - 5.6 diff --git a/README.md b/README.md index ab4a7e2..d4d53db 100644 --- a/README.md +++ b/README.md @@ -19,6 +19,15 @@ and as such installable via [Composer](http://getcomposer.org/). If you do not use Composer, you can grab the code from GitHub, and use any PSR-0 compatible autoloader (e.g. the [Symfony2 ClassLoader component](https://github.com/symfony/ClassLoader)) to load the library's classes. +### Guzzle Versioning + +This package is compatible with different versions of Guzzle (see below): + +| Guzzle Version | Foursquare Client Version | +|----------------|---------------------------| +| ~3 | ~1 | +| ~4 | ~2 | + ### Composer example Add JcrollFoursquareApiBundle in your composer.json: @@ -26,7 +35,7 @@ Add JcrollFoursquareApiBundle in your composer.json: ```js { "require": { - "jcroll/foursquare-api-client": "~1" + "jcroll/foursquare-api-client": "~2" } } ``` @@ -48,16 +57,16 @@ require_once 'vendor/autoload.php'; ```php use Jcroll\FoursquareApiClient\Client\FoursquareClient; -$client = FoursquareClient::factory(array( +$client = FoursquareClient::factory([ 'client_id' => 'your_foursquare_client_id', // required 'client_secret' => 'your_foursquare_client_secret' // required -)); +]); $client->addToken($oauthToken); // optionally pass in for user specific requests -$command = $client->getCommand('venues/search', array( - 'near' => 'Chicago, IL', +$command = $client->getCommand('venues/search', [ + 'near' => 'Chicago, IL', 'query' => 'sushi' -)); -$results = $command->execute(); // returns an array of results +]); +$results = (array) $client->execute($command); // returns an array of results ``` You can find a list of the client's available commands in the bundle's @@ -67,6 +76,5 @@ they should be the same as the [api endpoints listed in the docs](https://develo ## Oauth Integration Endpoints in the foursquare API that are user specific will require authorization with foursquare using the Oauth 2.0 protocol. This type -of authorization is beyond the scope of this library as there are better libraries for that such as the [FriendsOfSymfony Oauth2 -Server](https://github.com/FriendsOfSymfony/oauth2-php). After authorization you can pass the access token into the client for user -specific access. +of authorization is beyond the scope of this library as there are better libraries for [that](https://packagist.org/search/?q=oauth). +After authorization you can pass the access token into the client for user specific access. \ No newline at end of file diff --git a/composer.json b/composer.json index 91b95a5..4ef5acf 100644 --- a/composer.json +++ b/composer.json @@ -12,11 +12,12 @@ } ], "require": { - "php": ">=5.3.3", - "guzzlehttp/guzzle": ">=3.7 <4.0" + "php": ">=5.4", + "guzzlehttp/guzzle": "~4", + "guzzlehttp/guzzle-services": "0.3" }, "require-dev": { - "phpunit/phpunit": "~4.8" + "phpunit/phpunit": "~4.8|^5" }, "autoload": { "psr-4": { diff --git a/composer.lock b/composer.lock index 76b7835..55d943b 100644 --- a/composer.lock +++ b/composer.lock @@ -4,71 +4,39 @@ "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#composer-lock-the-lock-file", "This file is @generated automatically" ], - "hash": "818922ed3ecbe59a133ba055b6619565", - "content-hash": "900ce516ab0e434c0750628d1c3777c2", + "hash": "d43f0afbe8308cc9c138cb3c8b4e973d", + "content-hash": "10166fdcf3c6118ec510502b9f46e4d3", "packages": [ { - "name": "guzzlehttp/guzzle", - "version": "v3.7.0", + "name": "guzzlehttp/command", + "version": "0.6.0", "source": { "type": "git", - "url": "https://github.com/guzzle/guzzle.git", - "reference": "0f2aad252b9c9120743dd475b383b1b6fb54c2f3" + "url": "https://github.com/guzzle/command.git", + "reference": "e2004b2ef217f14380f46bea9ebe8ecce3cecf7a" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/guzzle/guzzle/zipball/0f2aad252b9c9120743dd475b383b1b6fb54c2f3", - "reference": "0f2aad252b9c9120743dd475b383b1b6fb54c2f3", + "url": "https://api.github.com/repos/guzzle/command/zipball/e2004b2ef217f14380f46bea9ebe8ecce3cecf7a", + "reference": "e2004b2ef217f14380f46bea9ebe8ecce3cecf7a", "shasum": "" }, "require": { - "ext-curl": "*", - "php": ">=5.3.2", - "symfony/event-dispatcher": ">=2.1" - }, - "replace": { - "guzzle/batch": "self.version", - "guzzle/cache": "self.version", - "guzzle/common": "self.version", - "guzzle/http": "self.version", - "guzzle/inflection": "self.version", - "guzzle/iterator": "self.version", - "guzzle/log": "self.version", - "guzzle/parser": "self.version", - "guzzle/plugin": "self.version", - "guzzle/plugin-async": "self.version", - "guzzle/plugin-backoff": "self.version", - "guzzle/plugin-cache": "self.version", - "guzzle/plugin-cookie": "self.version", - "guzzle/plugin-curlauth": "self.version", - "guzzle/plugin-error-response": "self.version", - "guzzle/plugin-history": "self.version", - "guzzle/plugin-log": "self.version", - "guzzle/plugin-md5": "self.version", - "guzzle/plugin-mock": "self.version", - "guzzle/plugin-oauth": "self.version", - "guzzle/service": "self.version", - "guzzle/stream": "self.version" + "guzzlehttp/guzzle": "~4.0", + "php": ">=5.4.0" }, "require-dev": { - "doctrine/cache": "*", - "monolog/monolog": "1.*", - "phpunit/phpunit": "3.7.*", - "psr/log": "1.0.*", - "symfony/class-loader": "*", - "zendframework/zend-cache": "2.0.*", - "zendframework/zend-log": "2.0.*" + "phpunit/phpunit": "~4.0" }, "type": "library", "extra": { "branch-alias": { - "dev-master": "3.7-dev" + "dev-master": "0.6-dev" } }, "autoload": { - "psr-0": { - "Guzzle\\Tests": "tests/", - "Guzzle": "src/" + "psr-4": { + "GuzzleHttp\\Command\\": "src/" } }, "notification-url": "https://packagist.org/downloads/", @@ -80,10 +48,61 @@ "name": "Michael Dowling", "email": "mtdowling@gmail.com", "homepage": "https://github.com/mtdowling" + } + ], + "description": "Provides the foundation for building command based web service clients", + "time": "2014-08-08 16:41:48" + }, + { + "name": "guzzlehttp/guzzle", + "version": "4.2.4", + "source": { + "type": "git", + "url": "https://github.com/guzzle/guzzle.git", + "reference": "13a8e5acff26b0a87d353042170b48976da004a1" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/guzzle/guzzle/zipball/13a8e5acff26b0a87d353042170b48976da004a1", + "reference": "13a8e5acff26b0a87d353042170b48976da004a1", + "shasum": "" + }, + "require": { + "ext-json": "*", + "guzzlehttp/streams": "~2.1", + "php": ">=5.4.0" + }, + "require-dev": { + "ext-curl": "*", + "phpunit/phpunit": "~4.0", + "psr/log": "~1.0" + }, + "suggest": { + "ext-curl": "Guzzle will use specific adapters if cURL is present" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "4.2-dev" + } + }, + "autoload": { + "psr-4": { + "GuzzleHttp\\": "src/" }, + "files": [ + "src/functions.php" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ { - "name": "Guzzle Community", - "homepage": "https://github.com/guzzle/guzzle/contributors" + "name": "Michael Dowling", + "email": "mtdowling@gmail.com", + "homepage": "https://github.com/mtdowling" } ], "description": "Guzzle is a PHP HTTP client library and framework for building RESTful web service clients", @@ -97,43 +116,82 @@ "rest", "web service" ], - "time": "2013-06-11 00:24:07" + "time": "2016-07-15 17:44:18" }, { - "name": "symfony/event-dispatcher", - "version": "v2.1.0", - "target-dir": "Symfony/Component/EventDispatcher", + "name": "guzzlehttp/guzzle-services", + "version": "0.3.0", "source": { "type": "git", - "url": "https://github.com/symfony/event-dispatcher.git", - "reference": "421520fd35ace52106947b2d6c2d9db49cb5a866" + "url": "https://github.com/guzzle/guzzle-services.git", + "reference": "689dfa73b65e2c0a74184a5fb8c5a6ef0b160911" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/event-dispatcher/zipball/421520fd35ace52106947b2d6c2d9db49cb5a866", - "reference": "421520fd35ace52106947b2d6c2d9db49cb5a866", + "url": "https://api.github.com/repos/guzzle/guzzle-services/zipball/689dfa73b65e2c0a74184a5fb8c5a6ef0b160911", + "reference": "689dfa73b65e2c0a74184a5fb8c5a6ef0b160911", "shasum": "" }, "require": { - "php": ">=5.3.3" + "guzzlehttp/command": "~0.2", + "php": ">=5.4.0" }, "require-dev": { - "symfony/dependency-injection": "2.1.*" + "phpunit/phpunit": "~4.0" }, - "suggest": { - "symfony/dependency-injection": "v2.1.0", - "symfony/http-kernel": "v2.1.0" + "type": "library", + "autoload": { + "psr-4": { + "GuzzleHttp\\Command\\Guzzle\\": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Michael Dowling", + "email": "mtdowling@gmail.com", + "homepage": "https://github.com/mtdowling" + } + ], + "description": "Provides an implementation of the Guzzle Command library that uses Guzzle service descriptions to describe web services, serialize requests, and parse responses into easy to use model structures.", + "time": "2014-06-01 20:00:25" + }, + { + "name": "guzzlehttp/streams", + "version": "2.1.0", + "source": { + "type": "git", + "url": "https://github.com/guzzle/streams.git", + "reference": "f91b721d73f0e561410903b3b3c90a5d0e40b534" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/guzzle/streams/zipball/f91b721d73f0e561410903b3b3c90a5d0e40b534", + "reference": "f91b721d73f0e561410903b3b3c90a5d0e40b534", + "shasum": "" + }, + "require": { + "php": ">=5.4.0" + }, + "require-dev": { + "phpunit/phpunit": "~4.0" }, "type": "library", "extra": { "branch-alias": { - "dev-master": "2.1-dev" + "dev-master": "2.0-dev" } }, "autoload": { - "psr-0": { - "Symfony\\Component\\EventDispatcher": "" - } + "psr-4": { + "GuzzleHttp\\Stream\\": "src/" + }, + "files": [ + "src/functions.php" + ] }, "notification-url": "https://packagist.org/downloads/", "license": [ @@ -141,17 +199,18 @@ ], "authors": [ { - "name": "Symfony Community", - "homepage": "http://symfony.com/contributors" - }, - { - "name": "Fabien Potencier", - "email": "fabien@symfony.com" + "name": "Michael Dowling", + "email": "mtdowling@gmail.com", + "homepage": "https://github.com/mtdowling" } ], - "description": "Symfony EventDispatcher Component", - "homepage": "http://symfony.com", - "time": "2012-08-22 13:48:41" + "description": "Provides a simple abstraction over streams of data (Guzzle 4+)", + "homepage": "http://guzzlephp.org/", + "keywords": [ + "Guzzle", + "stream" + ], + "time": "2014-08-17 21:15:53" } ], "packages-dev": [ @@ -1110,6 +1169,60 @@ "homepage": "https://github.com/sebastianbergmann/version", "time": "2013-01-05 14:27:32" }, + { + "name": "symfony/event-dispatcher", + "version": "v2.1.0", + "target-dir": "Symfony/Component/EventDispatcher", + "source": { + "type": "git", + "url": "https://github.com/symfony/event-dispatcher.git", + "reference": "421520fd35ace52106947b2d6c2d9db49cb5a866" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/symfony/event-dispatcher/zipball/421520fd35ace52106947b2d6c2d9db49cb5a866", + "reference": "421520fd35ace52106947b2d6c2d9db49cb5a866", + "shasum": "" + }, + "require": { + "php": ">=5.3.3" + }, + "require-dev": { + "symfony/dependency-injection": "2.1.*" + }, + "suggest": { + "symfony/dependency-injection": "v2.1.0", + "symfony/http-kernel": "v2.1.0" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "2.1-dev" + } + }, + "autoload": { + "psr-0": { + "Symfony\\Component\\EventDispatcher": "" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Symfony Community", + "homepage": "http://symfony.com/contributors" + }, + { + "name": "Fabien Potencier", + "email": "fabien@symfony.com" + } + ], + "description": "Symfony EventDispatcher Component", + "homepage": "http://symfony.com", + "time": "2012-08-22 13:48:41" + }, { "name": "symfony/yaml", "version": "v2.1.0", @@ -1162,9 +1275,9 @@ "minimum-stability": "stable", "stability-flags": [], "prefer-stable": false, - "prefer-lowest": true, + "prefer-lowest": false, "platform": { - "php": ">=5.3.3" + "php": ">=5.4" }, "platform-dev": [] } diff --git a/src/Client/FoursquareClient.php b/src/Client/FoursquareClient.php index f0c073f..957fb5e 100644 --- a/src/Client/FoursquareClient.php +++ b/src/Client/FoursquareClient.php @@ -2,44 +2,40 @@ namespace Jcroll\FoursquareApiClient\Client; -use Guzzle\Common\Collection; -use Guzzle\Service\Client; -use Guzzle\Service\Description\ServiceDescription; -use Guzzle\Common\Exception\InvalidArgumentException; +use GuzzleHttp\Command\Guzzle\Description; +use GuzzleHttp\Command\Guzzle\GuzzleClient; +use GuzzleHttp\Client; -class FoursquareClient extends Client +class FoursquareClient extends GuzzleClient { /** * {@inheritdoc} */ - public static function factory($config = array()) + public static function factory($config = []) { - $default = array('base_url' => 'https://api.foursquare.com/v2/'); - - $required = array( - 'client_id', - 'client_secret', - ); + $required = ['client_id', 'client_secret']; foreach ($required as $value) { - if (empty($config[$value])) { - throw new InvalidArgumentException("Argument '{$value}' must not be blank."); + if (!isset($config[$value]) || !$config[$value]) { + throw new \InvalidArgumentException(sprintf('Argument "%s" is required.', $value)); } } - $config = Collection::fromConfig($config, $default, $required); - - $client = new self($config->get('base_url'), $config); - - $client->setDefaultOption('query', array( - 'client_id' => $config['client_id'], - 'client_secret' => $config['client_secret'], - 'v' => '20130707' - )); - - $client->setDescription(ServiceDescription::factory(__DIR__.'/../Resources/config/client.json')); - - return $client; + $client = new Client([ + 'base_url' => 'https://api.foursquare.com/v2/', + 'defaults' => [ + 'query' => [ + 'client_id' => $config['client_id'], + 'client_secret' => $config['client_secret'], + 'v' => '20130707' + ], + ] + ]); + + $contents = file_get_contents(sprintf('%s/../Resources/config/client.json', __DIR__)); + $description = new Description(json_decode($contents, true)); + + return new static($client, $description); } /** @@ -49,9 +45,9 @@ public static function factory($config = array()) */ public function addToken($token) { - $config = $this->getDefaultOption('query'); - $config = array_merge(array('oauth_token' => $token), $config); - $this->setDefaultOption('query', $config); + $query = $this->getHttpClient()->getDefaultOption('query'); + $query['oauth_token'] = $token; + $this->getHttpClient()->setDefaultOption('query', $query); return $this; } diff --git a/src/Resources/config/client.json b/src/Resources/config/client.json index 58f075b..2626b2a 100644 --- a/src/Resources/config/client.json +++ b/src/Resources/config/client.json @@ -1,4 +1,12 @@ { + "models": { + "getResponse": { + "type": "object", + "additionalProperties": { + "location": "json" + } + } + }, "operations": { "users": { "description": "Returns profile information for a given user, including selected badges and mayorships. The web profile for a user is visible at https://foursquare.com/user/USER_ID ", @@ -10,7 +18,8 @@ "required": true } }, - "uri": "users/{user_id}" + "uri": "users/{user_id}", + "responseModel": "getResponse" }, "users/leaderboard": { "description": "Returns the user's leaderboard.", @@ -21,12 +30,14 @@ "location": "query" } }, - "uri": "users/leaderboard" + "uri": "users/leaderboard", + "responseModel": "getResponse" }, "users/requests": { "description": "Shows a user the list of users with whom they have a pending friend request (i.e., someone tried to add the acting user as a friend, but the acting user has not accepted).", "httpMethod": "GET", - "uri": "users/requests" + "uri": "users/requests", + "responseModel": "getResponse" }, "users/search": { "description": "Helps a user locate friends.", @@ -57,12 +68,14 @@ "location": "query" } }, - "uri": "users/search" + "uri": "users/search", + "responseModel": "getResponse" }, "users/badges": { "description": "Returns badges for a given user.", "extends": "users", - "uri": "users/{user_id}/badges" + "uri": "users/{user_id}/badges", + "responseModel": "getResponse" }, "users/checkins": { "extends": "users", @@ -89,7 +102,8 @@ "location": "query" } }, - "uri": "users/{user_id}/checkins" + "uri": "users/{user_id}/checkins", + "responseModel": "getResponse" }, "users/friends": { "extends": "users", @@ -104,7 +118,8 @@ "location": "query" } }, - "uri": "users/{user_id}/friends" + "uri": "users/{user_id}/friends", + "responseModel": "getResponse" }, "users/lists": { "extends": "users", @@ -119,12 +134,14 @@ "location": "query" } }, - "uri": "users/{user_id}/lists" + "uri": "users/{user_id}/lists", + "responseModel": "getResponse" }, "users/mayorships": { "extends": "users", "description": "Returns a user's mayorships.", - "uri": "users/{user_id}/mayorships" + "uri": "users/{user_id}/mayorships", + "responseModel": "getResponse" }, "users/photos": { "extends": "users", @@ -139,7 +156,8 @@ "location": "query" } }, - "uri": "users/{user_id}/photos" + "uri": "users/{user_id}/photos", + "responseModel": "getResponse" }, "users/tips": { "extends": "users", @@ -163,7 +181,8 @@ "location": "query" } }, - "uri": "users/{user_id}/tips" + "uri": "users/{user_id}/tips", + "responseModel": "getResponse" }, "users/todos": { "extends": "users", @@ -178,7 +197,8 @@ "location": "query" } }, - "uri": "users/{user_id}/todos" + "uri": "users/{user_id}/todos", + "responseModel": "getResponse" }, "users/venuehistory": { "extends": "users", @@ -197,25 +217,29 @@ "location": "query" } }, - "uri": "users/{user_id}/venuehistory" + "uri": "users/{user_id}/venuehistory", + "responseModel": "getResponse" }, "users/approve": { "extends": "users", "description": "Approves a pending friend request from another user.", "httpMethod": "POST", - "uri": "users/{user_id}/approve" + "uri": "users/{user_id}/approve", + "responseModel": "getResponse" }, "users/deny": { "extends": "users", "description": "Denies a pending friend request from another user.", "httpMethod": "POST", - "uri": "users/{user_id}/deny" + "uri": "users/{user_id}/deny", + "responseModel": "getResponse" }, "users/request": { "extends": "users", "description": "Sends a friend request to another user. If the other user is a page then the requesting user will automatically start following the page.", "httpMethod": "POST", - "uri": "users/{user_id}/request" + "uri": "users/{user_id}/request", + "responseModel": "getResponse" }, "users/setpings": { "extends": "users", @@ -228,13 +252,15 @@ "required": true } }, - "uri": "users/{user_id}/setpings" + "uri": "users/{user_id}/setpings", + "responseModel": "getResponse" }, "users/unfriend": { "extends": "users", "description": "Cancels any relationship between the acting user and the specified user. ", "httpMethod": "POST", - "uri": "users/{user_id}/unfriend" + "uri": "users/{user_id}/unfriend", + "responseModel": "getResponse" }, "users/update": { "description": "Updates the user's profile photo.", @@ -245,7 +271,8 @@ "location": "postField" } }, - "uri": "users/self/update" + "uri": "users/self/update", + "responseModel": "getResponse" }, "venues": { "description": "Gives details about a venue, including location, mayorship, tags, tips, specials, and category. ", @@ -257,7 +284,8 @@ "required": true } }, - "uri": "venues/{venue_id}" + "uri": "venues/{venue_id}", + "responseModel": "getResponse" }, "venues/add": { "description": "Allows users to add a new venue.", @@ -322,12 +350,14 @@ "location": "postField" } }, - "uri": "venues/add" + "uri": "venues/add", + "responseModel": "getResponse" }, "venues/categories": { "description": "Returns a hierarchical list of categories applied to venues.", "httpMethod": "GET", - "uri": "venues/categories" + "uri": "venues/categories", + "responseModel": "getResponse" }, "venues/explore": { "description": "Returns a list of recommended venues near the current location. ", @@ -398,7 +428,8 @@ "location": "query" } }, - "uri": "venues/explore" + "uri": "venues/explore", + "responseModel": "getResponse" }, "venues/managed": { "description": "Get a list of venues the current user manages.", @@ -413,7 +444,8 @@ "location": "query" } }, - "uri": "venues/managed" + "uri": "venues/managed", + "responseModel": "getResponse" }, "venues/search": { "description": "Returns a list of venues near the current location, optionally matching a search term. ", @@ -480,7 +512,8 @@ "location": "query" } }, - "uri": "venues/search" + "uri": "venues/search", + "responseModel": "getResponse" }, "venues/suggestcompletion": { "description": "Returns a list of mini-venues partially matching the search term, near the location.", @@ -517,7 +550,8 @@ "location": "query" } }, - "uri": "venues/suggestcompletion" + "uri": "venues/suggestcompletion", + "responseModel": "getResponse" }, "venues/timeseries": { "description": "Get daily venue stats for a list of venues over a time range.", @@ -541,7 +575,8 @@ "location": "query" } }, - "uri": "venues/timeseries" + "uri": "venues/timeseries", + "responseModel": "getResponse" }, "venues/trending": { "description": "Returns a list of venues near the current location with the most people currently checked in. ", @@ -561,13 +596,15 @@ "location": "query" } }, - "uri": "venues/trending" + "uri": "venues/trending", + "responseModel": "getResponse" }, "venues/events": { "extends": "venues", "description": "Allows you to access information about the current events at a place. ", "httpMethod": "GET", - "uri": "venues/{venue_id}/events" + "uri": "venues/{venue_id}/events", + "responseModel": "getResponse" }, "venues/herenow": { "extends": "venues", @@ -583,25 +620,29 @@ "location": "query" } }, - "uri": "venues/{venue_id}/herenow" + "uri": "venues/{venue_id}/herenow", + "responseModel": "getResponse" }, "venues/hours": { "extends": "venues", "description": "Returns hours for a venue. ", "httpMethod": "GET", - "uri": "venues/{venue_id}/hours" + "uri": "venues/{venue_id}/hours", + "responseModel": "getResponse" }, "venues/likes": { "extends": "venues", "description": "Returns friends and a total count of users who have liked this venue.", "httpMethod": "GET", - "uri": "venues/{venue_id}/likes" + "uri": "venues/{venue_id}/likes", + "responseModel": "getResponse" }, "venues/links": { "extends": "venues", "description": "Returns URLs or identifiers from third parties that have been applied to this venue, such as how the New York Times refers to this venue and a URL for additional information from nytimes.com. This is part of the foursquare Venue Map.", "httpMethod": "GET", - "uri": "venues/{venue_id}/links" + "uri": "venues/{venue_id}/links", + "responseModel": "getResponse" }, "venues/listed": { "extends": "venues", @@ -621,19 +662,22 @@ "location": "query" } }, - "uri": "venues/{venue_id}/listed" + "uri": "venues/{venue_id}/listed", + "responseModel": "getResponse" }, "venues/menu": { "extends": "venues", "description": "", "httpMethod": "GET", - "uri": "venues/{venue_id}/menu" + "uri": "venues/{venue_id}/menu", + "responseModel": "getResponse" }, "venues/nextvenues": { "extends": "venues", "description": "Returns menu information for a venue.", "httpMethod": "GET", - "uri": "venues/{venue_id}/nextvenues" + "uri": "venues/{venue_id}/nextvenues", + "responseModel": "getResponse" }, "venues/photos": { "extends": "venues", @@ -653,13 +697,15 @@ } }, "httpMethod": "GET", - "uri": "venues/{venue_id}/photos" + "uri": "venues/{venue_id}/photos", + "responseModel": "getResponse" }, "venues/similar": { "extends": "venues", "description": "Returns a list of venues similar to the specified venue.", "httpMethod": "GET", - "uri": "venues/{venue_id}/similar" + "uri": "venues/{venue_id}/similar", + "responseModel": "getResponse" }, "venues/stats": { "extends": "venues", @@ -675,7 +721,8 @@ } }, "httpMethod": "GET", - "uri": "venues/{venue_id}/stats" + "uri": "venues/{venue_id}/stats", + "responseModel": "getResponse" }, "venues/tips": { "extends": "venues", @@ -695,7 +742,8 @@ } }, "httpMethod": "GET", - "uri": "venues/{venue_id}/tips" + "uri": "venues/{venue_id}/tips", + "responseModel": "getResponse" }, "venues/dislike": { "extends": "venues", @@ -708,7 +756,8 @@ } }, "httpMethod": "POST", - "uri": "venues/{venue_id}/dislike" + "uri": "venues/{venue_id}/dislike", + "responseModel": "getResponse" }, "venues/edit": { "extends": "venues", @@ -772,7 +821,8 @@ } }, "httpMethod": "POST", - "uri": "venues/{venue_id}/edit" + "uri": "venues/{venue_id}/edit", + "responseModel": "getResponse" }, "venues/flag": { "extends": "venues", @@ -789,7 +839,8 @@ } }, "httpMethod": "POST", - "uri": "venues/{venue_id}/flag" + "uri": "venues/{venue_id}/flag", + "responseModel": "getResponse" }, "venues/like": { "extends": "venues", @@ -803,7 +854,8 @@ } }, "httpMethod": "POST", - "uri": "venues/{venue_id}/like" + "uri": "venues/{venue_id}/like", + "responseModel": "getResponse" }, "venues/proposeedit": { "extends": "venues", @@ -851,7 +903,8 @@ } }, "httpMethod": "POST", - "uri": "venues/{venue_id}/proposeedit" + "uri": "venues/{venue_id}/proposeedit", + "responseModel": "getResponse" }, "venues/setrole": { "extends": "venues", @@ -873,7 +926,8 @@ } }, "httpMethod": "POST", - "uri": "venues/{venue_id}/setrole" + "uri": "venues/{venue_id}/setrole", + "responseModel": "getResponse" }, "venuegroups": { "description": "Get venue group details.", @@ -885,7 +939,8 @@ "required": true } }, - "uri": "venuegroups/{group_id}" + "uri": "venuegroups/{group_id}", + "responseModel": "getResponse" }, "venuegroups/add": { "description": "Create a venue group. If the venueId parameter is specified, then the endpoint will add the specified venues to the venue group. If it is not possible to add all of the specified venues to the group, then creation of the venue group will fail entirely.", @@ -901,18 +956,21 @@ "location": "postField" } }, - "uri": "venuegroups/add" + "uri": "venuegroups/add", + "responseModel": "getResponse" }, "venuegroups/delete": { "extends": "venuegroups", "description": "Delete a venue group.", "httpMethod": "POST", - "uri": "venuegroups/{group_id}/delete" + "uri": "venuegroups/{group_id}/delete", + "responseModel": "getResponse" }, "venuegroups/list": { "description": "List all venue groups owned by the user.", "httpMethod": "POST", - "uri": "venuegroups/list" + "uri": "venuegroups/list", + "responseModel": "getResponse" }, "venuegroups/timeseries": { "extends": "venuegroups", @@ -932,7 +990,8 @@ "location": "query" } }, - "uri": "venuegroups/{group_id}/timeseries" + "uri": "venuegroups/{group_id}/timeseries", + "responseModel": "getResponse" }, "venuegroups/addvenue": { "extends": "venuegroups", @@ -945,12 +1004,14 @@ "required": true } }, - "uri": "venuegroups/{group_id}/addvenue" + "uri": "venuegroups/{group_id}/addvenue", + "responseModel": "getResponse" }, "venuegroups/campaigns": { "extends": "venuegroups", "description": "Retrieve the campaigns that reference this venue group.", - "uri": "venuegroups/{group_id}/campaigns" + "uri": "venuegroups/{group_id}/campaigns", + "responseModel": "getResponse" }, "venuegroups/edit": { "extends": "venuegroups", @@ -994,7 +1055,8 @@ "location": "postField" } }, - "uri": "venuegroups/{group_id}/edit" + "uri": "venuegroups/{group_id}/edit", + "responseModel": "getResponse" }, "venuegroups/removevenue": { "extends": "venuegroups", @@ -1007,7 +1069,8 @@ "required": true } }, - "uri": "venuegroups/{group_id}/removevenue" + "uri": "venuegroups/{group_id}/removevenue", + "responseModel": "getResponse" }, "venuegroups/update": { "extends": "venuegroups", @@ -1023,7 +1086,8 @@ "location": "postField" } }, - "uri": "venuegroups/{group_id}/update" + "uri": "venuegroups/{group_id}/update", + "responseModel": "getResponse" }, "checkins": { "description": "Get details of a checkin.", @@ -1039,7 +1103,8 @@ "location": "query" } }, - "uri": "checkins/{checkin_id}" + "uri": "checkins/{checkin_id}", + "responseModel": "getResponse" }, "checkins/add": { "description": "Allows the acting user to check in to a place.", @@ -1091,7 +1156,8 @@ "required": false } }, - "uri": "checkins/add" + "uri": "checkins/add", + "responseModel": "getResponse" }, "checkins/recent": { "description": "Returns a list of recent checkins from friends.", @@ -1113,13 +1179,15 @@ "required": false } }, - "uri": "checkins/recent" + "uri": "checkins/recent", + "responseModel": "getResponse" }, "checkins/likes": { "extends": "checkins", "description": "Returns friends and a total count of users who have liked this checkin.", "httpMethod": "GET", - "uri": "checkins/{checkin_id}/likes" + "uri": "checkins/{checkin_id}/likes", + "responseModel": "getResponse" }, "checkins/addcomment": { "extends": "checkins", @@ -1137,7 +1205,8 @@ "required": false } }, - "uri": "checkins/{checkin_id}/addcomment" + "uri": "checkins/{checkin_id}/addcomment", + "responseModel": "getResponse" }, "checkins/deletecomment": { "extends": "checkins", @@ -1150,7 +1219,8 @@ "required": true } }, - "uri": "checkins/{checkin_id}/deletecomment" + "uri": "checkins/{checkin_id}/deletecomment", + "responseModel": "getResponse" }, "checkins/like": { "extends": "checkins", @@ -1164,7 +1234,8 @@ "required": false } }, - "uri": "checkins/{checkin_id}/like" + "uri": "checkins/{checkin_id}/like", + "responseModel": "getResponse" }, "tips": { "description": "Gives details about a tip, including which users (especially friends) have marked the tip to-do.", @@ -1176,7 +1247,8 @@ "required": true } }, - "uri": "tips/{tip_id}" + "uri": "tips/{tip_id}", + "responseModel": "getResponse" }, "tips/add": { "description": "Allows you to add a new tip at a venue.", @@ -1203,7 +1275,8 @@ "required": false } }, - "uri": "tips/add" + "uri": "tips/add", + "responseModel": "getResponse" }, "tips/search": { "description": "Returns a list of tips near the area specified. ", @@ -1240,12 +1313,14 @@ "required": false } }, - "uri": "tips/search" + "uri": "tips/search", + "responseModel": "getResponse" }, "tips/likes": { "extends": "tips", "description": "Returns friends and a total count of users who have liked this tip.", - "uri": "tips/{tip_id}/likes" + "uri": "tips/{tip_id}/likes", + "responseModel": "getResponse" }, "tips/listed": { "extends": "tips", @@ -1257,12 +1332,14 @@ "required": false } }, - "uri": "tips/{tip_id}/listed" + "uri": "tips/{tip_id}/listed", + "responseModel": "getResponse" }, "tips/saves": { "extends": "tips", "description": "Returns friends and a total count of users who have saved this tip.", - "uri": "tips/{tip_id}/saves" + "uri": "tips/{tip_id}/saves", + "responseModel": "getResponse" }, "tips/flag": { "extends": "tips", @@ -1280,7 +1357,8 @@ "required": true } }, - "uri": "tips/{tip_id}/flag" + "uri": "tips/{tip_id}/flag", + "responseModel": "getResponse" }, "tips/like": { "extends": "tips", @@ -1294,13 +1372,15 @@ "required": false } }, - "uri": "tips/{tip_id}/like" + "uri": "tips/{tip_id}/like", + "responseModel": "getResponse" }, "tips/unmark": { "extends": "tips", "description": "Allows you to remove a tip from your to-do list.", "httpMethod": "POST", - "uri": "tips/{tip_id}/unmark" + "uri": "tips/{tip_id}/unmark", + "responseModel": "getResponse" }, "lists": { "description": "Gives details about a list.", @@ -1337,7 +1417,8 @@ "required": false } }, - "uri": "lists/{list_id}" + "uri": "lists/{list_id}", + "responseModel": "getResponse" }, "lists/add": { "description": "Allows users to create a new list.", @@ -1364,7 +1445,8 @@ "required": false } }, - "uri": "lists/add" + "uri": "lists/add", + "responseModel": "getResponse" }, "lists/followers": { "description": "Returns a count and items of users following this list.", @@ -1376,7 +1458,8 @@ "required": true } }, - "uri": "lists/{list_id}/followers" + "uri": "lists/{list_id}/followers", + "responseModel": "getResponse" }, "lists/saves": { "description": "Returns friends and a total count of users who have saved this list.", @@ -1388,7 +1471,8 @@ "required": true } }, - "uri": "lists/{list_id}/saves" + "uri": "lists/{list_id}/saves", + "responseModel": "getResponse" }, "lists/suggestphoto": { "extends": "lists/saves", @@ -1401,19 +1485,22 @@ "required": true } }, - "uri": "lists/{list_id}/suggestphoto" + "uri": "lists/{list_id}/suggestphoto", + "responseModel": "getResponse" }, "lists/suggesttip": { "extends": "lists/suggestphoto", "description": "Suggests tips that may be appropriate for this item", "httpMethod": "GET", - "uri": "lists/{list_id}/suggesttip" + "uri": "lists/{list_id}/suggesttip", + "responseModel": "getResponse" }, "lists/suggestvenues": { "extends": "lists/saves", "description": "Suggests venues that may be appropriate for this list.", "httpMethod": "GET", - "uri": "lists/{list_id}/suggestvenues" + "uri": "lists/{list_id}/suggestvenues", + "responseModel": "getResponse" }, "lists/additem": { "extends": "lists/followers", @@ -1451,7 +1538,8 @@ "required": false } }, - "uri": "lists/{list_id}/additem" + "uri": "lists/{list_id}/additem", + "responseModel": "getResponse" }, "lists/deleteitem": { "extends": "lists/followers", @@ -1475,13 +1563,15 @@ } }, - "uri": "lists/{list_id}/deleteitem" + "uri": "lists/{list_id}/deleteitem", + "responseModel": "getResponse" }, "lists/follow": { "extends": "lists/followers", "description": "Allows you to follow a list.", "httpMethod": "POST", - "uri": "lists/{list_id}/follow" + "uri": "lists/{list_id}/follow", + "responseModel": "getResponse" }, "lists/moveitem": { "extends": "lists/followers", @@ -1504,7 +1594,8 @@ "required": false } }, - "uri": "lists/{list_id}/moveitem" + "uri": "lists/{list_id}/moveitem", + "responseModel": "getResponse" }, "lists/share": { "extends": "lists/followers", @@ -1522,13 +1613,15 @@ "required": false } }, - "uri": "lists/{list_id}/share" + "uri": "lists/{list_id}/share", + "responseModel": "getResponse" }, "lists/unfollow": { "extends": "lists/followers", "description": "Allows you to unfollow a list.", "httpMethod": "POST", - "uri": "lists/{list_id}/unfollow" + "uri": "lists/{list_id}/unfollow", + "responseModel": "getResponse" }, "lists/update": { "extends": "lists/followers", @@ -1556,7 +1649,8 @@ "required": false } }, - "uri": "lists/{list_id}/update" + "uri": "lists/{list_id}/update", + "responseModel": "getResponse" }, "lists/updateitem": { "extends": "lists/followers", @@ -1589,7 +1683,8 @@ "required": false } }, - "uri": "lists/{list_id}/updateitem" + "uri": "lists/{list_id}/updateitem", + "responseModel": "getResponse" }, "updates": { "httpMethod": "GET", @@ -1600,7 +1695,8 @@ "required": true } }, - "uri": "updates/{update_id}" + "uri": "updates/{update_id}", + "responseModel": "getResponse" }, "updates/notifications": { "description": "Retrieve a user's notification tray notifications", @@ -1612,7 +1708,8 @@ "required": false } }, - "uri": "updates/notifications" + "uri": "updates/notifications", + "responseModel": "getResponse" }, "updates/marknotificationsread": { "description": "Mark notification tray notifications as read up, to a certain timestamp.", @@ -1624,7 +1721,8 @@ "required": true } }, - "uri": "updates/marknotificationsread" + "uri": "updates/marknotificationsread", + "responseModel": "getResponse" }, "photos": { "description": "Get details of a photo.", @@ -1636,7 +1734,8 @@ "required": true } }, - "uri": "photos/{photo_id}" + "uri": "photos/{photo_id}", + "responseModel": "getResponse" }, "photos/add": { "description": "Allows users to add a new photo to a checkin, tip, venue, or page update in general.", @@ -1708,7 +1807,8 @@ "required": false } }, - "uri": "photos/add" + "uri": "photos/add", + "responseModel": "getResponse" }, "settings": { "description": "Returns a setting for the acting user.", @@ -1720,12 +1820,14 @@ "required": true } }, - "uri": "settings/{setting_id}" + "uri": "settings/{setting_id}", + "responseModel": "getResponse" }, "settings/all": { "description": "Returns the settings of the acting user.", "httpMethod": "GET", - "uri": "settings/all" + "uri": "settings/all", + "responseModel": "getResponse" }, "settings/set": { "description": "Change a setting for the given user.", @@ -1742,7 +1844,8 @@ "required": true } }, - "uri": "settings/{setting_id}/set" + "uri": "settings/{setting_id}/set", + "responseModel": "getResponse" }, "specials": { "description": "Gives details about a special, including text and whether it is unlocked for the current or provided user.", @@ -1764,7 +1867,8 @@ "required": false } }, - "uri": "specials/{special_id}" + "uri": "specials/{special_id}", + "responseModel": "getResponse" }, "specials/add": { "description": "Allows you to create a new special.", @@ -1821,7 +1925,8 @@ "required": false } }, - "uri": "specials/add" + "uri": "specials/add", + "responseModel": "getResponse" }, "specials/list": { "description": "List available specials.", @@ -1838,7 +1943,8 @@ "required": false } }, - "uri": "specials/list" + "uri": "specials/list", + "responseModel": "getResponse" }, "specials/search": { "description": "Returns a list of specials near the current location.", @@ -1875,7 +1981,8 @@ "required": false } }, - "uri": "specials/search" + "uri": "specials/search", + "responseModel": "getResponse" }, "specials/configuration": { "description": "Get special configuration details.", @@ -1887,7 +1994,8 @@ "required": true } }, - "uri": "specials/{special_id}/configuration" + "uri": "specials/{special_id}/configuration", + "responseModel": "getResponse" }, "specials/flag": { "description": "Allows users to indicate a Special is improper in some way.", @@ -1914,7 +2022,8 @@ "required": false } }, - "uri": "specials/{id}/flag" + "uri": "specials/{id}/flag", + "responseModel": "getResponse" }, "specials/retire": { "description": "Retire a special. Retired specials will not show up in the list of specials and cannot be assigned to a group. Also ends any active campaigns associated with the special.", @@ -1926,7 +2035,8 @@ "required": true } }, - "uri": "specials/{special_id}/retire" + "uri": "specials/{special_id}/retire", + "responseModel": "getResponse" }, "campaigns": { "description": "Get details of a campaign.", @@ -1938,7 +2048,8 @@ "required": true } }, - "uri": "campaigns/{campaign_id}" + "uri": "campaigns/{campaign_id}", + "responseModel": "getResponse" }, "campaigns/add": { "description": "Create a campaign. The special must be started in order for it to be visible to users. Homes and Offices are not allowed to run specials, so an attempt to add a campaign on such a venue will result in an error.", @@ -1975,7 +2086,8 @@ "required": false } }, - "uri": "campaigns/add" + "uri": "campaigns/add", + "responseModel": "getResponse" }, "campaigns/list": { "description": "List all campaigns matching the given criteria.", @@ -1997,7 +2109,8 @@ "required": false } }, - "uri": "campaigns/list" + "uri": "campaigns/list", + "responseModel": "getResponse" }, "campaigns/timeseries": { "description": "Get daily campaign stats over a given time range.", @@ -2019,7 +2132,8 @@ "required": false } }, - "uri": "campaigns/{campaign_id}/timeseries" + "uri": "campaigns/{campaign_id}/timeseries", + "responseModel": "getResponse" }, "campaigns/delete": { "description": "Delete a campaign that has never been activated.", @@ -2031,7 +2145,8 @@ "required": true } }, - "uri": "campaigns/{campaign_id}/delete" + "uri": "campaigns/{campaign_id}/delete", + "responseModel": "getResponse" }, "campaigns/end": { "description": "End a campaign.", @@ -2043,7 +2158,8 @@ "required": true } }, - "uri": "campaigns/{campaign_id}/end" + "uri": "campaigns/{campaign_id}/end", + "responseModel": "getResponse" }, "campaigns/start": { "description": "Start a campaign.", @@ -2060,7 +2176,8 @@ "required": false } }, - "uri": "campaigns/{campaign_id}/start" + "uri": "campaigns/{campaign_id}/start", + "responseModel": "getResponse" }, "events": { "description": "Get details of a event.", @@ -2072,12 +2189,14 @@ "required": true } }, - "uri": "events/{event_id}" + "uri": "events/{event_id}", + "responseModel": "getResponse" }, "events/categories": { "description": "Returns a hierarchical list of categories applied to events. ", "httpMethod": "GET", - "uri": "events/categories" + "uri": "events/categories", + "responseModel": "getResponse" }, "events/search": { "description": "This is an experimental API and subject to change or breakage.", @@ -2099,7 +2218,8 @@ "required": false } }, - "uri": "events/search" + "uri": "events/search", + "responseModel": "getResponse" }, "events/add": { "description": "Create an event for a venue that you manage. You can see all your events in the tools tab when you're managing your venue. They're on the calendar. Events show up when users view your venue on mobile or the web. Users can also check in to events and share with their friends what they're up to in the present moment, and look back to see what they did in the days of yore.", @@ -2126,7 +2246,8 @@ "required": false } }, - "uri": "events/add" + "uri": "events/add", + "responseModel": "getResponse" }, "pages": { "description": "Returns user details for a page. Will return error if user specified is not a page.", @@ -2138,7 +2259,8 @@ "required": true } }, - "uri": "pages/{user_id}" + "uri": "pages/{user_id}", + "responseModel": "getResponse" }, "pages/add": { "description": "Allows users to create a new page. The creating user is added as a manager of the new page.", @@ -2150,12 +2272,14 @@ "required": true } }, - "uri": "pages/add" + "uri": "pages/add", + "responseModel": "getResponse" }, "pages/managing": { "description": "Returns an array of the pages a user manages.", "httpMethod": "GET", - "uri": "pages/managing" + "uri": "pages/managing", + "responseModel": "getResponse" }, "pages/search": { "description": "Returns a list of pages matching the search term.", @@ -2177,7 +2301,8 @@ "required": false } }, - "uri": "pages/search" + "uri": "pages/search", + "responseModel": "getResponse" }, "pages/timeseries": { "description": "Get daily venue stats for venues managed by a page over a time range.", @@ -2204,7 +2329,8 @@ "required": false } }, - "uri": "pages/{page_id}/timeseries" + "uri": "pages/{page_id}/timeseries", + "responseModel": "getResponse" }, "pages/venues": { "description": "Allows you to get the page's venues.", @@ -2251,7 +2377,8 @@ "required": false } }, - "uri": "pages/{page_id}/venues" + "uri": "pages/{page_id}/venues", + "responseModel": "getResponse" }, "pages/like": { "description": "Allows the acting user to like or unlike a page. Liking a page subscribes the acting user to updates from that page.", @@ -2269,7 +2396,8 @@ "required": false } }, - "uri": "pages/{user_id}/like" + "uri": "pages/{user_id}/like", + "responseModel": "getResponse" }, "pageupdates": { "description": "Get page update details.", @@ -2291,7 +2419,8 @@ "required": false } }, - "uri": "pageupdates/{update_id}" + "uri": "pageupdates/{update_id}", + "responseModel": "getResponse" }, "pageupdates/add": { "description": "Broadcast an update as a page to followers of the page and associated venues. Venues can be specified either by the venueId, groupId or pageId (meaning all venues managed by the page) parameters. Broadcasts will show up in the Activity Stream (the Friends tab in the app) for any user who has either liked the page or any of the venues or has checked in enough times at any of the venues AND is in the same city as one of the venues associated with the broadcast. A broadcast can contain any combination of a shout, a special and photos, but at least one of the three must be specified. The API enforces a rate limit of at most one broadcast sent by a given user to the same set of venues in 15 minutes. This rate may change and is stricter for larger sets of venues.", @@ -2333,12 +2462,14 @@ "required": false } }, - "uri": "pageupdates/add" + "uri": "pageupdates/add", + "responseModel": "getResponse" }, "pageupdates/list": { "description": "Returns a list of page updates created by the current user.", "httpMethod": "GET", - "uri": "pageupdates/list" + "uri": "pageupdates/list", + "responseModel": "getResponse" }, "pageupdates/delete": { "description": "Delete a page update created by the current user.", @@ -2350,7 +2481,8 @@ "required": true } }, - "uri": "pageupdates/{update_id}/delete" + "uri": "pageupdates/{update_id}/delete", + "responseModel": "getResponse" }, "pageupdates/like": { "description": "Causes the current user to 'like' a page update. If there is a campaign associated with the update, the like will propagate to the special as well.", @@ -2362,7 +2494,8 @@ "required": true } }, - "uri": "pageupdates/{update_id}/like" + "uri": "pageupdates/{update_id}/like", + "responseModel": "getResponse" }, "multi": { "description": "Does multiple (up to 5) requests at once. If specifying a v=YYYYMMDD param, be sure to use it for the top-level", @@ -2374,7 +2507,8 @@ "required": true } }, - "uri": "multi" + "uri": "multi", + "responseModel": "getResponse" }, "multi/post": { "extends": "multi", diff --git a/tests/Client/FoursquareClientTest.php b/tests/Client/FoursquareClientTest.php index d44ebb3..143f76a 100644 --- a/tests/Client/FoursquareClientTest.php +++ b/tests/Client/FoursquareClientTest.php @@ -14,13 +14,13 @@ class FoursquareClientTest extends \PHPUnit_Framework_TestCase */ public function testFactoryReturnsClient($clientId, $clientSecret) { - $config = array( - 'client_id' => $clientId, + $config = [ + 'client_id' => $clientId, 'client_secret' => $clientSecret - ); + ]; - $client = FoursquareClient::factory($config); - $defaultOptions = $client->getDefaultOption('query'); + $client = FoursquareClient::factory($config); + $defaultOptions = $client->getHttpClient()->getDefaultOption('query'); $this->assertInstanceOf('\\Jcroll\\FoursquareApiClient\\Client\\FoursquareClient', $client); $this->assertEquals($config['client_id'], $defaultOptions['client_id']); @@ -28,26 +28,26 @@ public function testFactoryReturnsClient($clientId, $clientSecret) } /** - * @expectedException \Guzzle\Common\Exception\InvalidArgumentException + * @expectedException \InvalidArgumentException */ public function testFactoryReturnsExceptionOnNullArguments() { - $config = array(); + $config = []; - $client = FoursquareClient::factory($config); + FoursquareClient::factory($config); } /** - * @expectedException \Guzzle\Common\Exception\InvalidArgumentException + * @expectedException \InvalidArgumentException */ public function testFactoryReturnsExceptionOnBlankArguments() { - $config = array( - 'client_id' => '', + $config = [ + 'client_id' => '', 'client_secret' => '' - ); + ]; - $client = FoursquareClient::factory($config); + FoursquareClient::factory($config); } /** @@ -58,25 +58,25 @@ public function testFactoryReturnsExceptionOnBlankArguments() */ public function testAddToken($clientId, $clientSecret) { - $config = array( - 'client_id' => $clientId, + $config = [ + 'client_id' => $clientId, 'client_secret' => $clientSecret - ); + ]; $token = 'secretToken'; $client = FoursquareClient::factory($config); $client->addToken($token); - $defaultOptions = $client->getDefaultOption('query'); + $defaultOptions = $client->getHttpClient()->getDefaultOption('query'); $this->assertEquals($token, $defaultOptions['oauth_token']); } public function provideConfigValues() { - return array( - array('aClientId', 'aClientSecret') - ); + return [ + ['aClientId', 'aClientSecret'] + ]; } }