/**
* buildRequestUrl
* Parse arguments sent to the rest function. Might be extended in future for callbacks.
*
* @param string $method
* @param string $path
* @param array $data
* @return string
*/
public function buildRequestUrl($method, $path, $data)
{
$url = "{$this->baseUrl}{$path}";
// If we're using oauth, account for it
if ($this->canOauth()) {
$oauth = new OAuthSimple($this->consumer_key, $this->shared_secret);
$oauth->setTokensAndSecrets(array('access_token' => $this->token, 'access_secret' => $this->oauth_secret))->setParameters($data);
$request = $oauth->sign(array('path' => $url));
return $request['signed_url'];
} else {
// These methods require the data appended to the URL
if (in_array($method, array('GET', 'DELETE', 'DEL')) && !empty($data)) {
$url .= '?' . http_build_query($data, '', '&');
}
return $url;
}
}