Skip to content

Commit

Permalink
Guzzle (#10)
Browse files Browse the repository at this point in the history
* Guzzle Upgrade

* Packaged API Version

* Fortifi Grants

* Resource owner

* Latest API
  • Loading branch information
bajb authored and TomK committed Sep 11, 2017
1 parent c77bdc1 commit 7848ebe
Show file tree
Hide file tree
Showing 16 changed files with 218 additions and 164 deletions.
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
composer.lock
/vendor
13 changes: 9 additions & 4 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,13 @@
"homepage": "http://fortifi.co",
"license": "BSD-3-Clause",
"require": {
"fortifi/fortifi-api": "^7",
"league/oauth2-client": "~0.11",
"packaged/helpers": "~1.7"
"fortifi/fortifi-api": "~7.20",
"league/oauth2-client": "~2.2",
"packaged/helpers": "~1.7",
"packaged/api": "1.0.0"
},
"require-dev": {
"phpunit/phpunit": "~4.8"
"phpunit/phpunit": "~6.3"
},
"autoload": {
"psr-4": {
Expand All @@ -20,6 +21,10 @@
{
"type": "vcs",
"url": "git@github.com:fortifi/fortifi-api.git"
},
{
"type": "vcs",
"url": "git@github.com:packaged/api.git"
}
]
}
6 changes: 3 additions & 3 deletions src/Fortifi.php
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ public static function setEnvironment($env = self::ENV_STAGE)
$prefix = 's';
}

static::$apiHost = $prefix . 'api.fortifi.co';
static::$apiHost = $prefix . 'api.fortifi.io';
}

public static function getInstance(
Expand Down Expand Up @@ -102,7 +102,7 @@ public static function getInstance(

public function getApi()
{
$this->_api->setAccessToken($this->getToken()->accessToken);
$this->_api->setAccessToken($this->getToken()->getToken());
return $this->_api;
}

Expand Down Expand Up @@ -147,7 +147,7 @@ public function getRequestClientIp()
'HTTP_X_CLUSTER_CLIENT_IP',
'HTTP_FORWARDED_FOR',
'HTTP_FORWARDED',
'REMOTE_ADDR'
'REMOTE_ADDR',
];
if($ip === null)
{
Expand Down
2 changes: 1 addition & 1 deletion src/Models/FortifiModel.php
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ public static function processRequest(
catch(AccessDeniedException $e)
{
$token = $fortifi->getToken(true);
$fortifi->getApi()->setAccessToken($token->accessToken);
$fortifi->getApi()->setAccessToken($token->getToken());
return $request->get();
}
}
Expand Down
4 changes: 4 additions & 0 deletions src/OAuth/FortifiAccessToken.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,10 @@ class FortifiAccessToken extends AccessToken
*/
public function __construct(array $options = null)
{
if(isset($options['uid']) && !isset($options['resource_owner_id']))
{
$options['resource_owner_id'] = $options['uid'];
}
parent::__construct($options);

if(isset($options['session_secret']))
Expand Down
7 changes: 7 additions & 0 deletions src/OAuth/FortifiGrant.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
<?php
namespace Fortifi\Sdk\OAuth;

interface FortifiGrant
{
public function handleResponse($response = []);
}
Loading

0 comments on commit 7848ebe

Please sign in to comment.