protected function buildUrl(array $segments = [])
{
//Get the base URL and add a ?
$url = $this->apiBase . '?';
if (isset($this->apiEnding)) {
$segments = array_merge($segments, $this->apiEnding);
}
foreach ($segments as $key => $value) {
$url = $url . "{$key}={$value}&";
}
//Remove the final &
$url = substr($url, 0, -1);
return $url;
}