Skip to content
This repository was archived by the owner on Jan 23, 2023. It is now read-only.

Commit eb30ad0

Browse files
authored
Merge pull request #53 from grayloon/product-attributes
Add All Product Attributes Endpoint
2 parents 5190ffa + 419c626 commit eb30ad0

File tree

2 files changed

+27
-0
lines changed

2 files changed

+27
-0
lines changed

src/Api/ProductAttributes.php

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,4 +14,20 @@ public function show($attribute)
1414
{
1515
return $this->get('/products/attributes/'.$attribute);
1616
}
17+
18+
/**
19+
* The list of Product Attributes.
20+
*
21+
* @param int $pageSize
22+
* @param int $currentPage
23+
*
24+
* @return array
25+
*/
26+
public function all($pageSize = 50, $currentPage = 1)
27+
{
28+
return $this->get('/products/attributes', [
29+
'searchCriteria[pageSize]' => $pageSize,
30+
'searchCriteria[currentPage]' => $currentPage,
31+
]);
32+
}
1733
}

tests/Api/ProductAttributesTest.php

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,4 +21,15 @@ public function test_can_call_magento_api_product_attributes_show()
2121

2222
$this->assertTrue($api->ok());
2323
}
24+
25+
public function test_can_call_magento_api_product_attributes_all()
26+
{
27+
Http::fake([
28+
'*rest/all/V1/products/attributes*' => Http::response([], 200),
29+
]);
30+
31+
$api = MagentoFacade::api('productAttributes')->all();
32+
33+
$this->assertTrue($api->ok());
34+
}
2435
}

0 commit comments

Comments
 (0)