Esempio n. 1
0
 /**
  * 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')]);
     }
 }
Esempio n. 2
0
 /**
  * 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;
 }
Esempio n. 3
0
 public function __construct(ImgurClient $client)
 {
     parent::__construct();
     $this->setClient($client);
     $this->setupClient();
 }
Esempio n. 4
0
 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);
 }