public function buy($params = null)
    {
        $requestor = new Requestor($this->_apiKey);
        $url = $this->instanceUrl() . '/buy';

        if ($params instanceof Rate) {
            $clone = $params;
            unset($params);
            $params['carrier'] = $clone->carrier;
            $params['service'] = $clone->service;
        }

        list($response, $apiKey) = $requestor->request('post', $url, $params);
        $this->refreshFrom($response, $apiKey, false);

        return $this;
    }
public function buy($params = null)
    {
        $requestor = new Requestor($this->_apiKey);
        $url = $this->instanceUrl() . '/buy';

        if ($params instanceof Rate) {
            $clone = $params;
            unset($params);
            $params['carrier'] = $clone->carrier;
            $params['service'] = $clone->service;
        }

        list($response, $apiKey) = $requestor->request('post', $url, $params);
        $this->refreshFrom($response, $apiKey, false);

        return $this;
    }
public function buy ( $ params = null ) { $ requestor = new Requestor ( $ this -> _apiKey ) ; $ url = $ this -> instanceUrl ( ) . '/buy' ; if ( $ params instanceof Rate ) { $ clone = $ params ; unset ( $ params ) ; $ params [ 'carrier' ] = $ clone -> carrier ; $ params [ 'service' ] = $ clone -> service ; } list ( $ response , $ apiKey ) = $ requestor -> request ( 'post' , $ url , $ params ) ; $ this -> refreshFrom ( $ response , $ apiKey , false ) ; return $ this ; }
buy an order

@param mixed $params
@return $this
@throws \EasyPost\Error
buy an order