Skip to content

Commit

Permalink
Fixes #8
Browse files Browse the repository at this point in the history
  • Loading branch information
Alec Ritson committed May 26, 2016
1 parent cb0a1b6 commit f86e6c4
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 14 deletions.
19 changes: 6 additions & 13 deletions Placid/PlacidTags.php
Original file line number Diff line number Diff line change
Expand Up @@ -103,30 +103,23 @@ public function request($something = null)

try {
$response = $this->api('placid')->request($options['client'], $options['path'], $method);
$response = json_decode($response->getBody(), true);
} catch (\GuzzleHttp\Exception\ClientException $e) {
$response = null;
}

// Do we need to cache the request?
if($options['cache']) {
$this->cache->put($cacheId, json_decode($response->getBody()), $cacheDuration);
$this->cache->put($cacheId, $response, $cacheDuration);
}

if(is_array($response))
{
$this->context['response'] = $response;
}

// If there is no result, pass the `no_results` tag back
if(!$response) {
$this->context['no_results'] = true;
return ['no_results' => true];
}
else
elseif(is_array($response))
{
return json_decode($response->getBody(), true);
return ['response' => $response];
}



return json_decode($response->getBody(), true);
}
}
2 changes: 1 addition & 1 deletion Placid/meta.yaml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
name: Placid
version: 1.0
version: 2.0.2
description: Consume REST services in your templates
url: https://github.com/alecritson/Placid-Statamic
developer: Alec Ritson
Expand Down

0 comments on commit f86e6c4

Please sign in to comment.