| @@ 57-67 (lines=11) @@ | ||
| 54 | * |
|
| 55 | * @throws \GuzzleHttp\Exception\RequestException |
|
| 56 | */ |
|
| 57 | public function get( |
|
| 58 | $id |
|
| 59 | ) { |
|
| 60 | $url = "/goals/{$id}"; |
|
| 61 | ||
| 62 | // Now make the request. |
|
| 63 | $request = new Request('GET', $url); |
|
| 64 | $data = $this->client->getResponseJson($request); |
|
| 65 | ||
| 66 | return new Goal($data); |
|
| 67 | } |
|
| 68 | ||
| 69 | /** |
|
| 70 | * Add a goal. |
|
| @@ 80-89 (lines=10) @@ | ||
| 77 | * |
|
| 78 | * @throws \GuzzleHttp\Exception\RequestException |
|
| 79 | */ |
|
| 80 | public function add( |
|
| 81 | Goal $goal |
|
| 82 | ) { |
|
| 83 | $body = $goal->json(); |
|
| 84 | $url = '/goals'; |
|
| 85 | $request = new Request('POST', $url, [], $body); |
|
| 86 | $data = $this->client->getResponseJson($request); |
|
| 87 | ||
| 88 | return new Goal($data); |
|
| 89 | } |
|
| 90 | ||
| 91 | /** |
|
| 92 | * Deletes a goal by ID. |
|
| @@ 66-76 (lines=11) @@ | ||
| 63 | * |
|
| 64 | * @throws \GuzzleHttp\Exception\RequestException |
|
| 65 | */ |
|
| 66 | public function get( |
|
| 67 | $slotId |
|
| 68 | ) { |
|
| 69 | $url = "/slots/{$slotId}"; |
|
| 70 | ||
| 71 | // Now make the request. |
|
| 72 | $request = new Request('GET', $url); |
|
| 73 | $data = $this->client->getResponseJson($request); |
|
| 74 | ||
| 75 | return new Slot($data); |
|
| 76 | } |
|
| 77 | ||
| 78 | /** |
|
| 79 | * Add a slot. |
|
| @@ 87-96 (lines=10) @@ | ||
| 84 | * |
|
| 85 | * @throws \GuzzleHttp\Exception\RequestException |
|
| 86 | */ |
|
| 87 | public function add( |
|
| 88 | Slot $slot |
|
| 89 | ) { |
|
| 90 | $body = $slot->json(); |
|
| 91 | $url = '/slots'; |
|
| 92 | $request = new Request('POST', $url, [], $body); |
|
| 93 | $data = $this->client->getResponseJson($request); |
|
| 94 | ||
| 95 | return new Slot($data); |
|
| 96 | } |
|
| 97 | ||
| 98 | /** |
|
| 99 | * Deletes a slot by ID. |
|