-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #6 from gpl-ajackson/master
Implement Multi-Collo support
- Loading branch information
Showing
12 changed files
with
394 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
<?php | ||
|
||
namespace Imbue\SendCloud\Endpoints; | ||
|
||
use Imbue\SendCloud\Exceptions\ApiException; | ||
use Imbue\SendCloud\Resources\Collections\ParcelCollection; | ||
use Imbue\SendCloud\Resources\GenericStatus; | ||
use Imbue\SendCloud\Resources\Parcel; | ||
use Imbue\SendCloud\Resources\ParcelMulti; | ||
use Imbue\SendCloud\Resources\ResourceFactory; | ||
|
||
class ParcelMultiEndpoint extends AbstractEndpoint | ||
{ | ||
/** @var string */ | ||
protected $resourcePath = 'parcels'; | ||
|
||
/** | ||
* @return Parcel | ||
*/ | ||
protected function getResourceObject(): Parcel | ||
{ | ||
return new Parcel($this->client); | ||
} | ||
|
||
/** | ||
* @param $previous | ||
* @param $next | ||
* @return ParcelCollection | ||
*/ | ||
protected function getResourceCollectionObject($previous, $next): ParcelCollection | ||
{ | ||
return new ParcelCollection($this->client, $previous, $next); | ||
} | ||
|
||
/** | ||
* @param array $data | ||
* @return ParcelCollection | ||
* @throws ApiException | ||
*/ | ||
public function create(array $data = []): ParcelCollection | ||
{ | ||
return $this->restCreateCollection($data); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,53 @@ | ||
<?php | ||
|
||
namespace Imbue\SendCloud\Endpoints; | ||
|
||
use Imbue\SendCloud\Exceptions\ApiException; | ||
use Imbue\SendCloud\Resources\AbstractResource; | ||
use Imbue\SendCloud\Resources\Collections\AbstractCollection; | ||
use Imbue\SendCloud\Resources\Collections\ShippingProductCollection; | ||
use Imbue\SendCloud\Resources\ShippingProduct; | ||
|
||
class ShippingProductsEndpoint extends AbstractEndpoint | ||
{ | ||
/** @var string */ | ||
protected $resourcePath = 'shipping-products'; | ||
/** @var string */ | ||
protected $singleResourceKey = 'shipping_product'; | ||
|
||
/** | ||
* @return mixed | ||
*/ | ||
protected function getResourceObject(): ShippingProduct | ||
{ | ||
return new ShippingProduct($this->client); | ||
} | ||
|
||
/** | ||
* @return ShippingProductCollection | ||
*/ | ||
protected function getResourceCollectionObject(): ShippingProductCollection | ||
{ | ||
return new ShippingProductCollection(null, null); | ||
} | ||
|
||
/** | ||
* @param $id | ||
* @param array $filters | ||
* @return AbstractResource | ||
* @throws ApiException | ||
*/ | ||
public function get($id, array $filters = []) | ||
{ | ||
return $this->list($filters)->getArrayCopy()->get($id); | ||
} | ||
|
||
/** | ||
* @param $filters | ||
* @return array|AbstractCollection | ||
* @throws ApiException | ||
*/ | ||
public function list(array $filters = []) | ||
{ | ||
return $this->restList($filters); | ||
}} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,135 @@ | ||
<?php | ||
|
||
namespace Imbue\SendCloud\Resources; | ||
|
||
class AvailableShippingFunctionality | ||
{ | ||
/** @var (null|int)[] */ | ||
public $age_check; | ||
|
||
/** @var bool[] */ | ||
public $b2b; | ||
|
||
/** @var bool[] */ | ||
public $b2c; | ||
|
||
/** @var bool[] */ | ||
public $boxable; | ||
|
||
/** @var bool[] */ | ||
public $bulky_goods; | ||
|
||
/** @var (null|string)[] */ | ||
public $carrier_billing_type; | ||
|
||
/** @var (null|bool)[] */ | ||
public $cash_on_delivery; | ||
|
||
/** @var bool[] */ | ||
public $dangerous_goods; | ||
|
||
/** @var (null|int)[] */ | ||
public $delivery_attempts; | ||
|
||
/** @var (null|string)[] */ | ||
public $delivery_before; | ||
|
||
/** @var (null|string)[] */ | ||
public $delivery_deadline; | ||
|
||
/** @var bool[] */ | ||
public $direct_contract_only; | ||
|
||
/** @var bool[] */ | ||
public $eco_delivery; | ||
|
||
/** @var bool[] */ | ||
public $ers; | ||
|
||
/** @var (null|string)[] */ | ||
public $first_mile; | ||
|
||
/** @var bool[] */ | ||
public $flex_delivery; | ||
|
||
/** @var (null|string)[] */ | ||
public $form_factor; | ||
|
||
/** @var bool[] */ | ||
public $fragile_goods; | ||
|
||
/** @var bool[] */ | ||
public $fresh_goods; | ||
|
||
/** @var bool[] */ | ||
public $harmonized_label; | ||
|
||
/** @var bool[] */ | ||
public $id_check; | ||
|
||
/** @var (null|string)[] */ | ||
public $incoterm; | ||
|
||
/** @var (null|int)[] */ | ||
public $insurance; | ||
|
||
/** @var bool[] */ | ||
public $labelless; | ||
|
||
/** @var (null|string)[] */ | ||
public $last_mile; | ||
|
||
/** @var bool[] */ | ||
public $manually; | ||
|
||
/** @var bool[] */ | ||
public $multicollo; | ||
|
||
/** @var bool[] */ | ||
public $neighbor_delivery; | ||
|
||
/** @var bool[] */ | ||
public $non_conveyable; | ||
|
||
/** @var bool[] */ | ||
public $personalized_delivery; | ||
|
||
/** @var bool[] */ | ||
public $premium; | ||
|
||
/** @var (null|string)[] */ | ||
public $priority; | ||
|
||
/** @var bool[] */ | ||
public $registered_delivery; | ||
|
||
/** @var bool[] */ | ||
public $returns; | ||
|
||
/** @var (null|string)[] **/ | ||
public $segment; | ||
|
||
/** @var (null|string)[] */ | ||
public $service_area; | ||
|
||
/** @var bool[] */ | ||
public $signature; | ||
|
||
/** @var (null|string)[] */ | ||
public $size; | ||
|
||
/** @var bool[] */ | ||
public $sorted; | ||
|
||
/** @var bool[] */ | ||
public $surcharge; | ||
|
||
/** @var bool[] */ | ||
public $tracked; | ||
|
||
/** @var bool[] */ | ||
public $tyres; | ||
|
||
/** @var (null|string)[] */ | ||
public $weekend_delivery; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
<?php | ||
|
||
namespace Imbue\SendCloud\Resources\Collections; | ||
|
||
use Imbue\SendCloud\Resources\ShippingProduct; | ||
|
||
class ShippingProductCollection extends AbstractCollection | ||
{ | ||
/** | ||
* @return string | ||
*/ | ||
public function getCollectionResourceName() | ||
{ | ||
return 'shipping_products'; | ||
} | ||
|
||
/** | ||
* @return ShippingProduct | ||
*/ | ||
protected function createResourceObject(): ShippingProduct | ||
{ | ||
return new ShippingProduct($this->client); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
<?php | ||
|
||
namespace Imbue\SendCloud\Resources; | ||
|
||
class ShippingProduct extends AbstractResource | ||
{ | ||
/** @var string */ | ||
public $name; | ||
|
||
/** @var string */ | ||
public $code; | ||
|
||
/** @var string */ | ||
public $carrier; | ||
|
||
/** @var string */ | ||
public $service_points_carrier; | ||
|
||
/** @var WeightRange */ | ||
public $weight_range; | ||
|
||
/** @var AvailableShippingFunctionality[] */ | ||
public $available_functionalities; | ||
|
||
/** @var ShippingProductMethod[] */ | ||
public $methods; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
<?php | ||
|
||
namespace Imbue\SendCloud\Resources; | ||
|
||
class ShippingProductMethod | ||
{ | ||
/** @var int */ | ||
public $id; | ||
|
||
/** @var string */ | ||
public $name; | ||
|
||
/** @var AvailableShippingFunctionality */ | ||
public $functionalities; | ||
|
||
/** @var string */ | ||
public $shippingProductCode; | ||
|
||
/** @var ShippingProductMethodProperties */ | ||
public $properties; | ||
|
||
/** @var object */ | ||
public $leadTimeHours; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
<?php | ||
|
||
namespace Imbue\SendCloud\Resources; | ||
|
||
class ShippingProductMethodProperties | ||
{ | ||
/** @var int */ | ||
public $min_weight; | ||
|
||
/** @var int */ | ||
public $max_weight; | ||
|
||
/** @var ShippingProductMethodPropertiesMaxDimensions */ | ||
public $max_dimensions; | ||
} | ||
|
18 changes: 18 additions & 0 deletions
18
src/Resources/ShippingProductMethodPropertiesMaxDimensions.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
<?php | ||
|
||
namespace Imbue\SendCloud\Resources; | ||
|
||
class ShippingProductMethodPropertiesMaxDimensions | ||
{ | ||
/** @var int */ | ||
public $length; | ||
|
||
/** @var int */ | ||
public $width; | ||
|
||
/** @var int */ | ||
public $height; | ||
|
||
/** @var string */ | ||
public $unit; | ||
} |
Oops, something went wrong.