Skip to content

Commit 4c82f65

Browse files
committed
Bounce rules with id as param
1 parent 3bf3f8e commit 4c82f65

2 files changed

Lines changed: 14 additions & 14 deletions

File tree

src/Endpoint/BouncesClient.php

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -106,31 +106,31 @@ public function upsertRegex(array $data): array
106106
}
107107

108108
/**
109-
* Get a bounce regex rule by its hash.
109+
* Get a bounce regex rule by its id.
110110
*
111-
* GET /api/v2/bounces/regex/{regexHash}
111+
* GET /api/v2/bounces/regex/{ruleId}
112112
*
113-
* @param string $regexHash The regex hash
113+
* @param int $ruleId The regex id
114114
* @return array The regex data
115115
* @throws ApiException If an API error occurs
116116
*/
117-
public function getRegexByHash(string $regexHash): array
117+
public function getOne(int $ruleId): array
118118
{
119-
return $this->client->get('bounces/regex/' . rawurlencode($regexHash));
119+
return $this->client->get('bounces/regex/' . $ruleId);
120120
}
121121

122122
/**
123-
* Delete a bounce regex rule by its hash.
123+
* Delete a bounce regex rule by its id.
124124
*
125-
* DELETE /api/v2/bounces/regex/{regexHash}
125+
* DELETE /api/v2/bounces/regex/{ruleId}
126126
*
127-
* @param string $regexHash The regex hash
127+
* @param int $ruleId The regex id
128128
* @return array Empty response on success
129129
* @throws ApiException If an API error occurs
130130
*/
131-
public function deleteRegexByHash(string $regexHash): array
131+
public function delete(int $ruleId): array
132132
{
133-
return $this->client->delete('bounces/regex/' . rawurlencode($regexHash));
133+
return $this->client->delete('bounces/regex/' . $ruleId);
134134
}
135135

136136
/**

tests/Endpoint/BouncesClientTest.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -41,13 +41,13 @@ public function testCanUpsertGetAndDeleteRegex(): void
4141
$this->assertIsArray($created);
4242

4343
// If service returns regex_hash, try fetch + delete
44-
if (isset($created['regex_hash']) && is_string($created['regex_hash'])) {
45-
$hash = $created['regex_hash'];
46-
$fetched = $this->bouncesClient->getRegexByHash($hash);
44+
if (isset($created['id']) && is_int($created['id'])) {
45+
$ruleId = $created['id'];
46+
$fetched = $this->bouncesClient->getOne($ruleId);
4747
$this->assertIsArray($fetched);
4848

4949
// Delete may return empty array (204)
50-
$deleted = $this->bouncesClient->deleteRegexByHash($hash);
50+
$deleted = $this->bouncesClient->delete($ruleId);
5151
$this->assertIsArray($deleted);
5252
}
5353

0 commit comments

Comments
 (0)