예제 #1
0
 /**
  * Retrieve a File Upload.
  * @link   https://stripe.com/docs/api/php#retrieve_file_upload
  *
  * @param  string             $id
  * @param  array|string|null  $options
  *
  * @return self
  *
  * @todo: Refactor the FileUpload::retrieve() method
  */
 public static function retrieve($id, $options = null)
 {
     $apiKey = RequestOptions::parse($options)->getApiKey();
     $file = new self($id, $apiKey);
     /** @var \Arcanedev\Stripe\Http\Response $response */
     list($response, $apiKey) = Requestor::make($apiKey, self::baseUrl())->get("/v1/files/{$id}", $file->retrieveParameters);
     $file->refreshFrom($response->getJson(), $apiKey);
     $file->setLastResponse($response);
     return $file;
 }
예제 #2
0
 /**
  * Refreshes this object using the provided values.
  *
  * @param  array                                                    $values
  * @param  \Arcanedev\Stripe\Http\RequestOptions|array|string|null  $options
  * @param  bool                                                     $partial
  */
 public function refreshFrom($values, $options, $partial = false)
 {
     $this->opts = is_array($options) ? RequestOptions::parse($options) : $options;
     $this->cleanObject($values, $partial);
     foreach ($values as $key => $value) {
         if (self::$permanentAttributes->includes($key) && isset($this[$key])) {
             continue;
         }
         $this->values[$key] = $this->constructValue($key, $value, $this->opts);
         $this->transientValues->discard($key);
         $this->unsavedValues->discard($key);
     }
 }
예제 #3
0
 /**
  * Custom Post Call.
  *
  * @param  string             $url
  * @param  array|null         $params
  * @param  array|string|null  $options
  *
  * @return self
  */
 protected function scopedPostCall($url, $params = [], $options = null)
 {
     /** @var \Arcanedev\Stripe\Http\Response $response */
     list($response, $options) = Requestor::make(RequestOptions::parse($options)->getApiKey(), static::baseUrl())->post($url, $params);
     $this->refreshFrom($response->getJson(), $options);
     $this->setLastResponse($response);
     return $this;
 }