request('post', $url.'/create_and_buy', $params); return Util::convertToEasyPostObject($response, $apiKey); } /** * buy a batch * * @param mixed $params * @return $this * @throws \EasyPost\Error */ public function buy($params = null) { $requestor = new Requestor($this->_apiKey); $url = $this->instanceUrl() . '/buy'; list($response, $apiKey) = $requestor->request('post', $url, $params); $this->refreshFrom($response, $apiKey, true); return $this; } /** * @param mixed $params * @return $this * @throws \EasyPost\Error */ public function label($params = null) { $requestor = new Requestor($this->_apiKey); $url = $this->instanceUrl() . '/label'; list($response, $apiKey) = $requestor->request('post', $url, $params); $this->refreshFrom($response, $apiKey, true); return $this; } /** * remove shipments from a batch * * @param mixed $params * @return $this * @throws \EasyPost\Error */ public function remove_shipments($params = null) { $requestor = new Requestor($this->_apiKey); $url = $this->instanceUrl() . '/remove_shipments'; list($response, $apiKey) = $requestor->request('post', $url, $params); $this->refreshFrom($response, $apiKey, true); return $this; } /** * add shipments to a batch * * @param mixed $params * @return $this * @throws \EasyPost\Error */ public function add_shipments($params = null) { $requestor = new Requestor($this->_apiKey); $url = $this->instanceUrl() . '/add_shipments'; list($response, $apiKey) = $requestor->request('post', $url, $params); $this->refreshFrom($response, $apiKey, true); return $this; } /** * create a batch scan form * * @param mixed $params * @return mixed * @throws \EasyPost\Error */ public function create_scan_form($params = null) { $requestor = new Requestor($this->_apiKey); $url = $this->instanceUrl() . '/scan_form'; list($response, $apiKey) = $requestor->request('post', $url, $params); return Util::convertToEasyPostObject($response, $apiKey); } }