示例#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')]);
     }
 }
示例#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;
 }
示例#3
0
 public function __construct(ImgurClient $client)
 {
     parent::__construct();
     $this->setClient($client);
     $this->setupClient();
 }
示例#4
0
文件: Imgurx.php 项目: nahid/imgurx
 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);
 }