Skip to content
Closed
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
22 changes: 22 additions & 0 deletions adapters/rise/rise.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,14 @@ type adapter struct {
endpointURL string
}

type riseExtBidPrebid struct {
Meta *openrtb_ext.ExtBidPrebidMeta `json:"meta,omitempty"`
}

type riseExtBid struct {
Prebid *riseExtBidPrebid `json:"prebid,omitempty"`
}

func Builder(_ openrtb_ext.BidderName, config config.Adapter, _ config.Server) (adapters.Bidder, error) {
return &adapter{
endpointURL: config.Endpoint,
Expand Down Expand Up @@ -83,13 +91,27 @@ func (a *adapter) MakeBids(request *openrtb2.BidRequest, _ *adapters.RequestData
bidResponse.Bids = append(bidResponse.Bids, &adapters.TypedBid{
Bid: &seatBid.Bid[i],
BidType: bidType,
BidMeta: getBidMeta(bid),
})
}
}

return bidResponse, errs
}

func getBidMeta(bid openrtb2.Bid) *openrtb_ext.ExtBidPrebidMeta {
if len(bid.Ext) == 0 {
return nil
}

var bidExt riseExtBid
if err := jsonutil.Unmarshal(bid.Ext, &bidExt); err != nil || bidExt.Prebid == nil {
return nil
}

return bidExt.Prebid.Meta
}

func extractOrg(openRTBRequest *openrtb2.BidRequest) (string, error) {
var err error
for _, imp := range openRTBRequest.Imp {
Expand Down
121 changes: 121 additions & 0 deletions adapters/rise/risetest/exemplary/simple-banner-meta.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,121 @@
{
"mockBidRequest": {
"id": "test-request-id",
"imp": [
{
"id": "test-imp-id",
"banner": {
"format": [
{
"w": 300,
"h": 250
}
]
},
"ext": {
"bidder": {
"publisher_id": "72721"
}
}
}
]
},
"httpCalls": [
{
"expectedRequest": {
"uri": "http://localhost/prebid_server?publisher_id=72721",
"body": {
"id": "test-request-id",
"imp": [
{
"id": "test-imp-id",
"banner": {
"format": [
{
"w": 300,
"h": 250
}
]
},
"ext": {
"bidder": {
"publisher_id": "72721"
}
}
}
]
},
"impIDs": ["test-imp-id"]
},
"mockResponse": {
"status": 200,
"body": {
"id": "test-request-id",
"seatbid": [
{
"seat": "958",
"bid": [
{
"id": "7706636740145184841",
"impid": "test-imp-id",
"price": 1.5,
"adm": "some-test-ad",
"adomain": ["example.com"],
"crid": "29681110",
"h": 250,
"w": 300,
"mtype": 1,
"ext": {
"prebid": {
"meta": {
"advertiserDomains": ["example.com"],
"primaryCatId": "IAB1-1",
"secondaryCatIds": ["IAB1-2", "IAB1-3"]
}
}
}
}
]
}
],
"cur": "USD"
}
}
}
],
"expectedBidResponses": [
{
"currency": "USD",
"bids": [
{
"bid": {
"id": "7706636740145184841",
"impid": "test-imp-id",
"price": 1.5,
"adm": "some-test-ad",
"adomain": ["example.com"],
"crid": "29681110",
"w": 300,
"h": 250,
"mtype": 1,
"ext": {
"prebid": {
"meta": {
"advertiserDomains": ["example.com"],
"primaryCatId": "IAB1-1",
"secondaryCatIds": ["IAB1-2", "IAB1-3"]
}
}
}
},
"type": "banner",
"bidMeta": {
"advertiserDomains": ["example.com"],
"primaryCatId": "IAB1-1",
"secondaryCatIds": ["IAB1-2", "IAB1-3"]
}
}
]
}
]
}
Loading