Skip to content

Commit

Permalink
Merge pull request #42 from vredeling/master
Browse files Browse the repository at this point in the history
Update oauth2 client to v2.3 & replace PEST with Guzzle.
  • Loading branch information
basvandorst authored Jul 13, 2018
2 parents 291006e + 32c4dd0 commit 0d6c347
Show file tree
Hide file tree
Showing 6 changed files with 376 additions and 360 deletions.
2 changes: 1 addition & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
language: php
php:
- 5.5
- 5.6
install:
- composer --no-interaction install
script: phpunit --configuration phpunit.xml --coverage-clover=coverage.clover
Expand Down
8 changes: 4 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ use Strava\API\Exception;
use Strava\API\Service\REST;

try {
$adapter = new Pest('https://www.strava.com/api/v3');
$adapter = new \GuzzleHttp\Client(['base_uri' => 'https://www.strava.com/api/v3']);
$service = new REST($token, $adapter); // Define your user token here.
$client = new Client($service);

Expand Down Expand Up @@ -146,8 +146,8 @@ $oauth->getAccessToken($grant = 'authorization_code', $params = []);
### Strava\API\Client
#### Usage
```php
// REST adapter (We use `Pest` in this project)
$adapter = new Pest('https://www.strava.com/api/v3');
// REST adapter (We use `Guzzle` in this project)
$adapter = new \GuzzleHttp\Client(['base_uri' => 'https://www.strava.com/api/v3']);
// Service to use (Service\Stub is also available for test purposes)
$service = new Service\REST('RECEIVED-TOKEN', $adapter);

Expand Down Expand Up @@ -207,7 +207,7 @@ $client->getStreamsRoute($id);
### Used libraries
- [Strava API](https://strava.github.io/api/)
- [thephpleague/oauth2-client](https://github.com/thephpleague/oauth2-client/)
- [educoder/pest](https://github.com/educoder/pest)
- [guzzlehttp/guzzle](https://github.com/guzzle/guzzle)

### Development
The StravaPHP library was created by Bas van Dorst, [software engineer](https://www.linkedin.com/in/basvandorst) and cyclist enthusiast.
Expand Down
8 changes: 4 additions & 4 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,12 +9,12 @@
"StravaPHP"
],
"require": {
"php": ">=5.5.0",
"educoder/pest": "~1.0",
"league/oauth2-client": "~1.0"
"php": ">=5.6",
"league/oauth2-client": "~2.3",
"guzzlehttp/guzzle": "~6.3"
},
"require-dev": {
"phpunit/phpunit": "~4.0"
"phpunit/phpunit": "^5"
},
"license": "MIT",
"authors": [
Expand Down
4 changes: 1 addition & 3 deletions src/Strava/API/Factory.php
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
<?php
namespace Strava\API;

use Pest;

/**
* Factory class
*
Expand Down Expand Up @@ -45,7 +43,7 @@ public function getOAuthClient($client_id, $client_secret, $redirect_uri)
*/
public function getAPIClient($token)
{
$adapter = new Pest(self::$endpoint);
$adapter = new \GuzzleHttp\Client(['base_uri' => self::$endpoint]);
$service = new Service\REST($token, $adapter);

$APIClient = new Client($service);
Expand Down
Loading

0 comments on commit 0d6c347

Please sign in to comment.