public function refreshFrom($values, $apiKey, $partial = false)
{
$this->_apiKey = $apiKey;
if ($partial) {
$removed = array();
} else {
$removed = array_diff(array_keys($this->_values), array_keys($values));
}
foreach ($removed as $k) {
if (in_array($k, $this->_immutableValues) || in_array($k, $values)) {
continue;
}
unset($this->{$k});
}
foreach ($values as $k => $v) {
if ($k == 'id' && $this->id != $v) {
$this->id = $v;
}
if (in_array($k, $this->_immutableValues)) {
continue;
}
$this->_values[$k] = Util::convertToEasyPostObject($v, $apiKey, $this, $k);
}
$this->_unsavedValues = array();
}