Beispiel #1
0
 /**
  * 
  * @param \Netcrash\Groupon\apiClient $api
  * @throws \Exception
  */
 public function __construct(\Netcrash\Groupon\apiClient $api)
 {
     if (!$api->getDivision() instanceof \Netcrash\Groupon\DataObject\Division) {
         throw new \Exception("No division found for request...");
     }
     $id = $api->getDivision()->getId();
     if (empty($id)) {
         throw new \Exception("No ID on Divsion");
     }
     if ($api->getVersion() > 1) {
         $this->addParam("division_id", $id);
     }
     return parent::__construct("deals", $api);
 }
Beispiel #2
0
 /**
  * 
  * @param string $type (deals, divisions)
  * @param \Groupon\apiClient $api
  * 
  */
 public function __construct($type, \Netcrash\Groupon\apiClient $api)
 {
     $this->url = str_replace("<VERSION>", $api->getVersion(), $this->url);
     $this->url .= "/" . $type;
     if ($api->getVersion() == "1" && $api->getDivision()) {
         $this->url = str_replace("/" . $type, $api->getDivision(), $this->url);
     }
     $this->url .= "." . $api->getDriver()->getContentType();
     $this->setApi($api);
 }