예제 #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
파일: Product.php 프로젝트: stefandoorn/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)));
     }
     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();
 }