diff options
author | Frédéric Guillot <fred@kanboard.net> | 2014-09-09 07:21:10 +0200 |
---|---|---|
committer | Frédéric Guillot <fred@kanboard.net> | 2014-09-09 07:21:10 +0200 |
commit | 54a77cd58589e8c73543360af1469151fb1a550c (patch) | |
tree | 86ab929a2981a8147656c2e6119c7f1e0e130c3e /vendor/OAuth/OAuth1/Service/Etsy.php | |
parent | 0d4b6525dd86f837eb9e931e48a92fc6a0033e11 (diff) |
Update dependencies
Diffstat (limited to 'vendor/OAuth/OAuth1/Service/Etsy.php')
-rwxr-xr-x | vendor/OAuth/OAuth1/Service/Etsy.php | 38 |
1 files changed, 37 insertions, 1 deletions
diff --git a/vendor/OAuth/OAuth1/Service/Etsy.php b/vendor/OAuth/OAuth1/Service/Etsy.php index 884358eb..30dc331c 100755 --- a/vendor/OAuth/OAuth1/Service/Etsy.php +++ b/vendor/OAuth/OAuth1/Service/Etsy.php @@ -13,6 +13,9 @@ use OAuth\Common\Http\Client\ClientInterface; class Etsy extends AbstractService { + + protected $scopes = array(); + public function __construct( CredentialsInterface $credentials, ClientInterface $httpClient, @@ -32,7 +35,14 @@ class Etsy extends AbstractService */ public function getRequestTokenEndpoint() { - return new Uri($this->baseApiUri . 'oauth/request_token'); + $uri = new Uri($this->baseApiUri . 'oauth/request_token'); + $scopes = $this->getScopes(); + + if (count($scopes)) { + $uri->setQuery('scope=' . implode('%20', $scopes)); + } + + return $uri; } /** @@ -93,4 +103,30 @@ class Etsy extends AbstractService return $token; } + + /** + * Set the scopes for permissions + * @see https://www.etsy.com/developers/documentation/getting_started/oauth#section_permission_scopes + * @param array $scopes + * + * @return $this + */ + public function setScopes(array $scopes) + { + if (!is_array($scopes)) { + $scopes = array(); + } + + $this->scopes = $scopes; + return $this; + } + + /** + * Return the defined scopes + * @return array + */ + public function getScopes() + { + return $this->scopes; + } } |