Make part of the api oo and create oo skeleton
This commit is contained in:
@ -4,6 +4,7 @@
|
||||
namespace Ardent\PicnicApi;
|
||||
|
||||
|
||||
use Ardent\PicnicApi\Objects\ApiListTransformer;
|
||||
use GuzzleHttp\Client;
|
||||
use GuzzleHttp\RequestOptions;
|
||||
|
||||
@ -24,12 +25,24 @@ class PicnicClient
|
||||
|
||||
public function getCart()
|
||||
{
|
||||
return $this->get('cart');
|
||||
return ApiListTransformer::getObject($this->get('cart'));
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns all past and current deliveries of the user.
|
||||
*
|
||||
* @param bool $summary Return a summary (less data).
|
||||
* @param array $filters An array with the statusses of the deliveries. For example; ['COMPLETED'] will only get completed deliveries. Possible options include CURRENT, COMPLETED and CANCELLED.
|
||||
*/
|
||||
public function getDeliveries(bool $summary = false, array $filters = []): array
|
||||
{
|
||||
$summary = $summary ? '/summary' : '';
|
||||
return $this->post('deliveries' . $summary, $filters);
|
||||
}
|
||||
|
||||
public function search(string $term)
|
||||
{
|
||||
return $this->get(sprintf('search?search_term=%s', urlencode($term)));
|
||||
return ApiListTransformer::getObjects($this->get(sprintf('search?search_term=%s', urlencode($term))));
|
||||
}
|
||||
|
||||
private function post(string $url, array $data): array
|
||||
|
Reference in New Issue
Block a user