10 defined(
'JPATH_PLATFORM') or die;
43 $this->options = isset($options) ? $options :
new JRegistry;
44 $this->client = isset($client) ? $client :
new JGithubHttp($this->options);
60 protected function fetchUrl($path, $page = 0, $limit = 0)
63 $uri =
new JUri($this->options->get(
'api.url') . $path);
65 if ($this->options->get(
'gh.token',
false))
68 $uri->
setVar(
'access_token', $this->options->get(
'gh.token'));
73 if ($this->options->get(
'api.username',
false))
75 $uri->setUser($this->options->get(
'api.username'));
78 if ($this->options->get(
'api.password',
false))
80 $uri->setPass($this->options->get(
'api.password'));
87 $uri->setVar(
'page', (
int) $page);
93 $uri->setVar(
'per_page', (
int) $limit);
109 protected function processResponse(
JHttpResponse $response, $expectedCode = 200)
112 if ($response->code != $expectedCode)
115 $error = json_decode($response->body);
116 throw new DomainException($error->message, $response->code);
119 return json_decode($response->body);