示例#1
0
 public function getByProductId($id = null)
 {
     if ($id == null) {
         throw new InvalidParameterException('No product ID supplied');
     }
     $response = $this->client->getConnection()->get(Url::build(self::PATH, '/categories/' . $id));
     return $response->getBody()->getContents();
 }
示例#2
0
 /**
  * @param array $params
  * @param null $product_request_id
  * @return bool
  * @throws \Voradius\Exceptions\InvalidParameterException
  * @throws \Voradius\Exceptions\ParameterNotAllowedException
  */
 public function addReservation(array $params, $product_request_id = null)
 {
     $this->noNullParameters(isset($params['shop_id']) ?: null, isset($params['product_id']) ?: null);
     $this->notWhitelistedParameters($params, $this->searchWhitelist);
     $response = $this->client->getConnection()->post(Url::build('/product/iframe', '', ['shop_id' => $params['shop_id'], 'product_id' => $params['product_id'], 'product_request_id' => $product_request_id]), ['body' => $params]);
     if ($response->getStatusCode() === 200) {
         return true;
     }
     return false;
 }
示例#3
0
 /**
  * @param $first_name
  * @param $last_name
  * @param $email
  * @param $shop_id
  * @param $product_id
  * @param $phonenumber
  * @param null $product_request_id
  * @return bool
  */
 public function addReservation($first_name, $last_name, $email, $shop_id, $product_id, $phonenumber, $product_request_id = null)
 {
     $form_params = array('firstname' => $first_name, 'lastname' => $last_name, 'email' => $email, 'shop_id' => $shop_id, 'product_id' => $product_id, 'phone' => $phonenumber);
     $response = $this->client->getConnection()->post(Url::build('/product/iframe', '', ['shop_id' => $shop_id, 'product_id' => $product_id, 'product_request_id' => $product_request_id]), ['body' => $form_params]);
     if ($response->getStatusCode() == 200) {
         return true;
     } else {
         return false;
     }
 }
示例#4
0
文件: Product.php 项目: voradius/api
 /**
  * @param array $params
  * @return mixed
  * @throws InvalidParameterException
  * @throws ParameterNotAllowedException
  */
 public function getSearch(array $params)
 {
     if (empty($params)) {
         throw new InvalidParameterException('Atleast one parameter is required. Choose from: ' . implode(', ', array_keys($this->searchWhitelist)));
     }
     $this->notWhitelistedParameters($params, $this->searchWhitelist);
     if (!array_key_exists('term', $params)) {
         throw new InvalidParameterException('Parameter "term" is required');
     }
     $response = $this->client->getConnection()->get(Url::build(self::PATH, 'search', $params));
     return $response->getBody()->getContents();
 }
示例#5
0
 /**
  * @param array $params
  * @return mixed
  * @throws InvalidParameterException
  * @throws ParameterNotAllowedException
  */
 public function getSearch(array $params)
 {
     if (empty($params)) {
         throw new InvalidParameterException('Atleast one parameter is required. Choose from: ' . implode(', ', array_keys($this->searchWhitelist)));
     }
     foreach ($params as $key => $value) {
         if (!in_array($key, $this->searchWhitelist)) {
             throw new ParameterNotAllowedException('Parameter "' . $key . '" not allowed');
         }
     }
     if (!array_key_exists('term', $params)) {
         throw new InvalidParameterException('Parameter "term" is required');
     }
     $response = $this->client->getConnection()->get(Url::build(self::PATH, 'search', $params));
     return $response->getBody()->getContents();
 }
示例#6
0
文件: Shop.php 项目: stefandoorn/Api
 /**
  * @param null $id
  * @return mixed
  * @throws InvalidParameterException
  */
 public function getByUniqueId($id = null)
 {
     $this->noNullParameters($id);
     $response = $this->client->getConnection()->get(Url::build(self::PATH, 'unique', ['id' => $id]));
     return $response->getBody()->getContents();
 }
示例#7
0
文件: Scout.php 项目: voradius/api
 /**
  * Get a list of requests by email address
  *
  * @param $email Email of the user
  * @return mixed
  * @throws \Voradius\Exceptions\InvalidParameterException
  */
 public function getUserRequests($email)
 {
     $this->noNullParameters($email);
     $response = $this->client->getConnection()->get(Url::build(self::PATH . 's', 'list-by-email', ['email' => $email]));
     return $response->getBody()->getContents();
 }
示例#8
0
文件: Stock.php 项目: voradius/api
 /**
  * @param null $product_id
  * @param null $shop_id
  * @return mixed
  * @throws InvalidParameterException
  */
 public function get($product_id = null, $shop_id = null)
 {
     $this->noNullParameters($product_id, $shop_id);
     $response = $this->client->getConnection()->get(Url::build(self::PATH, $product_id . '/' . $shop_id));
     return $response->getBody()->getContents();
 }
示例#9
0
文件: Scout.php 项目: WuglyDev/Api
 /**
  * Get the shops IDS and there responses to the requests
  *
  * @param int $id Request ID
  * @return string JSON response of request details
  */
 public function getRequestDetail($id = null)
 {
     $this->noNullParameters($id);
     $response = $this->client->getConnection()->get(Url::build(self::PATH, $id . '/detail'));
     return $response->getBody()->getContents();
 }