delete() публичный Метод

public delete ( $url, $parameters = [], $headers = [] )
Пример #1
0
 public function test_delete()
 {
     global $TEST_SERVER_URL;
     $api = new RestClient();
     $result = $api->delete($TEST_SERVER_URL, array('foo' => ' bar', 'baz' => 1));
     $response_json = $result->decode_response();
     $this->assertEquals('DELETE', $response_json->SERVER->REQUEST_METHOD);
     $this->assertEquals("foo=+bar&baz=1", $response_json->body);
 }
Пример #2
0
 function deleteUser($gameName)
 {
     Util::throwExceptionIfNullOrBlank($gameName, "Game Name");
     $encodedUserName = Util::encodeParams($gameName);
     $responseObj = new App42Response();
     $objUtil = new Util($this->apiKey, $this->secretKey);
     try {
         $params = null;
         $headerParams = array();
         $queryParams = array();
         $signParams = $this->populateSignParams();
         $metaHeaders = $this->populateMetaHeaderParams();
         $headerParams = array_merge($signParams, $metaHeaders);
         $signParams['gameName'] = $gameName;
         $signature = urlencode($objUtil->sign($signParams));
         //die();
         $headerParams['signature'] = $signature;
         $contentType = $this->content_type;
         $accept = $this->accept;
         $baseURL = $this->url;
         $baseURL = $baseURL . "/delete/" . $encodedUserName;
         $response = RestClient::delete($baseURL, $params, null, null, $contentType, $accept, $headerParams);
         $responseObj->setStrResponse($response->getResponse());
         $responseObj->setResponseSuccess(true);
     } catch (App42Exception $e) {
         throw $e;
     } catch (Exception $e) {
         throw new App42Exception($e);
     }
     return $responseObj;
 }
Пример #3
0
 /**
  * Delete existing preference file.
  *
  * @returns App42Response Object.
  */
 function deleteAllPreferences()
 {
     $responseObj = new App42Response();
     $objUtil = new Util($this->apiKey, $this->secretKey);
     try {
         $params = null;
         $headerParams = array();
         $queryParams = array();
         $signParams = $this->populateSignParams();
         $metaHeaders = $this->populateMetaHeaderParams();
         $headerParams = array_merge($signParams, $metaHeaders);
         $signature = urlencode($objUtil->sign($signParams));
         //die();
         $headerParams['signature'] = $signature;
         $contentType = $this->content_type;
         $accept = $this->accept;
         $baseURL = $this->url;
         $baseURL = $baseURL . "/deleteAllPreferences";
         $response = RestClient::delete($baseURL, $params, null, null, $contentType, $accept, $headerParams);
         //$recommendResponseObj = new RecommenderResponseBuilder();
         // $recommendObj = $recommendResponseObj->buildResponse($response->getResponse());
         $responseObj->setStrResponse($response);
         $responseObj->setResponseSuccess(true);
     } catch (App42Exception $e) {
         throw $e;
     } catch (Exception $e) {
         throw new App42Exception($e);
     }
     return $responseObj;
 }
Пример #4
0
 /**
  * Removes all the attributes for a given session id
  *
  * @param sessionId
  *            - The session id for which the attributes has to be removed
  *
  * @return App42Response if removed successfully
  */
 function removeAllAttributes($sessionId)
 {
     Util::throwExceptionIfNullOrBlank($sessionId, "session Id");
     $encodedSessionId = Util::encodeParams($sessionId);
     $responseObj = new App42Response();
     $objUtil = new Util($this->apiKey, $this->secretKey);
     try {
         $params = null;
         $headerParams = array();
         $queryParams = array();
         $signParams = $this->populateSignParams();
         $metaHeaders = $this->populateMetaHeaderParams();
         $headerParams = array_merge($signParams, $metaHeaders);
         $signParams['sessionId'] = $sessionId;
         $signature = urlencode($objUtil->sign($signParams));
         //die();
         $headerParams['signature'] = $signature;
         $contentType = $this->content_type;
         $accept = $this->accept;
         $baseURL = $this->url;
         $baseURL = $baseURL . "/id/" . $encodedSessionId;
         $response = RestClient::delete($baseURL, $params, null, null, $contentType, $accept, $headerParams);
         $sessionResponseObj = new SessionResponseBuilder();
         $sessionObj = $sessionResponseObj->buildResponse($response->getResponse());
         $responseObj->setStrResponse($sessionObj);
         $responseObj->setResponseSuccess(true);
     } catch (App42Exception $e) {
         throw $e;
     } catch (Exception $e) {
         throw new App42Exception($e);
     }
     return $responseObj;
 }
/**
 * @method
 *
 * Delete an object(Folder/File) from Alfresco Repository
 *
 * @name deleteObject
 * @label Delete an object(Folder/File) from Alfresco Repository
 *
 * @param string | $alfrescoServerUrl | Server name and port where Alfresco exists | http://localhost:8080/alfresco
 * @param string | $objetcId | Id of the Object(Folder/File) to be deleted
 * @param string | $user | Valid Admin username to connect to Alfresco server
 * @param string | $pwd | Valid Admin password to connect to Alfresco server
 *
 * @return object | $result | Response |
 *
 */
function deleteObject($alfrescoServerUrl, $objetcId, $user, $pwd)
{
    $alfresco_url = "{$alfrescoServerUrl}/s/cmis/s/workspace:SpacesStore/i/{$objetcId}";
    $alfresco_exec = RestClient::delete($alfresco_url, $user, $pwd, "application/atom+xml");
    $alfresco_res = G::json_decode($alfresco_exec->getResponse());
    return $alfresco_res;
}
Пример #6
0
 /**
  * Delete the specified Geo points from Cloud.
  *
  * @param storageName
  *            - Unique handler for storage name
  *
  * @return App42Response object containing the name of the storage that has
  *         been deleted
  *
  * @throws App42Exception
  */
 function deleteGeoPoints($geoStorageName, $geoPointsList)
 {
     Util::throwExceptionIfNullOrBlank($geoStorageName, "Geo Storage Name");
     Util::throwExceptionIfNullOrBlank($geoPointsList, "Geo Points List");
     $encodedStorageName = Util::encodeParams($geoStorageName);
     $responseObj = new App42Response();
     $objUtil = new Util($this->apiKey, $this->secretKey);
     try {
         $params = null;
         $headerParams = array();
         $queryParams = array();
         $signParams = $this->populateSignParams();
         $metaHeaders = $this->populateMetaHeaderParams();
         $headerParams = array_merge($signParams, $metaHeaders);
         if (is_array($geoPointsList)) {
             $string = '{"app42":{ "geo": {"storage":{"points": { "point": ' . json_encode($geoPointsList) . '}}}}}';
         } else {
             $string = '{"app42":{ "geo": {"storage":{"points": { "point": "' . $geoPointsList . '"}}}}}';
         }
         $signParams['geoPoints'] = $string;
         $signature = urlencode($objUtil->sign($signParams));
         //die();
         $headerParams['signature'] = $signature;
         $contentType = $this->content_type;
         $accept = $this->accept;
         $baseURL = $this->url;
         $baseURL = $baseURL . "/points/" . $encodedStorageName;
         $response = RestClient::delete($baseURL, $params, null, null, $contentType, $accept, $headerParams);
         $geoResponseObj = new GeoResponseBuilder();
         $geoObj = $geoResponseObj->buildResponse($response->getResponse());
         $responseObj->setStrResponse($geoObj);
         $responseObj->setResponseSuccess(true);
     } catch (App42Exception $e) {
         throw $e;
     } catch (Exception $e) {
         throw new App42Exception($e);
     }
     return $responseObj;
 }
/**
 * @method
 *
 * Download Document/File from Alfresco Repository
 *
 * @name downloadDoc
 * @label Download Document/File from Alfresco Repository
 *
 * @param string | $alfrescoServerUrl | Server name and port where Alfresco exists | http://localhost:8080/alfresco
 * @param string | $objetcId | Id of the Object(Folder/File) to be deleted
 * @param string | $parentFolder | Parent Folder Name
 * @param string | $folderName | Name of the Folder to be created
 * @param string | $user | Valid Admin username to connect to Alfresco server
 * @param string | $pwd | Valid Admin password to connect to Alfresco server
 *
 * @return string | $result | Response
 *
 */
function downloadDoc($alfrescoServerUrl, $parentFolder, $folderName, $user, $pwd)
{
    $alfresco_url = "{$alfrescoServerUrl}/s/cmis/s/workspace:SpacesStore/i/{$objetcId}";
    $alfresco_exec = RestClient::delete($alfresco, $user, $pwd, "application/atom+xml");
    $alfresco_res = G::json_decode($alfresco_exec->getResponse());
    echo $alfresco_res;
    return $alfresco_res;
}