Skip to content
This repository was archived by the owner on Feb 4, 2025. It is now read-only.

Commit 74b9984

Browse files
authored
Merge pull request #19 from CyberfusionIO/feature/ssl-product-list
Allow additional parameters and use price object
2 parents 4ce85ce + 5ac9fde commit 74b9984

File tree

4 files changed

+30
-7
lines changed

4 files changed

+30
-7
lines changed

CHANGELOG.md

+10
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,16 @@ All notable changes to this project will be documented in this file.
55
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/). Please note this changelog affects
66
this package and not the Oxxa API.
77

8+
## [2.4.0]
9+
10+
### Added
11+
12+
- Allow additional parameters for the ssl products endpoint.
13+
14+
### Changed
15+
16+
- Moved pricing to a `Price` object.
17+
818
## [2.3.0]
919

1020
### Added

src/DataTransferObjects/Price.php

+12
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
<?php
2+
3+
namespace Cyberfusion\Oxxa\DataTransferObjects;
4+
5+
class Price
6+
{
7+
public function __construct(
8+
public int $period,
9+
public float $price,
10+
) {
11+
}
12+
}

src/Endpoints/ProductEndpoint.php

+7-6
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
namespace Cyberfusion\Oxxa\Endpoints;
44

55
use Cyberfusion\Oxxa\Contracts\Endpoint as EndpointContract;
6+
use Cyberfusion\Oxxa\DataTransferObjects\Price;
67
use Cyberfusion\Oxxa\Enum\StatusCode;
78
use Cyberfusion\Oxxa\Enum\Toggle;
89
use Cyberfusion\Oxxa\Models\SslProduct;
@@ -11,11 +12,11 @@
1112

1213
class ProductEndpoint extends Endpoint implements EndpointContract
1314
{
14-
public function sslProducts(): OxxaResult
15+
public function sslProducts(array $additionalParameters = []): OxxaResult
1516
{
1617
$xml = $this
1718
->client
18-
->request(['command' => 'ssl_product_list']);
19+
->request(array_merge(['command' => 'ssl_product_list'], $additionalParameters));
1920

2021
$statusCode = $this->getStatusCode($xml);
2122
$statusDescription = $this->getStatusDescription($xml);
@@ -36,10 +37,10 @@ public function sslProducts(): OxxaResult
3637
$sslNode
3738
->filter('pricing > period')
3839
->each(function (Crawler $periodNode) use (&$pricing) {
39-
$pricing[] = [
40-
'period' => (int) $periodNode->attr('months'),
41-
'price' => (float) $periodNode->filter('price')->text(),
42-
];
40+
$pricing[] = new Price(
41+
period: (int) $periodNode->attr('months'),
42+
price: (float) $periodNode->filter('price')->text(),
43+
);
4344
});
4445
}
4546

src/Oxxa.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ class Oxxa implements OxxaClient
1414
{
1515
private const TIMEOUT = 180;
1616

17-
private const VERSION = '2.3.0';
17+
private const VERSION = '2.4.0';
1818

1919
private const USER_AGENT = 'oxxa-api-client/'.self::VERSION;
2020

0 commit comments

Comments
 (0)