public function retrieve($id, $params = null)
 {
     $requestor = new Shippo_ApiRequestor($this->_apiKey);
     $base = $this['url'];
     $id = Shippo_ApiRequestor::utf8($id);
     $extn = urlencode($id);
     list($response, $apiKey) = $requestor->request('get', "{$base}/{$extn}", $params);
     return Shippo_Util::convertToShippoObject($response, $apiKey);
 }
 protected static function _scopedValidate($class, $id)
 {
     self::_validateCall('create', $params, $apiKey);
     $requestor = new Shippo_ApiRequestor($apiKey);
     $url = self::_scopedLsb($class, 'classUrl', $class) . "/" . $id . "/validate/";
     list($response, $apiKey) = $requestor->request('get', $url, $params);
     return Shippo_Util::convertToShippoObject($response, $apiKey);
 }
 /**
  * Refreshes this object using the provided values.
  *
  * @param array $values
  * @param string $apiKey
  * @param boolean $partial Defaults to false.
  */
 public function refreshFrom($values, $apiKey, $partial = false)
 {
     $this->_apiKey = $apiKey;
     // Wipe old state before setting new.  This is useful for e.g. updating a
     // customer, where there is no persistent card parameter.  Mark those values
     // which don't persist as transient
     if ($partial) {
         $removed = new Shippo_Util_Set();
     } else {
         $removed = array_diff(array_keys($this->_values), array_keys($values));
     }
     foreach ($removed as $k) {
         if (self::$permanentAttributes->includes($k)) {
             continue;
         }
         unset($this->{$k});
     }
     foreach ($values as $k => $v) {
         if (self::$permanentAttributes->includes($k) && isset($this[$k])) {
             continue;
         }
         if (self::$nestedUpdatableAttributes->includes($k) && is_array($v)) {
             $this->_values[$k] = Shippo_Object::scopedConstructFrom('Shippo_AttachedObject', $v, $apiKey);
         } else {
             $this->_values[$k] = Shippo_Util::convertToShippoObject($v, $apiKey);
         }
         $this->_transientValues->discard($k);
         $this->_unsavedValues->discard($k);
     }
 }