Skip to content

Commit

Permalink
Add support for Language method AnalyzeEntitySentiment (#426)
Browse files Browse the repository at this point in the history
[core, language] Add support for Language method AnalyzeEntitySentiment
  • Loading branch information
jdpedrie authored Apr 5, 2017
1 parent c3a5022 commit bb8e63d
Showing 1 changed file with 14 additions and 2 deletions.
16 changes: 14 additions & 2 deletions RestTrait.php
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,14 @@ public function setRequestWrapper(RequestWrapper $requestWrapper)
*
* @param string $resource The resource type used for the request.
* @param string $method The method used for the request.
* @param array $options [optional] Options used to build out the request.
* @param array $options [optional] {
* Options used to build out the request.
*
* @type RequestBuilder $requestBuilder An instance of RequestBuilder.
* If provided, the request will be constructed using the given
* instance, rather than the one found in the `$requestBuilder`
* property.
* }
* @return array
*/
public function send($resource, $method, array $options = [])
Expand All @@ -74,9 +81,14 @@ public function send($resource, $method, array $options = [])
'requestTimeout'
], $options);

$requestBuilder = $this->pluck('requestBuilder', $options, false);
if (is_null($requestBuilder) || !($requestBuilder instanceof RequestBuilder)) {
$requestBuilder = $this->requestBuilder;
}

return json_decode(
$this->requestWrapper->send(
$this->requestBuilder->build($resource, $method, $options),
$requestBuilder->build($resource, $method, $options),
$requestOptions
)->getBody(),
true
Expand Down

0 comments on commit bb8e63d

Please sign in to comment.