Skip to content

Commit

Permalink
Guzzle 6 support
Browse files Browse the repository at this point in the history
  • Loading branch information
Mat-Gr committed Sep 6, 2017
1 parent eca9196 commit 1242748
Showing 1 changed file with 12 additions and 6 deletions.
18 changes: 12 additions & 6 deletions src/Rossedman/Teamwork/Client.php
Original file line number Diff line number Diff line change
Expand Up @@ -134,8 +134,14 @@ public function buildRequest($endpoint, $action, $params = [], $query = null)
$params = json_encode($params);
}

$this->request = $this->client->createRequest($action,
$this->buildUrl($endpoint), ['auth' => [$this->key, 'X'], 'body' => $params]
$options = ['auth' => [$this->key, 'X']];

if ($action == 'POST') {
$options = array_merge(['body' => $params], $options);
}

$this->request = $this->client->request($action,
$this->buildUrl($endpoint), $options
);

if ($query != null)
Expand All @@ -154,9 +160,9 @@ public function buildRequest($endpoint, $action, $params = [], $query = null)
*/
public function response()
{
$this->response = $this->client->send($this->request);

return $this->response->json();
$this->response = $this->request->getBody();
return $this->response->getContents();
}

/**
Expand Down Expand Up @@ -213,4 +219,4 @@ public function getRequest()
{
return $this->request;
}
}
}

0 comments on commit 1242748

Please sign in to comment.