Skip to content

Commit 2bdc222

Browse files
author
Ash
committed
Bugfix Products endpoint, get Product/Method/Properties implemented to allow collo assessment.
1 parent 8bf9299 commit 2bdc222

6 files changed

Lines changed: 65 additions & 8 deletions

src/Endpoints/ShippingProductsEndpoint.php

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
class ShippingProductsEndpoint extends AbstractEndpoint
1212
{
1313
/** @var string */
14-
protected $resourcePath = 'shipping_products';
14+
protected $resourcePath = 'shipping-products';
1515
/** @var string */
1616
protected $singleResourceKey = 'shipping_product';
1717

@@ -39,7 +39,7 @@ protected function getResourceCollectionObject(): ShippingProductCollection
3939
*/
4040
public function get($id, array $filters = [])
4141
{
42-
return $this->restRead($id, $filters);
42+
return $this->list($filters)->getArrayCopy()->get($id);
4343
}
4444

4545
/**
@@ -50,5 +50,4 @@ public function get($id, array $filters = [])
5050
public function list(array $filters = [])
5151
{
5252
return $this->restList($filters);
53-
}
54-
}
53+
}}

src/Resources/ShippingProduct.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
namespace Imbue\SendCloud\Resources;
44

5-
class ShippingProduct
5+
class ShippingProduct extends AbstractResource
66
{
77
/** @var string */
88
public $name;
@@ -22,6 +22,6 @@ class ShippingProduct
2222
/** @var AvailableShippingFunctionality[] */
2323
public $available_functionalities;
2424

25-
/** @var ShippingMethod[] */
25+
/** @var ShippingProductMethod[] */
2626
public $methods;
2727
}
Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
<?php
2+
3+
namespace Imbue\SendCloud\Resources;
4+
5+
class ShippingProductMethod
6+
{
7+
/** @var int */
8+
public $id;
9+
10+
/** @var string */
11+
public $name;
12+
13+
/** @var AvailableShippingFunctionality */
14+
public $functionalities;
15+
16+
/** @var string */
17+
public $shippingProductCode;
18+
19+
/** @var ShippingProductMethodProperties */
20+
public $properties;
21+
22+
/** @var object */
23+
public $leadTimeHours;
24+
}
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
<?php
2+
3+
namespace Imbue\SendCloud\Resources;
4+
5+
class ShippingProductMethodProperties
6+
{
7+
/** @var int */
8+
public $min_weight;
9+
10+
/** @var int */
11+
public $max_weight;
12+
13+
/** @var ShippingProductMethodPropertiesMaxDimensions */
14+
public $max_dimensions;
15+
}
16+
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
<?php
2+
3+
namespace Imbue\SendCloud\Resources;
4+
5+
class ShippingProductMethodPropertiesMaxDimensions
6+
{
7+
/** @var int */
8+
public $length;
9+
10+
/** @var int */
11+
public $width;
12+
13+
/** @var int */
14+
public $height;
15+
16+
/** @var string */
17+
public $unit;
18+
}

src/Resources/WeightRange.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,8 @@
55
class WeightRange
66
{
77
/** @var int */
8-
public $minWeight;
8+
public $min_weight;
99

1010
/** @var int */
11-
public $maxWeight;
11+
public $max_weight;
1212
}

0 commit comments

Comments
 (0)