Skip to content

Commit

Permalink
Bugfix Products endpoint, get Product/Method/Properties implemented t…
Browse files Browse the repository at this point in the history
…o allow collo assessment.
  • Loading branch information
Ash committed Nov 8, 2023
1 parent 8bf9299 commit 2bdc222
Show file tree
Hide file tree
Showing 6 changed files with 65 additions and 8 deletions.
7 changes: 3 additions & 4 deletions src/Endpoints/ShippingProductsEndpoint.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
class ShippingProductsEndpoint extends AbstractEndpoint
{
/** @var string */
protected $resourcePath = 'shipping_products';
protected $resourcePath = 'shipping-products';
/** @var string */
protected $singleResourceKey = 'shipping_product';

Expand Down Expand Up @@ -39,7 +39,7 @@ protected function getResourceCollectionObject(): ShippingProductCollection
*/
public function get($id, array $filters = [])
{
return $this->restRead($id, $filters);
return $this->list($filters)->getArrayCopy()->get($id);
}

/**
Expand All @@ -50,5 +50,4 @@ public function get($id, array $filters = [])
public function list(array $filters = [])
{
return $this->restList($filters);
}
}
}}
4 changes: 2 additions & 2 deletions src/Resources/ShippingProduct.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

namespace Imbue\SendCloud\Resources;

class ShippingProduct
class ShippingProduct extends AbstractResource
{
/** @var string */
public $name;
Expand All @@ -22,6 +22,6 @@ class ShippingProduct
/** @var AvailableShippingFunctionality[] */
public $available_functionalities;

/** @var ShippingMethod[] */
/** @var ShippingProductMethod[] */
public $methods;
}
24 changes: 24 additions & 0 deletions src/Resources/ShippingProductMethod.php
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;
}
16 changes: 16 additions & 0 deletions src/Resources/ShippingProductMethodProperties.php
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 src/Resources/ShippingProductMethodPropertiesMaxDimensions.php
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;
}
4 changes: 2 additions & 2 deletions src/Resources/WeightRange.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@
class WeightRange
{
/** @var int */
public $minWeight;
public $min_weight;

/** @var int */
public $maxWeight;
public $max_weight;
}

0 comments on commit 2bdc222

Please sign in to comment.