Ejemplo n.º 1
0
 /**
  * Creates new trello client.
  *
  * @param array $options
  */
 public function __construct($options = [])
 {
     Configuration::setMany($options, static::$defaultOptions);
     $this->http = new Http();
 }
Ejemplo n.º 2
0
 /**
  * Creates a new OAuth server client and attaches to authorization broker.
  *
  * @return Authorization
  */
 protected function createClient()
 {
     $this->client = new OAuthServer(['identifier' => Configuration::get('key'), 'secret' => Configuration::get('secret'), 'callback_uri' => Configuration::get('callbackUrl'), 'name' => Configuration::get('name'), 'expiration' => Configuration::get('expiration'), 'scope' => Configuration::get('scope')]);
     return $this;
 }
Ejemplo n.º 3
0
 /**
  * Retrieves http response for a given request.
  *
  * @param  RequestInterface $request
  *
  * @return object
  * @throws Exceptions\Exception
  */
 protected function sendRequest(RequestInterface $request)
 {
     try {
         $response = $this->httpClient->send($request, ['multipart' => $this->multipartResources, 'proxy' => Configuration::get('proxy')]);
         $this->multipartResources = [];
         return json_decode($response->getBody());
     } catch (RequestException $e) {
         $this->throwRequestException($e);
     }
 }
Ejemplo n.º 4
0
 /**
  * Creates fully qualified domain from given path.
  *
  * @param  string  $path
  *
  * @return string
  */
 protected function getUrlFromPath($path = '/')
 {
     return Configuration::get('domain') . '/' . Configuration::get('version') . '/' . ltrim($path, '/');
 }