-
Notifications
You must be signed in to change notification settings - Fork 738
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
New Adapter: Loyal #3586
New Adapter: Loyal #3586
Conversation
Code coverage summaryNote:
loyalRefer here for heat map coverage report
|
adapters/loyal/loyal.go
Outdated
var bidderExt adapters.ExtImpBidder | ||
var loyalExt openrtb_ext.ImpExtLoyal | ||
|
||
if err = json.Unmarshal(reqCopy.Imp[0].Ext, &bidderExt); err != nil { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please make it clear in your docs PR that only the ext of the first impression is used and that the other exts are ignored.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don’t quite understand you, we create a separate request in a loop (41 line) for each Imp object.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ah, I see. Please change reqCopy.Imp[0].Ext
to imp.Ext
to avoid confusion. You'll avoid a dereference.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done
@@ -0,0 +1,14 @@ | |||
endpoint: "https://us-east-1.loyal.app/pserver" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do you have endpoints in other regions? Is only US traffic supported?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We do not have endpoints in other regions and only support US traffic
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Gotcha. Please add the following in this yaml file to declare US traffic only:
geoscope:
- USA
See https://docs.prebid.org/prebid-server/developers/add-new-bidder-go.html#bidder-info for further info on the geoscope.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done
adapters/loyal/loyal_test.go
Outdated
|
||
func TestJsonSamples(t *testing.T) { | ||
bidder, buildErr := Builder(openrtb_ext.BidderEmtv, config.Adapter{ | ||
Endpoint: "http://example.com/pserver"}, config.Server{ExternalUrl: "http://hosturl.com", GvlID: 1, DataCenter: "2"}) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice use of an obviously fake testing endpoint. Thank you.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
replaced
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This was a compliment, not a critique. Sorry if you interpreted this as sarcasm. We prefer the use of a fake testing endpoint in unit tests. Feel free to revert commit cf18f0e
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done
Code coverage summaryNote:
loyalRefer here for heat map coverage report
|
@@ -0,0 +1,14 @@ | |||
endpoint: "https://us-east-1.loyal.app/pserver" | |||
maintainer: | |||
email: "[email protected]" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@teqblaze Email is being sent from prebid team to verify [email protected]
address. Requesting to respond back on email thread.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
received response from loyal
team
adapters/loyal/loyal.go
Outdated
bidResponse := adapters.NewBidderResponseWithBidsCapacity(len(request.Imp)) | ||
bidResponse.Currency = response.Cur |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
by default line 130 will initialize bidResponse.Currency
as USD
reassigning bidResponse.Currency
on line 131 without checking response.Cur
length may overwrite bidResponse.Currency
with blank value
code block can be refactored as below
bidResponse := adapters.NewBidderResponseWithBidsCapacity(len(request.Imp))
if len(response.Cur) != 0 {
bidResponse.Currency = response.Cur
}
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done
adapters/loyal/loyal.go
Outdated
impsMappedByID := make(map[string]openrtb2.Imp, len(request.Imp)) | ||
for i, imp := range request.Imp { | ||
impsMappedByID[request.Imp[i].ID] = imp | ||
} | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
impsMappedByID
is not being used. should be removed
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done
@teqblaze should update json test
|
Code coverage summaryNote:
loyalRefer here for heat map coverage report
|
thanks for review, tests added |
adapters/loyal/loyal.go
Outdated
} | ||
|
||
func (a *adapter) MakeRequests(request *openrtb2.BidRequest, reqInfo *adapters.ExtraRequestInfo) ([]*adapters.RequestData, []error) { | ||
var err error |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
since scope of err
is within the loop, no need to err
outside for loop on line 42
line 48 and 52 could be modified as below:
if err := json.Unmarshal(imp.Ext, &bidderExt); err != nil {
errs = append(errs, err)
continue
}
if err := json.Unmarshal(bidderExt.Bidder, &loyalExt); err != nil {
errs = append(errs, err)
continue
}
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
updated
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
just one suggestion
Additionally, @teqblaze PTAL at #3586 (comment)
Code coverage summaryNote:
loyalRefer here for heat map coverage report
|
Code coverage summaryNote:
loyalRefer here for heat map coverage report
|
@teqblaze test suite is failing with following errors
|
Code coverage summaryNote:
loyalRefer here for heat map coverage report
|
@onkarvhanumante fixed |
Co-authored-by: loyal <[email protected]>
doc - prebid/prebid.github.io#5223