Skip to content

Commit

Permalink
Update to Guzzle 6.2
Browse files Browse the repository at this point in the history
  • Loading branch information
Dave North committed Jun 18, 2018
1 parent bceb311 commit 91bc677
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 15 deletions.
10 changes: 5 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
PHP module to send notification messages to VictorOps via the REST integration.


## Installing
## Installing

Via [Composer][1]

Expand All @@ -23,11 +23,11 @@ use Signiant\VictorOps\Notifier;
use Signiant\VictorOps\Messages\CustomMessage;
// Only the message level is mandatory
$voMsg = new CustomMessage('INFO');
$voMsg = new Signiant\VictorOps\Messages\CustomMessage('INFO');
$voConfig = ['endpoint_url' => 'YOUR_VO_REST_ENDPOINT', 'routing_key' => 'YOUR_VO_ROUTING_KEY'];
voEndpoint = new Notifier($voConfig);
voEndpoint->send(voMsg);
$voEndpoint = new Signiant\VictorOps\Notifier($voConfig);
$voEndpoint->send(voMsg);
```

### Customise the message
Expand All @@ -43,7 +43,7 @@ parameters allow you to customise the message.
6. Entity Is Host Setting

```
<?php
<?php
use Signiant\VictorOps\Messages\CustomMessage;
Expand Down
4 changes: 2 additions & 2 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,8 @@
}
],
"require": {
"php": ">=5.4",
"guzzlehttp/guzzle": "4.1.*@dev"
"php": ">=5.5",
"guzzlehttp/guzzle": "6.2.*@dev"
},
"require-dev": {
"phpunit/phpunit": "3.7.*"
Expand Down
13 changes: 5 additions & 8 deletions src/Signiant/VictorOps/Notifier.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ public function __construct($config)
$routing_key = "everyone";

if (is_array($config))
{
{
if (array_key_exists("routing_key",$config))
{
$routing_key = $config['routing_key'];
Expand All @@ -29,20 +29,17 @@ public function __construct($config)
{
throw (new MissingEndpointURLException('Config must be an array',2));
}

$endpointURL = $config['endpoint_url'] . "/" . $routing_key;

$this->endpoint = $endpointURL;

$this->client = new Client();
$this->client = new Client(['base_uri' => $endpointURL]);
}

public function send(Messages\Message $message)
{
$request = $this->client->createRequest('POST', $this->endpoint, [
'json' => $message()
]);
$this->client->send($request);
$this->client->post($this->endpoint, ['json' => $message()]);
}

}

0 comments on commit 91bc677

Please sign in to comment.