protected function pipe(string $method, string $path, array $data) { $response = $this->connection->{$method}($path, $data); if ($this->connection->code() != 200) { throw new \BackendException($this->connection->code(), json_encode($response)); } return $response; }
public function lookup(string $OAuthToken) { $grant = Cache::tags(['grants'])->get($OAuthToken); if (is_null($grant)) { $response = $this->connection->post('oauth', ['access_token' => $OAuthToken]); if ($response->code() != 200) { throw new \BackendException($response->code(), $response->content()); } $grant = $response->content(); } $this->grant = $grant; return $grant; }