mirror of
https://github.com/retailcrm/mailgun-php.git
synced 2025-02-18 05:43:15 +03:00
Support for new webhook endpoints (show)
This commit is contained in:
parent
1a5e3ceee8
commit
379cd2a36e
@ -33,8 +33,8 @@ final class ShowResponse implements ApiResponse
|
||||
return $model;
|
||||
}
|
||||
|
||||
public function getWebhookUrl(): ?string
|
||||
public function getWebhookUrls(): ?array
|
||||
{
|
||||
return $this->webhook['url'] ?? null;
|
||||
return $this->webhook['urls'] ?? null;
|
||||
}
|
||||
}
|
||||
|
36
tests/Model/Webhook/ShowResponseTest.php
Normal file
36
tests/Model/Webhook/ShowResponseTest.php
Normal file
@ -0,0 +1,36 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
/*
|
||||
* Copyright (C) 2013 Mailgun
|
||||
*
|
||||
* This software may be modified and distributed under the terms
|
||||
* of the MIT license. See the LICENSE file for details.
|
||||
*/
|
||||
|
||||
namespace Mailgun\Tests\Model\Webhook;
|
||||
|
||||
use Mailgun\Model\Webhook\ShowResponse;
|
||||
use Mailgun\Tests\Model\BaseModelTest;
|
||||
|
||||
class ShowResponseTest extends BaseModelTest
|
||||
{
|
||||
public function testHook1()
|
||||
{
|
||||
$json =
|
||||
<<<'JSON'
|
||||
{
|
||||
"webhook": {
|
||||
"urls": [
|
||||
"http:\/\/example.com\/hook_1"
|
||||
]
|
||||
}
|
||||
}
|
||||
|
||||
JSON;
|
||||
$model = ShowResponse::create(json_decode($json, true));
|
||||
|
||||
$this->assertContains('http://example.com/hook_1', $model->getWebhookUrls());
|
||||
}
|
||||
}
|
Loading…
x
Reference in New Issue
Block a user