Skip to content

Commit

Permalink
fix data collector
Browse files Browse the repository at this point in the history
  • Loading branch information
jbtcd committed Dec 1, 2020
1 parent 77f144a commit 3823e9e
Show file tree
Hide file tree
Showing 2 changed files with 29 additions and 28 deletions.
27 changes: 14 additions & 13 deletions src/DataCollector/FitbitDataCollector.php
Original file line number Diff line number Diff line change
Expand Up @@ -34,27 +34,28 @@ public function __construct(
*/
public function collect(Request $request, Response $response, \Throwable $exception = null): void
{
// TODO: Fill me
$this->data['fitbitConfiguration'] = [
'clientId' => $this->fitbit->getClientId(),
'expiresIn' => $this->fitbit->getExpiresIn(),
'redirectUrl' => $this->fitbit->getRedirectUrl(),
'scopes' => $this->fitbit->getScopes(),
'clientSecret' => $this->fitbit->getClientSecret(),
'codeChallenge' => $this->fitbit->getCodeChallenge(),
'codeChallengeMethod' => $this->fitbit->getCodeChallengeMethod(),
'prompt' => $this->fitbit->getPrompt(),
'responseType' => $this->fitbit->getResponseType(),
'state' => $this->fitbit->getState(),
];
}

public function getName(): string
{
return 'fitbit';
}

public function getClientId(): string
public function getFitbitConfiguration(): array
{
return $this->fitbit->getClientId();
}

public function getClientSecret(): string
{
return $this->fitbit->getClientSecret();
}

public function getScopes(): array
{
return $this->fitbit->getScopes();
return $this->data['fitbitConfiguration'];
}

public function hasApiCalls(): bool
Expand Down
30 changes: 15 additions & 15 deletions src/Resources/views/Collector/fitbit.html.twig
Original file line number Diff line number Diff line change
Expand Up @@ -30,24 +30,24 @@
<h3>Configuration</h3>
<table>
<thead>
<tr>
<th scope="col" class="key">Key</th>
<th scope="col">Value</th>
</tr>
<tr>
<th scope="col" class="key">Key</th>
<th scope="col">Value</th>
</tr>
</thead>
<tbody>
<tr>
<th>clientId</th>
<td>{{ collector.clientId }}</td>
</tr>
<tr>
<th>clientSecret</th>
<td>{{ collector.clientSecret }}</td>
</tr>
<tr>
<th>scopes</th>
<td>{{ collector.scopes|join(', ') }}</td>
{% for key, value in collector.fitbitConfiguration %}
<tr class="highlight">
<th>{{ key }}</th>
{% if value is empty %}
<td class="error">{{ 'null' }}</td>
{% elseif value is iterable %}
<td class="string">{{ value|join(', ') }}</td>
{% else %}
<td class="string">{{ value }}</td>
{% endif %}
</tr>
{% endfor %}
</tbody>
</table>
<h3>API calls</h3>
Expand Down

0 comments on commit 3823e9e

Please sign in to comment.