Skip to content
This repository has been archived by the owner on Mar 12, 2023. It is now read-only.

Commit

Permalink
Add Laravel 6 support
Browse files Browse the repository at this point in the history
  • Loading branch information
coxlr committed Sep 11, 2019
1 parent 94de1f7 commit 7a283b3
Show file tree
Hide file tree
Showing 6 changed files with 28 additions and 16 deletions.
2 changes: 1 addition & 1 deletion .env.example
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ RINGCENTRAL_SERVER_URL=
RINGCENTRAL_USERNAME=
RINGCENTRAL_OPERATOR_EXTENSION=
RINGCENTRAL_OPERATOR_PASSWORD=
RINGCENTRAL_RECEIVER=
RINGCENTRAL_ADMIN_EXTENSION=
RINGCENTRAL_ADMIN_PASSWORD=
RINGCENTRAL_RECEIVER=
RINGCENTRAL_RATE_LIMIT_SECONDS=0
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -5,3 +5,4 @@ composer.lock
.DS_Store
Thumbs.db
/.idea
.phpunit.result.cache
14 changes: 7 additions & 7 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,18 +10,18 @@
"authors": [
{
"name": "Lee Cox",
"email": "[email protected]"
"email": "[email protected]"
}
],
"require": {
"php": ">=7.1",
"illuminate/support": "^5.2",
"ringcentral/ringcentral-php": "dev-master"
"php": ">=7.1.3",
"illuminate/support": "~5.8.0|^6.0",
"ringcentral/ringcentral-php": "^2.1"
},
"require-dev": {
"phpunit/phpunit": "^7.0",
"orchestra/testbench": "^3.7",
"vlucas/phpdotenv": "^2.5"
"phpunit/phpunit": "^8.3",
"orchestra/testbench": "^4.0",
"vlucas/phpdotenv": "^3.6"
},
"autoload": {
"psr-4": {
Expand Down
17 changes: 13 additions & 4 deletions src/RingCentral.php
Original file line number Diff line number Diff line change
Expand Up @@ -254,12 +254,21 @@ public function getExtensions()

public function getMessages(string $extensionId = '~', ?object $fromDate = NULL, ?object $toDate = NULL, $perPage)
{
$r = $this->ringCentral->get('/account/~/extension/'.$extensionId.'/message-store', [
'dateFrom' => $fromDate ? $fromDate->format('c') : null,
'dateTo' => $toDate ? $toDate->format('c') : null,
$dates = [];

if($fromDate){
$dates['dateFrom'] = $fromDate->format('c');
}

if($toDate){
$dates['dateTo'] = $toDate->format('c');
}

$r = $this->ringCentral->get('/account/~/extension/'.$extensionId.'/message-store', array_merge([
'messageType' => 'SMS',
'perPage' => $perPage,
]);
], $dates
));

return $r->json()->records;
}
Expand Down
6 changes: 4 additions & 2 deletions tests/RingCentralAdminTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ class RingCentralAdminTest extends AbstractTestCase
/** @var Coxy121\RingCentralLaravel\RingCentral */
protected $ringCentral;

public function setUp()
public function setUp() : void
{
parent::setUp();

Expand All @@ -32,7 +32,9 @@ protected function loadEnvironmentVariables()
if (! file_exists(__DIR__.'/../.env')) {
return;
}
$dotenv = new Dotenv(__DIR__.'/..');

$dotenv = Dotenv::create(__DIR__.'/..');

$dotenv->load();
}

Expand Down
4 changes: 2 additions & 2 deletions tests/RingCentralOperatorTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ class RingCentralOperatorTest extends AbstractTestCase
/** @var Coxy121\RingCentralLaravel\RingCentral */
protected $ringCentral;

public function setUp()
public function setUp() : void
{
parent::setUp();

Expand All @@ -33,7 +33,7 @@ protected function loadEnvironmentVariables()
if (! file_exists(__DIR__.'/../.env')) {
return;
}
$dotenv = new Dotenv(__DIR__.'/..');
$dotenv = Dotenv::create(__DIR__.'/..');
$dotenv->load();
}

Expand Down

0 comments on commit 7a283b3

Please sign in to comment.