Skip to content

Commit

Permalink
added prebid versioning to rubicon adapter
Browse files Browse the repository at this point in the history
  • Loading branch information
snapwich committed Jan 31, 2017
1 parent 1d5710c commit 9e99198
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 5 deletions.
10 changes: 7 additions & 3 deletions src/adapters/rubicon.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,11 @@ import { ajax } from 'src/ajax';
import { STATUS } from 'src/constants';

const RUBICON_BIDDER_CODE = 'rubicon';
const INTEGRATION = 'pbjs.lite';

// use deferred function call since version isn't defined yet at this point
function getIntegration() {
return 'pbjs_lite_' + $$PREBID_GLOBAL$$.version;
}

// use protocol relative urls for http or https
const FASTLANE_ENDPOINT = '//fastlane.rubiconproject.com/a/api/fastlane.json';
Expand Down Expand Up @@ -121,7 +125,7 @@ function RubiconAdapter() {
page_url: !params.referrer ? utils.getTopWindowUrl() : params.referrer,
resolution: _getScreenResolution(),
account_id: params.accountId,
integration: INTEGRATION,
integration: getIntegration(),
timeout: bidderRequest.timeout - (Date.now() - bidderRequest.auctionStart + TIMEOUT_BUFFER),
stash_creatives: true,
ae_pass_through_parameters: params.video.aeParams,
Expand Down Expand Up @@ -201,7 +205,7 @@ function RubiconAdapter() {
'alt_size_ids', parsedSizes.slice(1).join(',') || undefined,
'p_pos', position,
'rp_floor', '0.01',
'tk_flint', INTEGRATION,
'tk_flint', getIntegration(),
'p_screen_res', _getScreenResolution(),
'kw', keywords,
'tk_user_key', userId
Expand Down
6 changes: 4 additions & 2 deletions test/spec/adapters/rubicon_spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@ import {parse as parseQuery} from 'querystring';

var CONSTANTS = require('src/constants.json');

const INTEGRATION = `pbjs_lite_v$prebid.version$`; // $prebid.version$ will be substituted in by gulp in built prebid

describe('the rubicon adapter', () => {

let sandbox,
Expand Down Expand Up @@ -222,7 +224,7 @@ describe('the rubicon adapter', () => {
'alt_size_ids': '43',
'p_pos': 'atf',
'rp_floor': '0.01',
'tk_flint': 'pbjs.lite',
'tk_flint': INTEGRATION,
'p_screen_res': /\d+x\d+/,
'tk_user_key': '12346',
'kw': 'a,b,c',
Expand Down Expand Up @@ -302,7 +304,7 @@ describe('the rubicon adapter', () => {
expect(post).to.have.property('page_url').that.is.a('string');
expect(post.resolution).to.match(/\d+x\d+/);
expect(post.account_id).to.equal('14062')
expect(post.integration).to.equal('pbjs.lite');
expect(post.integration).to.equal(INTEGRATION);
expect(post).to.have.property('timeout').that.is.a('number');
expect(post.timeout < 5000).to.equal(true);
expect(post.stash_creatives).to.equal(true);
Expand Down

0 comments on commit 9e99198

Please sign in to comment.