Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

[Notifier] add OvhCloud bridge#34540

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Merged

Conversation

antiseptikk
Copy link

QA
Branch?master
Bug fix?no
New feature?yes
Deprecations?no
TicketsSee#33687
LicenseMIT

This would add OvhCloud sms integration for the Notifier component.
Tested with 'ovh-eu' entrypoint.

Inspiration :https://github.com/ovh/php-ovh

COil reacted with thumbs up emoji
CHANGELOG
=========

5.0.0
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

5.1

/**
* @author Thomas Ferney <thomas.ferney@gmail.com>
*
* @experimental in 5.0
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

5.1

* @throws \Symfony\Contracts\HttpClient\Exception\ClientExceptionInterface
* @throws \Symfony\Contracts\HttpClient\Exception\RedirectionExceptionInterface
* @throws \Symfony\Contracts\HttpClient\Exception\ServerExceptionInterface
* @throws \Symfony\Contracts\HttpClient\Exception\TransportExceptionInterface
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

I think the@throws annotations can be removed

/**
* @author Thomas Ferney <thomas.ferney@gmail.com>
*
* @experimental in 5.0
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

5.1

Copy link
Contributor

@OskarStarkOskarStark left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

Thank you

parent::__construct($client, $dispatcher);
}

public function setHostByEndpoint(?string $endpoint): self
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

I find the method name confusing. What aboutsetEndpointName() instead?

$now = time() + $this->timeDelta;
$headers['X-Ovh-Timestamp'] = $now;

if (isset($this->consumerKey)) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

if (null === $this->consumerKey) {

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

If my assumption is right above, the condition must be removed and local variables should be used instead.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

The "consumerKey" is mandatory, so I think I can remove this condition.

If it's empty, it throws an TransportException with "Missing X-Ovh-Consumer header"
If it's undefined in the dsn, it throws an 500 with null instead of a string in __construct()

What do you think?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

indeed, that's always set, so you can remove the condition.


$headers['X-Ovh-Application'] = $this->applicationKey;

if (!isset($this->timeDelta)) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

if (null === $this->timeDelta) {

$response = $this->client->request(
'GET',
$endpoint
);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

Should be on one line

}

/**
* Calculate time delta between local machine and API's server.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

Calculates

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

Calculates the ...

$headers['X-Ovh-Application'] = $this->applicationKey;

if (!isset($this->timeDelta)) {
$this->calculateTimeDelta();
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

IIUC, this should be calculated for every email we sent as this class can be used in a long running process.

*/
private function calculateTimeDelta(): int
{
if (!isset($this->timeDelta)) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

Should be removed, if we call this method, it means that we want to compute the value.

);

$serverTimestamp = (int) (string) $response->getContent();
$this->timeDelta = $serverTimestamp - (int) time();
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

I would not set it here, but just return the value and store it in the calling code.

@@ -0,0 +1,12 @@
OvhCloud Notifier
===============
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

Missing=

@fabpotfabpotforce-pushed thefeature/ovhcloudsms-notifier branch fromb74f610 to76bfb85CompareFebruary 11, 2020 13:51
@fabpot
Copy link
Member

Thank you@antiseptikk.

fabpot added a commit that referenced this pull requestFeb 11, 2020
This PR was squashed before being merged into the 5.1-dev branch.Discussion----------[Notifier] add OvhCloud bridge| Q             | A| ------------- | ---| Branch?       | master| Bug fix?      | no| New feature?  | yes| Deprecations? | no| Tickets       | See#33687| License       | MITThis would add OvhCloud sms integration for the Notifier component.Tested with 'ovh-eu' entrypoint.Inspiration :https://github.com/ovh/php-ovhCommits-------76bfb85 [Notifier] add OvhCloud bridge
@fabpotfabpot merged commit76bfb85 intosymfony:masterFeb 11, 2020
@antiseptikkantiseptikk deleted the feature/ovhcloudsms-notifier branchFebruary 14, 2020 09:10
@nicolas-grekasnicolas-grekas modified the milestones:next,5.1May 4, 2020
@fabpotfabpot mentioned this pull requestMay 5, 2020
Sign up for freeto join this conversation on GitHub. Already have an account?Sign in to comment
Reviewers

@OskarStarkOskarStarkOskarStark approved these changes

@fabpotfabpotfabpot approved these changes

Assignees
No one assigned
Projects
None yet
Milestone
5.1
Development

Successfully merging this pull request may close these issues.

5 participants
@antiseptikk@fabpot@OskarStark@nicolas-grekas@carsonbot

[8]ページ先頭

©2009-2025 Movatter.jp