forked from prebid/prebid-server
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Initial implementation for categories mapping files loading from filesystem * Unit tests fix, minor refactoring * File fetcher: changed filesystem traversal algorithm to recursive * Fix for categories unmarshalling: skip invalid category mapping files instead of throwing error * - Categories minor refactoring - Categories unit test added * -Removed categories as input parameter from AMP endpoint -Added unit test for FetchCategories -Code clean up * -Categories unit test clean up -File fetcher minor refactoring * Configuration fix * Code refactoring: -Changed FetchCategories signature, inluding all implementations and unit tests -Moved categories unmarshalling to FetchCategories * Code refactoring * Changed category mapping file for Freewheel * Code refactoring: -Stored requests directory is now configurable -Category mapping directory is now configurable -Changed FetchCategories signature -Unit tests refactoring * Initial implementation for categories mapping files loading from filesystem * Unit tests fix, minor refactoring * File fetcher: changed filesystem traversal algorithm to recursive * Fix for categories unmarshalling: skip invalid category mapping files instead of throwing error * - Categories minor refactoring - Categories unit test added * -Removed categories as input parameter from AMP endpoint -Added unit test for FetchCategories -Code clean up * -Categories unit test clean up -File fetcher minor refactoring * Configuration fix * Code refactoring: -Changed FetchCategories signature, inluding all implementations and unit tests -Moved categories unmarshalling to FetchCategories * Code refactoring * Changed category mapping file for Freewheel * Code refactoring: -Stored requests directory is now configurable -Category mapping directory is now configurable -Changed FetchCategories signature -Unit tests refactoring * Make a separate interface for CategoryFetcher (the Fetcher interface deals with stored requests and impressions). * Categories fetching code improvement * Fetch categories: added error handling for missing categories file and unit test for it * Initial version of appnexus adapter mapping an AppNexus brand to an IAB category (if no IAB category was returned in the bid response). * Store category mapping in a field in the adapter object so it gets loaded when the adapter is created, this way we know it won't try to be used before it's done loading. * Adding test cases to appnexus adapter for video bids with and without valid "brand_id" fields in the response to make sure mapping to an IAB category works as expected in both cases. * Storing custom options for adapters in static/adapter-options/ folder and moved category mapping for appnexus adapter into there. Config package attempts to read custom options for each adapter so this could be used for other adapter's specific options as well (although code needs to be change to pass them into the adapter constructor functions if so). * Move loading of adapter options file back into the adapter itself, but the file is in the static/adapter/appnexus folder instead of being alongside the code this time. * IAB to adserver category translation * Code refactoring: -Reused existing structures to unmarshal BidExtension -Removed check id category exist in BidExt.Prebid.Targeting.PrimaryCategory -Removed check if duration exist in BidExt.Prebid.Duration * Improve clarity of bad primary ad server setting error message. * Change MultiFetcher.FetchCategories() to loop through fetchers and return response when one is found or a NotFoundError otherwise. * Added missed parameter * Fixed unit test * Categories lazy unmarshalling * Categories lazy unmarshalling - added removing of unmarshalled file * Implements an AllFetcher interface to handle both types of fetchers * Minor code review fixes * Minor code review fixes
- Loading branch information
1 parent
99af2f9
commit 18bb081
Showing
37 changed files
with
1,326 additions
and
107 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 |
---|---|---|
|
@@ -112,6 +112,7 @@ | |
"crid": "29681110", | ||
"w": 300, | ||
"h": 250, | ||
"cat": ["IAB20-3"], | ||
"ext": { | ||
"appnexus": { | ||
"brand_id": 1, | ||
|
122 changes: 122 additions & 0 deletions
122
adapters/appnexus/appnexustest/exemplary/simple-video.json
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,122 @@ | ||
{ | ||
"mockBidRequest": { | ||
"id": "test-request-id", | ||
"imp": [ | ||
{ | ||
"id": "test-imp-id", | ||
"video": { | ||
"mimes": ["video/mp4"], | ||
"minduration": 15, | ||
"maxduration": 30, | ||
"protocols": [2, 3, 5, 6, 7, 8], | ||
"w": 940, | ||
"h": 560 | ||
}, | ||
"ext": { | ||
"bidder": { | ||
"placement_id": 10433394 | ||
} | ||
} | ||
} | ||
] | ||
}, | ||
|
||
"httpCalls": [ | ||
{ | ||
"expectedRequest": { | ||
"uri": "http://ib.adnxs.com/openrtb2", | ||
"body": { | ||
"id": "test-request-id", | ||
"imp": [ | ||
{ | ||
"id": "test-imp-id", | ||
"video": { | ||
"mimes": ["video/mp4"], | ||
"minduration": 15, | ||
"maxduration": 30, | ||
"protocols": [2, 3, 5, 6, 7, 8], | ||
"w": 940, | ||
"h": 560 | ||
}, | ||
"ext": { | ||
"appnexus": { | ||
"placement_id": 10433394 | ||
} | ||
} | ||
} | ||
] | ||
} | ||
}, | ||
"mockResponse": { | ||
"status": 200, | ||
"body": { | ||
"id": "test-request-id", | ||
"seatbid": [ | ||
{ | ||
"seat": "958", | ||
"bid": [{ | ||
"id": "7706636740145184841", | ||
"impid": "test-imp-id", | ||
"price": 0.500000, | ||
"adid": "29681110", | ||
"adm": "some-test-ad", | ||
"adomain": ["appnexus.com"], | ||
"iurl": "http://nym1-ib.adnxs.com/cr?id=29681110", | ||
"cid": "958", | ||
"crid": "29681110", | ||
"h": 250, | ||
"w": 300, | ||
"cat": ["IAB9-1"], | ||
"ext": { | ||
"appnexus": { | ||
"brand_id": 9, | ||
"auction_id": 8189378542222915032, | ||
"bid_ad_type": 1, | ||
"bidder_id": 2, | ||
"ranking_price": 0.000000 | ||
} | ||
} | ||
}] | ||
} | ||
], | ||
"bidid": "5778926625248726496", | ||
"cur": "USD" | ||
} | ||
} | ||
} | ||
], | ||
|
||
"expectedBidResponses": [ | ||
{ | ||
"currency": "USD", | ||
"bids": [ | ||
{ | ||
"bid": { | ||
"id": "7706636740145184841", | ||
"impid": "test-imp-id", | ||
"price": 0.5, | ||
"adm": "some-test-ad", | ||
"adid": "29681110", | ||
"adomain": ["appnexus.com"], | ||
"iurl": "http://nym1-ib.adnxs.com/cr?id=29681110", | ||
"cid": "958", | ||
"crid": "29681110", | ||
"w": 300, | ||
"h": 250, | ||
"cat": ["IAB9-1"], | ||
"ext": { | ||
"appnexus": { | ||
"brand_id": 9, | ||
"auction_id": 8189378542222915032, | ||
"bid_ad_type": 1, | ||
"bidder_id": 2, | ||
"ranking_price": 0.000000 | ||
} | ||
} | ||
}, | ||
"type": "video" | ||
} | ||
] | ||
} | ||
] | ||
} |
120 changes: 120 additions & 0 deletions
120
adapters/appnexus/appnexustest/exemplary/video-invalid-category.json
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,120 @@ | ||
{ | ||
"mockBidRequest": { | ||
"id": "test-request-id", | ||
"imp": [ | ||
{ | ||
"id": "test-imp-id", | ||
"video": { | ||
"mimes": ["video/mp4"], | ||
"minduration": 15, | ||
"maxduration": 30, | ||
"protocols": [2, 3, 5, 6, 7, 8], | ||
"w": 940, | ||
"h": 560 | ||
}, | ||
"ext": { | ||
"bidder": { | ||
"placement_id": 10433394 | ||
} | ||
} | ||
} | ||
] | ||
}, | ||
|
||
"httpCalls": [ | ||
{ | ||
"expectedRequest": { | ||
"uri": "http://ib.adnxs.com/openrtb2", | ||
"body": { | ||
"id": "test-request-id", | ||
"imp": [ | ||
{ | ||
"id": "test-imp-id", | ||
"video": { | ||
"mimes": ["video/mp4"], | ||
"minduration": 15, | ||
"maxduration": 30, | ||
"protocols": [2, 3, 5, 6, 7, 8], | ||
"w": 940, | ||
"h": 560 | ||
}, | ||
"ext": { | ||
"appnexus": { | ||
"placement_id": 10433394 | ||
} | ||
} | ||
} | ||
] | ||
} | ||
}, | ||
"mockResponse": { | ||
"status": 200, | ||
"body": { | ||
"id": "test-request-id", | ||
"seatbid": [ | ||
{ | ||
"seat": "958", | ||
"bid": [{ | ||
"id": "7706636740145184841", | ||
"impid": "test-imp-id", | ||
"price": 0.500000, | ||
"adid": "29681110", | ||
"adm": "some-test-ad", | ||
"adomain": ["appnexus.com"], | ||
"iurl": "http://nym1-ib.adnxs.com/cr?id=29681110", | ||
"cid": "958", | ||
"crid": "29681110", | ||
"h": 250, | ||
"w": 300, | ||
"ext": { | ||
"appnexus": { | ||
"brand_id": 99, | ||
"auction_id": 8189378542222915032, | ||
"bid_ad_type": 1, | ||
"bidder_id": 2, | ||
"ranking_price": 0.000000 | ||
} | ||
} | ||
}] | ||
} | ||
], | ||
"bidid": "5778926625248726496", | ||
"cur": "USD" | ||
} | ||
} | ||
} | ||
], | ||
|
||
"expectedBidResponses": [ | ||
{ | ||
"currency": "USD", | ||
"bids": [ | ||
{ | ||
"bid": { | ||
"id": "7706636740145184841", | ||
"impid": "test-imp-id", | ||
"price": 0.5, | ||
"adm": "some-test-ad", | ||
"adid": "29681110", | ||
"adomain": ["appnexus.com"], | ||
"iurl": "http://nym1-ib.adnxs.com/cr?id=29681110", | ||
"cid": "958", | ||
"crid": "29681110", | ||
"w": 300, | ||
"h": 250, | ||
"ext": { | ||
"appnexus": { | ||
"brand_id": 99, | ||
"auction_id": 8189378542222915032, | ||
"bid_ad_type": 1, | ||
"bidder_id": 2, | ||
"ranking_price": 0.000000 | ||
} | ||
} | ||
}, | ||
"type": "video" | ||
} | ||
] | ||
} | ||
] | ||
} |
Oops, something went wrong.