/** * Delete the URI, validate the response and return the object. * @param string Resource URI, if not fully qualified, the base URL will be appended * @param string Optional client for the request, useful for mocking the client */ protected static function _delete($uri, $client = null) { if (is_null($client)) $client = new Recurly_Client(); $response = $client->request(Recurly_Client::DELETE, $uri); $response->assertValidResponse(); if ($response->body) { return Recurly_Base::__parseXmlToNewObject($response->body, $client); } return null; }
/** * Post to the URI, validate the response and return the object. * @param string Resource URI, if not fully qualified, the base URL will be appended * @param string Data to post to the URI * @param string Optional client for the request, useful for mocking the client */ protected static function _post($uri, $data = null, $client = null) { if (is_null($client)) { $client = new Recurly_Client(); } $response = $client->request(Recurly_Client::POST, $uri, $data); $response->assertValidResponse(); $object = Recurly_Base::__parseXmlToNewObject($response->body, $client); $response->assertSuccessResponse($object); return $object; }