1 | <?php |
||
18 | class RunKeeper extends AbstractService |
||
19 | { |
||
20 | public function __construct( |
||
21 | CredentialsInterface $credentials, |
||
22 | ClientInterface $httpClient, |
||
23 | TokenStorageInterface $storage, |
||
24 | $scopes = array(), |
||
25 | UriInterface $baseApiUri = null |
||
26 | ) { |
||
27 | parent::__construct($credentials, $httpClient, $storage, $scopes, $baseApiUri); |
||
28 | |||
29 | if (null === $baseApiUri) { |
||
30 | $this->baseApiUri = new Uri('https://api.runkeeper.com/'); |
||
31 | } |
||
32 | } |
||
33 | |||
34 | /** |
||
35 | * {@inheritdoc} |
||
36 | */ |
||
37 | public function getAuthorizationUri(array $additionalParameters = array()) |
||
38 | { |
||
39 | $parameters = array_merge( |
||
40 | $additionalParameters, |
||
41 | array( |
||
42 | 'client_id' => $this->credentials->getConsumerId(), |
||
43 | 'redirect_uri' => $this->credentials->getCallbackUrl(), |
||
44 | 'response_type' => 'code', |
||
45 | ) |
||
46 | ); |
||
47 | |||
48 | $parameters['scope'] = implode(' ', $this->scopes); |
||
49 | |||
50 | // Build the url |
||
51 | $url = clone $this->getAuthorizationEndpoint(); |
||
52 | foreach ($parameters as $key => $val) { |
||
53 | $url->addToQuery($key, $val); |
||
54 | } |
||
55 | |||
56 | return $url; |
||
57 | } |
||
58 | |||
59 | /** |
||
60 | * {@inheritdoc} |
||
61 | */ |
||
62 | public function getAuthorizationEndpoint() |
||
66 | |||
67 | /** |
||
68 | * {@inheritdoc} |
||
69 | */ |
||
70 | public function getAccessTokenEndpoint() |
||
74 | |||
75 | /** |
||
76 | * {@inheritdoc} |
||
77 | */ |
||
78 | protected function getAuthorizationMethod() |
||
82 | |||
83 | /** |
||
84 | * {@inheritdoc} |
||
85 | */ |
||
86 | protected function parseAccessTokenResponse($responseBody) |
||
105 | } |
||
106 |