public function renew(array $options = array())
 {
     if (!empty($options['events'])) {
         $this->setEvents($options['events']);
     }
     try {
         $response = $this->platform->put('/restapi/v1.0/subscription/' . $this->subscription['id'], null, array('eventFilters' => $this->getFullEventFilters()));
         $this->updateSubscription($response->getJson(false));
         $this->dispatch(self::EVENT_RENEW_SUCCESS, new SuccessEvent($response));
         return $this;
     } catch (Exception $e) {
         $this->unsubscribe();
         $this->dispatch(self::EVENT_RENEW_ERROR, new ErrorEvent($e));
         throw $e;
     }
 }
Ejemplo n.º 2
0
 function renew(array $options = array())
 {
     if (!empty($options['events'])) {
         $this->setEvents($options['events']);
     }
     if (!$this->subscribed()) {
         throw new Exception('No subscription');
     }
     try {
         $response = $this->_platform->put('/restapi/v1.0/subscription/' . $this->_subscription['id'], array('eventFilters' => $this->getFullEventFilters()));
         $this->setSubscription($response->jsonArray());
         $this->dispatch(self::EVENT_RENEW_SUCCESS, new SuccessEvent($response));
         return $this;
     } catch (Exception $e) {
         $this->reset();
         $this->dispatch(self::EVENT_RENEW_ERROR, new ErrorEvent($e));
         throw $e;
     }
 }