[Notifier] Simplify OVH implementation
This commit is contained in:
parent
5150fc51f6
commit
39f9ac2620
|
@ -26,9 +26,7 @@ use Symfony\Contracts\HttpClient\HttpClientInterface;
|
|||
*/
|
||||
final class OvhCloudTransport extends AbstractTransport
|
||||
{
|
||||
private $endpoints = [
|
||||
'ovh-eu' => 'https://eu.api.ovh.com/1.0',
|
||||
];
|
||||
protected const HOST = 'eu.api.ovh.com';
|
||||
|
||||
private $applicationKey;
|
||||
private $applicationSecret;
|
||||
|
@ -45,13 +43,6 @@ final class OvhCloudTransport extends AbstractTransport
|
|||
parent::__construct($client, $dispatcher);
|
||||
}
|
||||
|
||||
public function setEndpointName(?string $endpoint): self
|
||||
{
|
||||
$this->host = $this->endpoints[$endpoint] ?: self::HOST;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function __toString(): string
|
||||
{
|
||||
return sprintf('ovhcloud://%s?consumer_key=%s&service_name=%s', $this->getEndpoint(), $this->consumerKey, $this->serviceName);
|
||||
|
@ -68,7 +59,7 @@ final class OvhCloudTransport extends AbstractTransport
|
|||
throw new LogicException(sprintf('The "%s" transport only supports instances of "%s" (instance of "%s" given).', __CLASS__, SmsMessage::class, \get_class($message)));
|
||||
}
|
||||
|
||||
$endpoint = sprintf('%s/sms/%s/jobs', $this->getEndpoint(), $this->serviceName);
|
||||
$endpoint = sprintf('https://%s/1.0/sms/%s/jobs', $this->getEndpoint(), $this->serviceName);
|
||||
|
||||
$content = [
|
||||
'charset' => 'UTF-8',
|
||||
|
|
|
@ -34,7 +34,7 @@ final class OvhCloudTransportFactory extends AbstractTransportFactory
|
|||
$port = $dsn->getPort();
|
||||
|
||||
if ('ovhcloud' === $scheme) {
|
||||
return (new OvhCloudTransport($applicationKey, $applicationSecret, $consumerKey, $serviceName, $this->client, $this->dispatcher))->setEndpointName($host)->setPort($port);
|
||||
return (new OvhCloudTransport($applicationKey, $applicationSecret, $consumerKey, $serviceName, $this->client, $this->dispatcher))->setHost($host)->setPort($port);
|
||||
}
|
||||
|
||||
throw new UnsupportedSchemeException($dsn, 'ovhcloud', $this->getSupportedSchemes());
|
||||
|
|
Reference in New Issue