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); }
/** * @returns string The full API URL for this API resource. */ public function instanceUrl() { $id = $this['id']; $class = get_class($this); if ($id === null) { $message = "Could not determine which URL to request: {$class} instance has invalid ID: {$id}"; throw new Printfection_InvalidRequestError($message, null); } $id = Printfection_ApiRequestor::utf8($id); $base = $this->_lsb('classUrl', $class); $extn = urlencode($id); return "{$base}/{$extn}"; }
/** * @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 Printfection_InvalidRequestError($msg, null); } $parent = $this['order_id']; $base = self::classUrl('Printfection_Order'); $parent = Printfection_ApiRequestor::utf8($parent); $id = Printfection_ApiRequestor::utf8($id); $parentExtn = urlencode($parent); $extn = urlencode($id); $class = get_class($this); $self = self::_scopedLsb($class, 'className', $class); return $base . "/" . $parentExtn . "/" . $self . "s/" . $extn; }