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