Skip to content

Commit

Permalink
Fix the find method of the Card model. (#12)
Browse files Browse the repository at this point in the history
Currently the find method returns a set of multiple cards, because currently the endpoint is looked up with `cards?id=<id>`.

The [documentation](https://docs.pokemontcg.io/api-reference/cards/get-card) states that the endpoint is `cards/<id>`.

This change has the same behavior as the find method on the Sets model.
  • Loading branch information
xewl committed Feb 6, 2024
1 parent d3011dd commit 97c6789
Showing 1 changed file with 3 additions and 6 deletions.
9 changes: 3 additions & 6 deletions src/Models/Card.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,12 +16,9 @@ class Card extends Model
*/
public function find(string $pokemonTcgId): mixed
{
return $this->resolveResponse(
$this->client->get($this->getEndpoint(), [
'id' => $pokemonTcgId,
]),
$this->getEndpoint().$pokemonTcgId
);
$endpoint = $this->getEndpoint() . '/' . $pokemonTcgId;

return $this->resolveResponse($this->client->get($endpoint), $endpoint);
}

/**
Expand Down

0 comments on commit 97c6789

Please sign in to comment.