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

MobfoxBidAdapter compliant to prebid1.0 #1757

Merged
merged 14 commits into from
Nov 8, 2017
Merged

Conversation

hadarpeer
Copy link
Contributor

Type of change

  • Bugfix
  • Feature
  • New bidder adapter
  • Code style update (formatting, local variables)
  • Refactoring (no functional changes, no api changes)
  • Build related changes
  • CI related changes
  • Other

Description of change

  • test parameters for validating bids
{
  bidder: '<bidder name>',
  params: {
    // ...
  }
}

Be sure to test the integration with your adserver using the Hello World sample page.

  • contact email of the adapter’s maintainer
  • official adapter submission

Other information

Copy link
Collaborator

@jaiminpanchal27 jaiminpanchal27 left a comment

Choose a reason for hiding this comment

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

Left some comments.
Please add markdown file containing key information about the adapter
Template can be found here: http://prebid.org/dev-docs/bidder-adapter-1.html

let bidRequestData = bidRequest.data.split('&');
const bidResponse = {
requestId: bidRequest.requestId,
bidderCode: BIDDER_CODE,
Copy link
Collaborator

Choose a reason for hiding this comment

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

bidderCode can be removed, it will be added by bidderFactory.

};
},
interpretResponse: function (serverResponse, bidRequest) {
const bidResponses = [];
Copy link
Collaborator

Choose a reason for hiding this comment

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

#1742 got merged recently.

The first argument to interpretResponse now looks like this:

{
  body: responseBody,
  headers: {
    get: function(header) { /* returns a header from the HTTP response */ }
  }
}

You'll have to pull master and update the spec so that it looks digs into that object as well now.

}];

describe('test valid MF request success', function () {
let isValid = adapter.spec.isBidRequestValid(bidRequest[0]);
Copy link
Collaborator

Choose a reason for hiding this comment

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

Test cases need to be in it to be executed. As of now none of the tests are executed.
This https://gist.github.com/samwize/8877226 will be helpful

return bidResponse;
return bidResponses;
},
getUserSyncs: function (syncOptions) {
Copy link
Collaborator

Choose a reason for hiding this comment

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

getUserSyncs is optional. Can be removed

@hadarpeer
Copy link
Contributor Author

Hi, thanks for the comments. I made changes and added markdown file according the comments.

interpretResponse: function (serverResponse, bidRequest) {
const bidResponses = [];

if (!serverResponse || serverResponse.error) {
Copy link
Collaborator

Choose a reason for hiding this comment

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

Its LGTM except this one change.
I think you missed to update this condition. Your can access error response by serverResponse.body.error

@hadarpeer
Copy link
Contributor Author

Changed error filed. Thanks

Copy link
Collaborator

@jaiminpanchal27 jaiminpanchal27 left a comment

Choose a reason for hiding this comment

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

LGTM

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.

Gonna merge this, because I don't think either of my comments are blockers... but they're recommendations to modernize things a bit in a future changeset.

The code itself is pretty beautiful.

@@ -1,162 +1,142 @@
describe('mobfox adapter tests', function () {
describe('mobfox adapter tests', () => {
const expect = require('chai').expect;
const utils = require('src/utils');
const adapter = require('modules/mobfoxBidAdapter');
Copy link
Contributor

Choose a reason for hiding this comment

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

Should be ES6 imports now.

expect(bidResponse1.height).to.equal(bidderRequest.bids[0].sizes[0][1]);
});
});
let bidResponses = adapter.spec.interpretResponse(serverResponse, request);
Copy link
Contributor

Choose a reason for hiding this comment

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

should prefer const unless the variable is definitely being reassigned. Many of these are not.

@dbemiller dbemiller merged commit 9376885 into prebid:master Nov 8, 2017
dluxemburg pushed a commit to Genius/Prebid.js that referenced this pull request Jul 17, 2018
* Upgrade MobfoxAdapter to be compliant with Prebid 1.0 - missing cpm

* MfBidAdapter changes for preBid1.0

* Upgrade MobfoxAdapter to be compliant with Prebid 1.0 - final version

* removed accidentally added files

* Update MobfoxBidAdapter after review

* Update MobfoxBidAdapter after review - Final

* Add markdown file containing key information about Mobfox adapter

* Fix error field - under request in serverResponse
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants