From 613767f4427f80426712596f609470ebac8fcf30 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Micha=C5=82=20Kowieski?= Date: Mon, 26 Apr 2021 13:42:44 +0200 Subject: [PATCH] feat: remove dpa (#15) --- CHANGELOG.md | 3 +++ src/ReportsApi.php | 57 --------------------------------------- tests/ReportsApiTest.php | 58 ++-------------------------------------- 3 files changed, 5 insertions(+), 113 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 10fa1dd..31403e2 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,6 @@ +# v7.0.0 +Remove `getDpaAccounts`, `getDpaStats`, `getDpaConversions` functions + # v6.0.0 Remove `getDpaCreatives` function diff --git a/src/ReportsApi.php b/src/ReportsApi.php index bc50ca9..6f901fa 100644 --- a/src/ReportsApi.php +++ b/src/ReportsApi.php @@ -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 */ diff --git a/tests/ReportsApiTest.php b/tests/ReportsApiTest.php index 3c2ce79..4461845 100644 --- a/tests/ReportsApiTest.php +++ b/tests/ReportsApiTest.php @@ -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 */ @@ -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'], @@ -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'],