-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
d96394b
commit cc8d270
Showing
5 changed files
with
69 additions
and
23 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,10 +1,29 @@ | ||
<?php | ||
namespace Nickpeirson\Evohome\Request; | ||
|
||
class GetToken extends BasicAuthAbstract | ||
class GetToken extends AuthAbstract | ||
{ | ||
public function getPath() | ||
protected $username; | ||
protected $password; | ||
|
||
protected function getBody() | ||
{ | ||
$body = parent::getBody(); | ||
$body['grant_type'] = 'password'; | ||
$body['Username'] = $this->username; | ||
$body['Password'] = $this->password; | ||
return $body; | ||
} | ||
|
||
public function setUsername($username) | ||
{ | ||
$this->username = $username; | ||
return $this; | ||
} | ||
|
||
public function setPassword($password) | ||
{ | ||
return 'Auth/OAuth/Token'; | ||
$this->password = $password; | ||
return $this; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
<?php | ||
namespace Nickpeirson\Evohome\Request; | ||
use Nickpeirson\Evohome\Token; | ||
|
||
class RefreshToken extends AuthAbstract | ||
{ | ||
/** | ||
* | ||
* @var Token | ||
*/ | ||
protected $token; | ||
|
||
protected function getBody() | ||
{ | ||
$body = parent::getBody(); | ||
$body['grant_type'] = 'refresh_token'; | ||
$body['refresh_token'] = $this->token->getRefreshToken(); | ||
return $body; | ||
} | ||
|
||
public function setToken(Token $token) | ||
{ | ||
$this->token = $token; | ||
return $this; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters