Skip to content

Commit

Permalink
Updated plivo-php, Changed service names
Browse files Browse the repository at this point in the history
  • Loading branch information
toooni committed Mar 23, 2018
1 parent af6e449 commit d7e1364
Show file tree
Hide file tree
Showing 6 changed files with 27 additions and 30 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
composer.lock
composer.phar
vendor/
.idea/
16 changes: 9 additions & 7 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -36,11 +36,13 @@ invit_plivo:
## Example
```php
$this->get('invit.plivo')->play([
'call_uuid' => 'cf5fe5ff-9952-yyyy-xxxx-b75ff490ffff',
'urls' => 'https://s3-eu-west-1.amazonaws.com/waitsongbucket/wait.mp3',
'loop' => 'true',
'mix' => 'false',
'legs' => 'both'
]);
$this->get(PlivoApi::class)->getCalls()->play(
'cf5fe5ff-9952-yyyy-xxxx-b75ff490ffff',
['https://s3-eu-west-1.amazonaws.com/waitsongbucket/wait.mp3'],
[
'loop' => 'true',
'mix' => 'false',
'legs' => 'both',
]
);
```
4 changes: 2 additions & 2 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,10 @@
],
"minimum-stability": "stable",
"require": {
"php": "^5.6 || ^7.0",
"php": "^7.1",
"symfony/dependency-injection": "^2.7 || ^3.0",
"symfony/config": "^2.7 || ^3.0",
"plivo/plivo-php": "^1.1.7"
"plivo/plivo-php": "^4.0.0"
},
"autoload": {
"psr-0": {
Expand Down
19 changes: 5 additions & 14 deletions src/Invit/PlivoBundle/Helper/PlivoHelper.php
Original file line number Diff line number Diff line change
@@ -1,32 +1,23 @@
<?php
declare(strict_types=1);

namespace Invit\PlivoBundle\Helper;

use Plivo\RestAPI;
use Invit\PlivoBundle\Service\PlivoApi;
use Symfony\Component\HttpFoundation\Request;

class PlivoHelper
{
/**
* @var string
*/
private $authToken;

/**
* @param string $authToken
*/
public function __construct(string $authToken){
public function __construct(string $authToken)
{
$this->authToken = $authToken;
}

/**
* @param Request $request
*
* @return bool
*/
public function validateRequest(Request $request) : bool
{
return RestAPI::validate_signature(
return PlivoApi::validate_signature(
$request->getUri(),
$request->request->all(),
$request->headers->get('X-Plivo-Signature'),
Expand Down
9 changes: 2 additions & 7 deletions src/Invit/PlivoBundle/Resources/config/services.yml
Original file line number Diff line number Diff line change
@@ -1,14 +1,9 @@
parameters:
invit_plivo.class: Plivo\RestAPI

services:
invit.plivo:
class: '%invit_plivo.class%'
Invit\PlivoBundle\Service\PlivoApi:
arguments:
- '%invit_plivo.auth.auth_id%'
- '%invit_plivo.auth.auth_token%'

invit.plivo.helper:
class: Invit\PlivoBundle\Helper\PlivoHelper
Invit\PlivoBundle\Helper\PlivoHelper:
arguments:
- '%invit_plivo.auth.auth_token%'
8 changes: 8 additions & 0 deletions src/Invit/PlivoBundle/Service/PlivoApi.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
<?php
declare(strict_types=1);

namespace Invit\PlivoBundle\Service;

use Plivo\RestClient;

class PlivoApi extends RestClient {}

0 comments on commit d7e1364

Please sign in to comment.