/** * If token is expired, refresh Token and store credentials * @return void */ protected function checkTokenExpiration() { if ($this->client->checkAccessTokenExpired()) { $result = $this->client->refreshToken(); $this->user->imgurToken->update(['token' => array_get($result, 'access_token'), 'refresh_token' => array_get($result, 'refresh_token')]); } }
/** * getRemoteUrl * * @param string $path * * @return string */ public function getRemoteUrl($path) { if (!File::getExtension($path)) { $img = $this->imgur->image($path); return $img->link; } return static::getHost() . '/' . $path; }
public function __construct(ImgurClient $client) { parent::__construct(); $this->setClient($client); $this->setupClient(); }
function __construct() { parent::__construct(); $this->setOption('client_id', config('imgurx.client_id')); $this->setOption('client_secret', config('imgurx.client_secret')); }
/** * Perform a DELETE request and return the parsed response * * @param string $url * @return array */ public function delete($url, $parameters = array()) { $httpClient = $this->client->getHttpClient(); $response = $httpClient->delete($url, $parameters); return $httpClient->parseResponse($response); }