Skip to content

Commit

Permalink
Merge pull request #6 from maxerism/add-fleets-drivers
Browse files Browse the repository at this point in the history
Add fleets/drivers
  • Loading branch information
aneip authored Apr 16, 2024
2 parents 43e3983 + 0bc21ef commit 21bd981
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 4 deletions.
10 changes: 8 additions & 2 deletions src/One/Fleets.php
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,10 @@ public function all(?Query $query = null): Response
$this->requiresAccessToken();

return $this->send(
'GET', 'fleets', $this->getApiHeaders(), $this->buildHttpQuery($query)
'GET',
'fleets',
$this->getApiHeaders(),
$this->buildHttpQuery($query)
);
}

Expand All @@ -36,7 +39,10 @@ public function get(int $fleetId, ?Query $query = null): Response
$this->requiresAccessToken();

return $this->send(
'GET', "fleets/{$fleetId}", $this->getApiHeaders(), $this->buildHttpQuery($query)
'GET',
"fleets/{$fleetId}",
$this->getApiHeaders(),
$this->buildHttpQuery($query)
);
}
}
6 changes: 4 additions & 2 deletions src/One/Fleets/Drivers.php
Original file line number Diff line number Diff line change
Expand Up @@ -19,13 +19,15 @@ class Drivers extends Request
*
* @return \Laravie\Codex\Contracts\Response
*/
public function all(int $fleetId, ?Query $query = null): Response
public function all(int $fleetId=null, ?Query $query = null): Response
{
$this->requiresAccessToken();

$endpoint = is_null($fleetId) ? 'fleets/drivers' : "fleets/{$fleetId}/drivers";

return $this->send(
'GET',
"fleets/{$fleetId}/drivers",
$endpoint,
$this->getApiHeaders(),
$this->buildHttpQuery($query)
);
Expand Down

0 comments on commit 21bd981

Please sign in to comment.