public static function monitor_external($params) { Postmaster_ApiResource::_validateParams($params); $requestor = new Postmaster_ApiRequestor(); $response = $requestor->request('post', self::$urlBase, $params); return $response; }
public static function fit($params = null) { $requestor = new Postmaster_ApiRequestor(); $params = json_encode($params); $headers = array("Content-Type: application/json"); $response = $requestor->request('post', self::$urlBase . '/fit', $params, $headers); return $response; }
public static function get($params = null) { $class = get_class(); Postmaster_ApiResource::_validateParams($params); $requestor = new Postmaster_ApiRequestor(); $response = $requestor->request('post', self::$urlBase, $params); return Postmaster_Object::scopedConstructObject($class, $response); }
public function track() { $requestor = new Postmaster_ApiRequestor(); $url = $this->instanceUrl(self::$urlBase, 'track'); $response = $requestor->request('get', $url); $class = 'Postmaster_Tracking'; $results = array(); foreach ($response['results'] as $data) { array_push($results, Postmaster_Object::scopedConstructObject($class, $data)); } return $results; }
public static function get($params = null) { $class = get_class(); Postmaster_ApiResource::_validateParams($params); $requestor = new Postmaster_ApiRequestor(); $response = $requestor->request('post', self::$urlBase, $params); $results = array(); foreach ($response['services'] as $data) { $class = 'Postmaster_TransitTime'; array_push($results, Postmaster_Object::scopedConstructObject($class, $data)); } return $results; }
public function instanceUrl($base, $action = null) { $id = $this['id']; if (is_float($id)) { $id = sprintf("%.0f", $id); } $class = get_class($this); if (!$id) { throw new Postmaster_Error("Could not determine which URL to request: {$class} instance has invalid ID: {$id}", null); } $id = Postmaster_ApiRequestor::utf8($id); $extn = urlencode($id); if ($action) { return "{$base}/{$extn}/{$action}"; } return "{$base}/{$extn}"; }