-
Notifications
You must be signed in to change notification settings - Fork 853
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #514 from stripe/remi-add-reporting-resources
Add support for the Reporting resources
- Loading branch information
Showing
6 changed files
with
132 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
<?php | ||
|
||
namespace Stripe\Reporting; | ||
|
||
/** | ||
* Class ReportRun | ||
* | ||
* @property string $id | ||
* @property string $object | ||
* @property int $created | ||
* @property string $error | ||
* @property bool $livemode | ||
* @property mixed $parameters | ||
* @property string $report_type | ||
* @property mixed $result | ||
* @property string $status | ||
* @property int $succeeded_at | ||
* | ||
* @package Stripe\Reporting | ||
*/ | ||
class ReportRun extends \Stripe\ApiResource | ||
{ | ||
const OBJECT_NAME = "reporting.report_run"; | ||
|
||
use \Stripe\ApiOperations\All; | ||
use \Stripe\ApiOperations\Create; | ||
use \Stripe\ApiOperations\Retrieve; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
<?php | ||
|
||
namespace Stripe\Reporting; | ||
|
||
/** | ||
* Class ReportType | ||
* | ||
* @property string $id | ||
* @property string $object | ||
* @property int $data_available_end | ||
* @property int $data_available_start | ||
* @property string $name | ||
* @property int $updated | ||
* @property string $version | ||
* | ||
* @package Stripe\Reporting | ||
*/ | ||
class ReportType extends \Stripe\ApiResource | ||
{ | ||
const OBJECT_NAME = "reporting.report_type"; | ||
|
||
use \Stripe\ApiOperations\All; | ||
use \Stripe\ApiOperations\Retrieve; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
<?php | ||
|
||
namespace Stripe\Reporting; | ||
|
||
class ReportRunTest extends \Stripe\TestCase | ||
{ | ||
const TEST_RESOURCE_ID = 'frr_123'; | ||
|
||
public function testIsCreatable() | ||
{ | ||
$params = [ | ||
"parameters" => [ | ||
"connected_account" => "acct_123" | ||
], | ||
"report_type" => "activity.summary.1", | ||
]; | ||
|
||
$this->expectsRequest( | ||
'post', | ||
'/v1/reporting/report_runs', | ||
$params | ||
); | ||
$resource = ReportRun::create($params); | ||
$this->assertInstanceOf("Stripe\\Reporting\\ReportRun", $resource); | ||
} | ||
|
||
public function testIsListable() | ||
{ | ||
$this->expectsRequest( | ||
'get', | ||
'/v1/reporting/report_runs' | ||
); | ||
$resources = ReportRun::all(); | ||
$this->assertTrue(is_array($resources->data)); | ||
$this->assertInstanceOf("Stripe\\Reporting\\ReportRun", $resources->data[0]); | ||
} | ||
|
||
public function testIsRetrievable() | ||
{ | ||
$this->expectsRequest( | ||
'get', | ||
'/v1/reporting/report_runs/' . self::TEST_RESOURCE_ID | ||
); | ||
$resource = ReportRun::retrieve(self::TEST_RESOURCE_ID); | ||
$this->assertInstanceOf("Stripe\\Reporting\\ReportRun", $resource); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
<?php | ||
|
||
namespace Stripe\Reporting; | ||
|
||
class ReportTypeTest extends \Stripe\TestCase | ||
{ | ||
const TEST_RESOURCE_ID = 'activity.summary.1'; | ||
|
||
public function testIsListable() | ||
{ | ||
$this->expectsRequest( | ||
'get', | ||
'/v1/reporting/report_types' | ||
); | ||
$resources = ReportType::all(); | ||
$this->assertTrue(is_array($resources->data)); | ||
$this->assertInstanceOf("Stripe\\Reporting\\ReportType", $resources->data[0]); | ||
} | ||
|
||
public function testIsRetrievable() | ||
{ | ||
$this->expectsRequest( | ||
'get', | ||
'/v1/reporting/report_types/' . self::TEST_RESOURCE_ID | ||
); | ||
$resource = ReportType::retrieve(self::TEST_RESOURCE_ID); | ||
$this->assertInstanceOf("Stripe\\Reporting\\ReportType", $resource); | ||
} | ||
} |