Skip to content

Commit

Permalink
feat: remove dpa (#15)
Browse files Browse the repository at this point in the history
  • Loading branch information
Michał Kowieski authored Apr 26, 2021
1 parent bad5076 commit 613767f
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 113 deletions.
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
# v7.0.0
Remove `getDpaAccounts`, `getDpaStats`, `getDpaConversions` functions

# v6.0.0
Remove `getDpaCreatives` function

Expand Down
57 changes: 0 additions & 57 deletions src/ReportsApi.php
Original file line number Diff line number Diff line change
Expand Up @@ -333,63 +333,6 @@ function getRtbConversions(string $advHash, string $dayFrom, string $dayTo, stri
}


/**
* DPA methods
*/

/**
* @throws ReportsApiException
* @throws ReportsApiRequestException
*/
function getDpaAccounts(string $advHash): array
{
return $this->_get("advertisers/${advHash}/dpa/accounts");
}

/**
* @throws ReportsApiException
* @throws ReportsApiRequestException
*/
function getDpaStats(
string $advHash,
string $dayFrom, string $dayTo,
array $groupBy,
array $metrics,
?string $countConvention = null,
?string $subcampaigns = null,
?string $placement = null
) {
$params = [
'dayFrom' => $dayFrom,
'dayTo' => $dayTo,
'groupBy' => join('-', $groupBy),
'metrics' => join('-', $metrics)
];

if (!is_null($countConvention))
$params['countConvention'] = $countConvention;

if (!is_null($subcampaigns))
$params['subcampaigns'] = $subcampaigns;

if (!is_null($placement))
$params['placement'] = $placement;

return $this->_get("advertisers/${advHash}/dpa-stats", $params);
}

/**
* @throws ReportsApiException
* @throws ReportsApiRequestException
*/
function getDpaConversions(string $advHash, string $dayFrom, string $dayTo): array
{
return $this->_get("advertisers/${advHash}/dpa/conversions", [
'dayFrom' => $dayFrom,
'dayTo' => $dayTo,
]);
}

/**
* DPA + RTB Methods
*/
Expand Down
58 changes: 2 additions & 56 deletions tests/ReportsApiTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -388,60 +388,6 @@ function testGetRtbConversions()
}


/**
* DPA methods
*/

/**
* @depends testGetAdvertisers
* @throws ReportsApiRequestException
* @throws ReportsApiException
*/
function testGetDpaAccounts()
{
$dpaAccounts = self::$api->getDpaAccounts(self::$advertiser['hash']);
$this->assertNotEmpty($dpaAccounts);
$firstRow = $dpaAccounts[0];
$this->assertArrayHasKey('hash', $firstRow);
$this->assertArrayHasKey('name', $firstRow);

self::$dpaAccount = $firstRow;
}

/**
* @depends testGetAdvertisers
* @throws ReportsApiRequestException
* @throws ReportsApiException
*/
function testGetDpaStats()
{
$this->_validateGetRtbDpaSummaryStatsResponse(
self::$api->getDpaStats(
self::$advertiser['hash'],
DPA_DAY_FROM, DPA_DAY_TO,
['day'],
['impsCount', 'clicksCount'],
null
),
['day', 'impsCount', 'clicksCount']
);
}

/**
* @depends testGetAdvertisers
* @throws ReportsApiRequestException
* @throws ReportsApiException
*/
function testGetDpaConversions()
{
$dpaConversions = self::$api->getDpaConversions(self::$advertiser['hash'], DPA_DAY_FROM, DPA_DAY_TO);
$this->assertNotEmpty($dpaConversions);
$firstRow = $dpaConversions[0];
$this->assertArrayHasKey('conversionValue', $firstRow);
$this->assertArrayHasKey('conversionIdentifier', $firstRow);
}


/**
* RTB + DPA Methods
*/
Expand All @@ -454,7 +400,7 @@ function testGetDpaConversions()
function testGetSummaryStats1()
{
$this->_validateGetRtbDpaSummaryStatsResponse(
self::$api->getDpaStats(
self::$api->getSummaryStats(
self::$advertiser['hash'],
DAY_FROM, DAY_TO,
['day', 'subcampaign'],
Expand All @@ -473,7 +419,7 @@ function testGetSummaryStats1()
function testGetSummaryStats2()
{
$this->_validateGetRtbDpaSummaryStatsResponse(
self::$api->getDpaStats(
self::$api->getSummaryStats(
self::$advertiser['hash'],
DAY_FROM, DAY_TO,
['day', 'subcampaign'],
Expand Down

0 comments on commit 613767f

Please sign in to comment.