Esempio n. 1
0
 public function subscribe(SubscriptionAttributes $attributes)
 {
     $attributes->setTopicName($this->topicName);
     $request = new SubscribeRequest($attributes);
     $response = new SubscribeResponse();
     return $this->client->sendRequest($request, $response);
 }
 public function parseResponse($statusCode, $content)
 {
     $this->statusCode = $statusCode;
     if ($statusCode == 200) {
         $this->succeed = TRUE;
     } else {
         $this->parseErrorResponse($statusCode, $content);
     }
     $xmlReader = $this->loadXmlContent($content);
     try {
         $this->attributes = SubscriptionAttributes::fromXML($xmlReader);
     } catch (\Exception $e) {
         throw new MnsException($statusCode, $e->getMessage(), $e);
     } catch (\Throwable $t) {
         throw new MnsException($statusCode, $t->getMessage());
     }
 }
Esempio n. 3
0
 public function __construct(SubscriptionAttributes $attributes)
 {
     parent::__construct('put', 'topics/' . $attributes->getTopicName() . '/subscriptions/' . $attributes->getSubscriptionName());
     $this->attributes = $attributes;
 }