Skip to content
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 our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: fix report url endpoint and add test #33

Merged
merged 3 commits into from
Aug 6, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion lib/Gr4vyConfig.php
Original file line number Diff line number Diff line change
Expand Up @@ -444,7 +444,7 @@ public function getReportExecution($report_execution_id) {
return $response;
}
public function generateReportDownloadUrl($report_id, $report_execution_id, $request = array()) {
$response = $this->post("/reports/". $report_id . "executions" . $report_execution_id, $request);
$response = $this->post("/reports/". $report_id . "/executions/" . $report_execution_id . "/url", $request);
return $response;
}
}
9 changes: 5 additions & 4 deletions test/Api/BuyersApiTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -172,13 +172,14 @@ public function testUpdateBuyer()
try {
$config = new Gr4vyConfig(self::$gr4vyId, self::$privateKeyLocation);

$buyer_request = array("external_identifier"=>"testAddBuyer3","display_name"=>"abc");
$buyer_request = array("external_identifier"=>"testAddBuyer6","display_name"=>"abc");
$result = $config->addBuyer($buyer_request);

$buyer_update = array("external_identifier"=>"testUpdateBuyer");
print_r($result);
$buyer_update = array("external_identifier"=>"testUpdateBuyer6");
$result = $config->updateBuyer($result["id"], $buyer_update);
print_r($result);
$this->assertArrayHasKey("id", $result);
$this->assertEquals($result["external_identifier"], "testUpdateBuyer");
$this->assertEquals($result["external_identifier"], "testUpdateBuyer6");

$result = $config->deleteBuyer($result["id"]);
$this->assertArrayHasKey("success", $result);
Expand Down
92 changes: 92 additions & 0 deletions test/Api/ReportsApiTest.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,92 @@
<?php
/**
* ReportsApiTest
* PHP version 7.2
*
* @category Class
* @package Gr4vy
* @author OpenAPI Generator team
* @link https://openapi-generator.tech
*/

/**
* Gr4vy API (Beta)
*
* Welcome to the Gr4vy API reference documentation. Our API is still very much a work in product and subject to change.
*
* The version of the OpenAPI document: 1.0
* Contact: [email protected]
* Generated by: https://openapi-generator.tech
* OpenAPI Generator version: 5.1.1-SNAPSHOT
*/

/**
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
* https://openapi-generator.tech
* Please update the test case below to test the endpoint.
*/

namespace Gr4vy\Test\Api;

use \Gr4vy\Gr4vyConfig;
use PHPUnit\Framework\TestCase;

/**
* ReportsApiTest Class Doc Comment
*
* @category Class
* @package Gr4vy
* @author OpenAPI Generator team
* @link https://openapi-generator.tech
*/
class ReportsApiTest extends TestCase
{
private static $privateKeyLocation = __DIR__ . "/../../private_key.pem";
private static $gr4vyId = "spider";

/**
* Setup before running any test cases
*/
public static function setUpBeforeClass(): void
{
}

/**
* Setup before running each test case
*/
public function setUp(): void
{
}

/**
* Clean up after running each test case
*/
public function tearDown(): void
{
}

/**
* Clean up after running all test cases
*/
public static function tearDownAfterClass(): void
{
}

/**
* Test case for generateReportDownloadUrl
*
* New transaction.
*
*/
public function testGenerateReportDownloadUrl()
{
try {
$config = new Gr4vyConfig(self::$gr4vyId, self::$privateKeyLocation);
$result = $config->generateReportDownloadUrl("5e7882ac-1bda-413f-9e78-4fcf650657da", "83770ad3-2465-4a74-8bd4-3aa80849cf4b");
$this->assertArrayHasKey("url", $result);
} catch (Exception $e) {
$this->fail("Exception thrown: " . $e->getMessage());
}
}

}
Loading