Skip to content
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

Initial RhythmOne Prebid Server Adapter #704

Merged
merged 8 commits into from
Oct 15, 2018

Conversation

dineshkumarjayaram
Copy link
Contributor

Initial RhythmOne Prebid Server Adapter support

Copy link
Contributor

@dbemiller dbemiller left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks really solid overall.

Only one serious issue... the JSON schema should be more strict to validate incoming params better. All my other comments are just pointing out extra logic which you don't need because the Prebid Server core logic already handles it for you elsewhere.

)

type RhythmoneAdapter struct {
http *adapters.HTTPAdapter
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This field is unused... it can be deleted.

return "rhythmone"
}

func (a *RhythmoneAdapter) SkipNoCookies() bool {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Name() and SkipNoCookies() are legacy things... you don't need them.


validImpDataExists := false

for _, imp := range request.Imp {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You can delete this block. The adapters.EnforceBidderInfo() call in adapter_map makes sure your Imps have valid formats, according to your static/bidder-info/rhythmone.yaml definitions.

}
}

if !validImpDataExists {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same here. This is guaranteed by the EnforceBidderInfo() stuff.

if imp.Audio != nil {
continue
}
if imp.Native != nil {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

These two blocks can go away... audio/native aren't possible.

return mediaType
}

func NewRhythmoneAdapter(config *adapters.HTTPAdapterConfig, endpoint string) *RhythmoneAdapter {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This function is unused, and can be deleted.

@@ -61,5 +62,6 @@ func newAdapterMap(client *http.Client, cfg *config.Configuration, infos adapter
infos[string(openrtb_ext.BidderRubicon)]), client),
openrtb_ext.BidderSomoaudience: adaptBidder(adapters.EnforceBidderInfo(somoaudience.NewSomoaudienceBidder(cfg.Adapters[string(openrtb_ext.BidderSomoaudience)].Endpoint), infos[string(openrtb_ext.BidderSomoaudience)]), client),
openrtb_ext.BidderSovrn: adaptBidder(adapters.EnforceBidderInfo(sovrn.NewSovrnBidder(client, cfg.Adapters[string(openrtb_ext.BidderSovrn)].Endpoint), infos[string(openrtb_ext.BidderSovrn)]), client),
openrtb_ext.BidderRhythmone: adaptBidder(adapters.EnforceBidderInfo(rhythmone.NewRhythmoneBidder(client, cfg.Adapters[string(openrtb_ext.BidderRhythmone)].Endpoint), infos[string(openrtb_ext.BidderRhythmone)]), client),
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Alphabetize by key please.

@@ -37,6 +37,7 @@ const (
BidderRubicon BidderName = "rubicon"
BidderSomoaudience BidderName = "somoaudience"
BidderSovrn BidderName = "sovrn"
BidderRhythmone BidderName = "rhythmone"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

alphabetize by key please

an := NewRhythmoneSyncer("https://sync.1rx.io/usersync2/rmphb?redir=", "localhost")
syncInfo := an.GetUsersyncInfo("1", "BOPVK28OVJoTBABABAENBs-AAAAhuAKAANAAoACwAGgAPAAxAB0AHgAQAAiABOADkA")
url := "https://sync.1rx.io/usersync2/rmphb?redir=localhost%2Fsetuid%3Fbidder%3Drhythmone%26gdpr%3D1%26gdpr_consent%3DBOPVK28OVJoTBABABAENBs-AAAAhuAKAANAAoACwAGgAPAAxAB0AHgAQAAiABOADkA%26uid%3D%5BRX_UUID%5D"
assertStringsMatch(t, url, syncInfo.URL)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Use testify for cleaner assertions: https://godoc.org/github.com/stretchr/testify/assert

assert.Equal() should do the trick here.

openrtb_ext/imp.go Show resolved Hide resolved
@Rajeshk08
Copy link

Updated code review comments as per dbemiller.
Please review

Copy link
Contributor

@dbemiller dbemiller left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

One last unused param you should remove... otherwise LGTM

return mediaType
}

func NewRhythmoneBidder(client *http.Client, endpoint string) *RhythmoneAdapter {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

client is unused... please remove it.

@dineshkumarjayaram
Copy link
Contributor Author

Review comments incorporated, please review.

func (a *RhythmoneAdapter) preProcess(req *openrtb.BidRequest, errors []error) (*openrtb.BidRequest, string, []error) {
numRequests := len(req.Imp)

requestImpCopy := req.Imp
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Since req.Imp is a slice, and a slice is essentially a pointer to an existing array structure, requestImpCopy := req.Imp will end up referencing the same underlying array as req.Imp So it is not a true copy.

You only seem to use reqestImpCopy for imp := requestImpCopy[i], which will make imp a copy shallow of the original imp. So there does not seem to be a reason to define reqestImpCopy.

@dineshkumarjayaram
Copy link
Contributor Author

@hhhjort - Review comments incorporated, please review.

dbemiller
dbemiller previously approved these changes Oct 12, 2018
hhhjort
hhhjort previously approved these changes Oct 12, 2018
Rajeshk08
Rajeshk08 previously approved these changes Oct 15, 2018
@hhhjort
Copy link
Collaborator

hhhjort commented Oct 15, 2018

We have merge conflicts now

@hhhjort
Copy link
Collaborator

hhhjort commented Oct 15, 2018

DISREGARD

Ack, looks like an older PR that just merged is what actually caused the conflicts, and the change shouldn't have merged. Not sure why git merged it that way, but we should be keeping EnforceBidderInfo Will need to git that fixed, sorry for the confusion.

@hhhjort
Copy link
Collaborator

hhhjort commented Oct 15, 2018

Never mind the last comment, that change was a valid part of that PR, so it is needed. I just got a little confused.

Copy link
Member

@mkendall07 mkendall07 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM once merge conflicts are resolved.

@hhhjort hhhjort merged commit 7be7989 into prebid:master Oct 15, 2018
katsuo5 pushed a commit to flux-dev-team/prebid-server-1 that referenced this pull request Dec 1, 2020
* Initial RhythmOne Prebid Server Adapter

* Updated UserSync URL

* Fixed gofmt issue

* Code review comments updated, UserSync URL updated

* Updated code based on review comments - Removed unused client parameter in NewRhythmoneBidder method

* Incorporated review comments

* Updated adapter with resolved conflict
katsuo5 pushed a commit to flux-dev-team/prebid-server-1 that referenced this pull request Dec 2, 2020
* Initial RhythmOne Prebid Server Adapter

* Updated UserSync URL

* Fixed gofmt issue

* Code review comments updated, UserSync URL updated

* Updated code based on review comments - Removed unused client parameter in NewRhythmoneBidder method

* Incorporated review comments

* Updated adapter with resolved conflict
katsuo5 pushed a commit to flux-dev-team/prebid-server-1 that referenced this pull request Dec 4, 2020
* Initial RhythmOne Prebid Server Adapter

* Updated UserSync URL

* Fixed gofmt issue

* Code review comments updated, UserSync URL updated

* Updated code based on review comments - Removed unused client parameter in NewRhythmoneBidder method

* Incorporated review comments

* Updated adapter with resolved conflict
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants