Skip to content

Commit

Permalink
Support accept in getSource requests
Browse files Browse the repository at this point in the history
  • Loading branch information
joostfaassen committed Mar 19, 2017
1 parent 5a4ffc7 commit ed2bb3e
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 4 deletions.
8 changes: 6 additions & 2 deletions examples/v3/get.php
Original file line number Diff line number Diff line change
Expand Up @@ -30,14 +30,18 @@

//exit();

$source = $hubClient->getSource($key);
$accept = null;
$accept = 'hub/dossier';


$source = $hubClient->getSource($key, $accept);

echo "Source: " . $source->getUrl() . " [" . $source->getApi() . "]\n";
if ($source->getJwt()) {
echo "JWT: " . $source->getJwt() . "\n";
}

$data = $providerClient->getResourceData($resource, $source);
$data = $providerClient->getResourceData($resource, $source, $accept);
echo $data;

//print_r($source);
Expand Down
7 changes: 5 additions & 2 deletions src/V3/HubV3Client.php
Original file line number Diff line number Diff line change
Expand Up @@ -191,11 +191,14 @@ public function getPicture($key)

return $body;
}
public function getSource($key)

public function getSource($key, $accept = null)
{
$resources = array();
$uri = '/resources/' . $key . '/source';
if ($accept) {
$uri .= '?accept=' . $accept;
}
$body = $this->sendRequest($uri, null);

$node = $this->parseXml((string)$body);
Expand Down

0 comments on commit ed2bb3e

Please sign in to comment.