コード例 #1
0
ファイル: Collection.php プロジェクト: lanma121/superPrize
 public function retrieve($id, $params = null, $opts = null)
 {
     list($url, $params) = $this->extractPathAndUpdateParams($params);
     $id = ApiRequestor::utf8($id);
     $extn = urlencode($id);
     list($response, $opts) = $this->_request('get', "{$url}/{$extn}", $params, $opts);
     return Util\Util::convertToPingppObject($response, $opts);
 }
コード例 #2
0
ファイル: ApiResource.php プロジェクト: easybib/stripe-php
 public function instanceUrl()
 {
     $id = $this['id'];
     $class = get_class($this);
     if (!$id) {
         throw new InvalidRequestError("Could not determine which URL to request: {$class} instance has invalid ID: {$id}", '');
     }
     $id = ApiRequestor::utf8($id);
     $base = self::classUrl($class);
     $extn = urlencode($id);
     return "{$base}/{$extn}";
 }
コード例 #3
0
ファイル: ApiResource.php プロジェクト: lanma121/superPrize
 /**
  * @return string The full API URL for this API resource.
  */
 public function instanceUrl()
 {
     $id = $this['id'];
     $class = get_called_class();
     if ($id === null) {
         $message = "Could not determine which URL to request: " . "{$class} instance has invalid ID: {$id}";
         throw new Error\InvalidRequest($message, null);
     }
     $id = ApiRequestor::utf8($id);
     $base = static::classUrl();
     $extn = urlencode($id);
     return "{$base}/{$extn}";
 }
コード例 #4
0
 /**
  * @return string The API URL for this Stripe refund.
  */
 public function instanceUrl()
 {
     $id = $this['id'];
     $fee = $this['fee'];
     if (!$id) {
         throw new Error\InvalidRequest("Could not determine which URL to request: " . "class instance has invalid ID: {$id}", null);
     }
     $id = ApiRequestor::utf8($id);
     $fee = ApiRequestor::utf8($fee);
     $base = ApplicationFee::classUrl();
     $feeExtn = urlencode($fee);
     $extn = urlencode($id);
     return "{$base}/{$feeExtn}/refunds/{$extn}";
 }
コード例 #5
0
 /**
  * @return string The API URL for this Stripe subscription.
  */
 public function instanceUrl()
 {
     $id = $this['id'];
     $customer = $this['customer'];
     if (!$id) {
         throw new Error\InvalidRequest("Could not determine which URL to request: " . "class instance has invalid ID: {$id}", null);
     }
     $id = ApiRequestor::utf8($id);
     $customer = ApiRequestor::utf8($customer);
     $base = Customer::classUrl();
     $customerExtn = urlencode($customer);
     $extn = urlencode($id);
     return "{$base}/{$customerExtn}/subscriptions/{$extn}";
 }
コード例 #6
0
 /**
  * @return string The instance URL for this resource. It needs to be special
  *    cased because it doesn't fit into the standard resource pattern.
  */
 public function instanceUrl()
 {
     $id = $this['id'];
     if (!$id) {
         $class = get_class($this);
         $msg = "Could not determine which URL to request: {$class} instance " . "has invalid ID: {$id}";
         throw new Error\InvalidRequest($msg, null);
     }
     $id = ApiRequestor::utf8($id);
     $extn = urlencode($id);
     if (!$this['customer']) {
         $base = BitcoinReceiver::classUrl();
         return "{$base}/{$extn}";
     } else {
         $base = Customer::classUrl();
         $parent = ApiRequestor::utf8($this['customer']);
         $parentExtn = urlencode($parent);
         return "{$base}/{$parentExtn}/sources/{$extn}";
     }
 }
コード例 #7
0
 /**
  * @return string The instance URL for this resource. It needs to be special
  *    cased because it doesn't fit into the standard resource pattern.
  */
 public function instanceUrl()
 {
     $id = $this['id'];
     if (!$id) {
         $class = get_class($this);
         $msg = "Could not determine which URL to request: {$class} instance " . "has invalid ID: {$id}";
         throw new Error\InvalidRequest($msg, null);
     }
     if (isset($this['customer'])) {
         $parent = $this['customer'];
         $base = Customer::classUrl();
     } elseif (isset($this['recipient'])) {
         $parent = $this['recipient'];
         $base = Recipient::classUrl();
     } else {
         return null;
     }
     $parent = ApiRequestor::utf8($parent);
     $id = ApiRequestor::utf8($id);
     $parentExtn = urlencode($parent);
     $extn = urlencode($id);
     return "{$base}/{$parentExtn}/cards/{$extn}";
 }