Exemple #1
0
 /**
  * @param Actions\ActionsInterface $action
  * @param array                    $requestParams
  * @return Url
  */
 protected function buildRequestUrl(Actions\ActionsInterface $action, array $requestParams)
 {
     $url = new Url('https', $this->connection->getEndpoint());
     $url->setPath($action->getAction());
     $url->setQuery($requestParams);
     return $url;
 }
 /**
  * Get a CloudFront URL for an S3 key.
  *
  * @param $key
  *   The S3 object key.
  * @param int $expiry
  *   (optional) Expiry time for the URL, as a Unix timestamp.
  * @return \Guzzle\Http\Url
  *   The CloudFront URL.
  */
 protected function getCloudFrontUrl($key, $expiry = NULL)
 {
     // Real CloudFront credentials are required to test this, so we ignore
     // testing this.
     // @codeCoverageIgnoreStart
     $cf = $this->config->getCloudFront();
     $url = new Url('https', $this->config->getDomain());
     $url->setPath($key);
     $this->injectCname($url);
     $options = array('url' => (string) $url, 'expires' => $expiry);
     $url = Url::factory($cf->getSignedUrl($options));
     return $url;
     // @codeCoverageIgnoreEnd
 }
 /**
  * The endpoint varies depending on developer mode, and whether the method is GET or POST.
  * If the method is GET, then the data needs to be added to the URL here. I've not found any
  * helper functions to construct URLs in omnipay, but they could be there.
  * It may also be possible to leave the URL construction to Guzzle, assuming Guzzle is able
  * to add an arbitrary list of query parameters to the endpoint that may already have some
  * query parameters.
  * CHECKME: it seems that Guzzle will accept an array containing a template and substitution
  * variables for its endpoint. This would avoid us needing to construct it here.
  */
 public function getEndpoint()
 {
     $domain = $this->getDeveloperMode() ? $this->endpointDevDomain : $this->endpointProdDomain;
     $path = $this->getPath();
     // Build the URL from the parts.
     // There is a dependency on Guzzle here, which OmniPay uses, but may be a
     // bit of an assumption in the longer term.
     $url = new Url($this->endpointScheme, $domain);
     $url->setPath($path);
     if ($this->getMethod() == 'GET') {
         $url->setQuery($this->getData());
     }
     return $url;
 }