예제 #1
0
 /**
  * @param Pin $pin
  * @param string $method
  *
  * @throws Exception
  * @throws InvalidTimelineToken
  */
 private function pinRequest(Pin $pin, $method)
 {
     $body = null;
     if ($method === 'PUT') {
         $body = $pin->json();
     }
     $uri = trim($this->baseUri, '/') . '/v1/user/pins/' . $pin->id();
     $request = new Request($method, $uri, $this->getHeaders(), $body);
     try {
         $this->client->send($request);
     } catch (ClientException $exception) {
         $this->handleException($exception, $pin);
     } catch (ServerException $exception) {
         $this->handleException($exception, $pin);
     }
 }
예제 #2
0
 /**
  * Invalid Pin object
  *
  * @param Pin $pin
  */
 public function __construct(Pin $pin)
 {
     $this->pin = $pin;
     parent::__construct("Invalid Pin object: " . $pin->id());
 }