Skip to content

Commit

Permalink
Rubicon Bid Adapter remove rp_floor param if floor not set (#6062)
Browse files Browse the repository at this point in the history
* RP bid adapter update to not set rp_floor when floor param does not exist. Left logic to set rp_floor to value if above 0.01. If floor param exists and equals 0.01 or below, 0.01 will be passed

* Updated floor logic to be if a value is set greater than or equal to 0.01 then pass it otherwise dont set rp_floor
  • Loading branch information
mmoschovas authored Dec 2, 2020
1 parent 53b0ed0 commit bb501f0
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
2 changes: 1 addition & 1 deletion modules/rubiconBidAdapter.js
Original file line number Diff line number Diff line change
Expand Up @@ -460,7 +460,7 @@ export const spec = {
'zone_id': params.zoneId,
'size_id': parsedSizes[0],
'alt_size_ids': parsedSizes.slice(1).join(',') || undefined,
'rp_floor': (params.floor = parseFloat(params.floor)) > 0.01 ? params.floor : 0.01,
'rp_floor': (params.floor = parseFloat(params.floor)) >= 0.01 ? params.floor : undefined,
'rp_secure': '1',
'tk_flint': `${rubiConf.int_type || DEFAULT_INTEGRATION}_v$prebid.version$`,
'x_source.tid': bidRequest.transactionId,
Expand Down
10 changes: 5 additions & 5 deletions test/spec/modules/rubiconBidAdapter_spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -396,7 +396,10 @@ describe('the rubicon adapter', function () {
describe('to fastlane', function () {
it('should make a well-formed request object', function () {
sandbox.stub(Math, 'random').callsFake(() => 0.1);
let [request] = spec.buildRequests(bidderRequest.bids, bidderRequest);
let duplicate = Object.assign(bidderRequest);
duplicate.bids[0].params.floor = 0.01;

let [request] = spec.buildRequests(duplicate.bids, duplicate);
let data = parseQuery(request.data);

expect(request.url).to.equal('https://fastlane.rubiconproject.com/a/api/fastlane.json');
Expand Down Expand Up @@ -551,7 +554,7 @@ describe('the rubicon adapter', function () {
sandbox.stub(Math, 'random').callsFake(() => 0.1);
let [request] = spec.buildRequests(bidderRequest.bids, bidderRequest);

const referenceOrdering = ['account_id', 'site_id', 'zone_id', 'size_id', 'alt_size_ids', 'p_pos', 'rf', 'p_geo.latitude', 'p_geo.longitude', 'kw', 'tg_v.ucat', 'tg_v.lastsearch', 'tg_v.likes', 'tg_i.rating', 'tg_i.prodtype', 'tk_flint', 'x_source.tid', 'x_source.pchain', 'p_screen_res', 'rp_floor', 'rp_secure', 'tk_user_key', 'tg_fl.eid', 'slots', 'rand'];
const referenceOrdering = ['account_id', 'site_id', 'zone_id', 'size_id', 'alt_size_ids', 'p_pos', 'rf', 'p_geo.latitude', 'p_geo.longitude', 'kw', 'tg_v.ucat', 'tg_v.lastsearch', 'tg_v.likes', 'tg_i.rating', 'tg_i.prodtype', 'tk_flint', 'x_source.tid', 'x_source.pchain', 'p_screen_res', 'rp_secure', 'tk_user_key', 'tg_fl.eid', 'slots', 'rand'];

request.data.split('&').forEach((item, i) => {
expect(item.split('=')[0]).to.equal(referenceOrdering[i]);
Expand All @@ -566,7 +569,6 @@ describe('the rubicon adapter', function () {
'size_id': '15',
'alt_size_ids': '43',
'p_pos': 'atf',
'rp_floor': '0.01',
'rp_secure': /[01]/,
'rand': '0.1',
'tk_flint': INTEGRATION,
Expand Down Expand Up @@ -883,7 +885,6 @@ describe('the rubicon adapter', function () {
'size_id': '15',
'alt_size_ids': '43',
'p_pos': 'atf',
'rp_floor': '0.01',
'rp_secure': /[01]/,
'rand': '0.1',
'tk_flint': INTEGRATION,
Expand Down Expand Up @@ -2047,7 +2048,6 @@ describe('the rubicon adapter', function () {
'size_id': 15,
'alt_size_ids': '43',
'p_pos': 'atf',
'rp_floor': 0.01,
'rp_secure': /[01]/,
'tk_flint': INTEGRATION,
'x_source.tid': 'd45dd707-a418-42ec-b8a7-b70a6c6fab0b',
Expand Down

0 comments on commit bb501f0

Please sign in to comment.