Skip to content

Commit

Permalink
Merge pull request #19 from njoguamos/replace-depreciated-method
Browse files Browse the repository at this point in the history
Use the defaultAuth() method instead of withTokenAuth()
  • Loading branch information
njoguamos authored Apr 15, 2024
2 parents 8747ef0 + bd39b32 commit 2fb31dc
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 3 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/run-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ jobs:
php-version: ${{ matrix.php }}
extensions: dom, curl, libxml, mbstring, zip
tools: composer:v2
coverage: none
coverage: xdebug

- name: Setup problem matchers
run: |
Expand All @@ -52,4 +52,4 @@ jobs:
run: composer show -D

- name: Execute tests
run: vendor/bin/pest --ci
run: vendor/bin/pest --ci --coverage
10 changes: 9 additions & 1 deletion src/Connectors/PlausibleConnector.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@

use Illuminate\Support\Facades\Cache;
use Saloon\CachePlugin\Traits\HasCaching;
use Saloon\Http\Auth\TokenAuthenticator;
use Saloon\Http\Connector;
use Saloon\CachePlugin\Contracts\Driver;
use Saloon\CachePlugin\Drivers\LaravelCacheDriver;
Expand All @@ -13,9 +14,16 @@ class PlausibleConnector extends Connector implements Cacheable
{
use HasCaching;

protected ?string $token;

public function __construct()
{
$this->withTokenAuth(token: config(key: 'plausible.api_key'));
$this->token = config(key: 'plausible.api_key');
}

protected function defaultAuth(): TokenAuthenticator
{
return new TokenAuthenticator($this->token);
}

public function resolveBaseUrl(): string
Expand Down

0 comments on commit 2fb31dc

Please sign in to comment.