public function put($path, $params = null)
 {
     $response = $this->_doRequest('PUT', $path, $this->_buildXml($params));
     $responseCode = $response['status'];
     if ($responseCode === 200 || $responseCode === 201 || $responseCode === 422 || $responseCode == 400) {
         return Xml::buildArrayFromXml($response['body']);
     } else {
         Util::throwStatusCodeException($responseCode);
     }
 }
Esempio n. 2
0
 public static function parse($signature, $payload)
 {
     if (preg_match("/[^A-Za-z0-9+=\\/\n]/", $payload) === 1) {
         throw new Exception\InvalidSignature("payload contains illegal characters");
     }
     Configuration::assertGlobalHasAccessTokenOrKeys();
     self::_validateSignature($signature, $payload);
     $xml = base64_decode($payload);
     $attributes = Xml::buildArrayFromXml($xml);
     return self::factory($attributes['notification']);
 }