public function next() { list($url, $params) = $this->extractPathAndUpdateParams($params); $requestor = new Printfection_ApiRequestor($this->_apiKey); $id = Printfection_ApiRequestor::utf8($id); $extn = urlencode($id); $params['limit'] = isset($params['limit']) ? $params['limit'] : 100; $params['offset'] = isset($params['offset']) ? $params['offset'] + $params['limit'] : $params['limit']; list($response, $apiKey) = $requestor->request('get', "{$url}/{$extn}", $params); return Printfection_Util::convertToPrintfectionObject($response, $apiKey); }
protected static function _scopedCreate($class, $params = null, $apiKey = null) { self::_validateCall('create', $params, $apiKey); $requestor = new Printfection_ApiRequestor($apiKey); $url = self::_scopedLsb($class, 'classUrl', $class); list($response, $apiKey) = $requestor->request('post', $url, $params); return Printfection_Util::convertToPrintfectionObject($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 Printfection_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; } $this->_values[$k] = Printfection_Util::convertToPrintfectionObject($v, $apiKey); $this->_transientValues->discard($k); $this->_unsavedValues->discard($k); } }