Skip to content

Commit

Permalink
feat: convert all snake_case to camelCase (#74)
Browse files Browse the repository at this point in the history
  • Loading branch information
iamnewton authored May 14, 2021
1 parent 8312cc3 commit 9f035d0
Show file tree
Hide file tree
Showing 20 changed files with 245 additions and 314 deletions.
42 changes: 21 additions & 21 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ Even though the examples below point to a `node_modules` directory, you should p
const options = {
owner: "www.buyer.com",
name: "an-interest-group",
bidding_logic_url: "https://dsp.com/bidding",
biddingLogicUrl: "https://dsp.com/bidding",
};
// join an interest group
Expand All @@ -56,8 +56,8 @@ Even though the examples below point to a `node_modules` directory, you should p
const options = {
seller: "www.seller.com",
decision_logic_url: "https://ssp.com/auction",
interest_group_buyers: [
decisionLogicUrl: "https://ssp.com/auction",
interestGroupBuyers: [
"www.buyer1.com",
"www.buyer2.com",
],
Expand All @@ -69,7 +69,7 @@ Even though the examples below point to a `node_modules` directory, you should p

### Render the Ad

In the future, rendering an ad will be handled by the Fledge API and would be passed to a Fenced Frame (which hasn't be established yet). In the polyfill world, we don't have access to a Fenced Frame and so its required for the consumer of this library to create their own `iframe` and pass the results from the auction to it. Thankfully, we've created a temporary feature for you to handle this in a way that respects the intention of the proposal by keeping the results opaque in the form of a token that represents the winning ad `rendering_url`.
In the future, rendering an ad will be handled by the Fledge API and would be passed to a Fenced Frame (which hasn't be established yet). In the polyfill world, we don't have access to a Fenced Frame and so its required for the consumer of this library to create their own `iframe` and pass the results from the auction to it. Thankfully, we've created a temporary feature for you to handle this in a way that respects the intention of the proposal by keeping the results opaque in the form of a token that represents the winning ad `renderingUrl`.

```html
<script type="module">
Expand Down Expand Up @@ -104,13 +104,13 @@ The following is the data structure with types for the options:
```ts
interface AuctionOptions {
seller: typeof string;
decision_logic_url: typeof url;
interest_group_buyers: typeof array;
trusted_scoring_signals_url?; typeof url;
additional_bids?: typeof array;
auction_signals?: typeof object;
seller_signals?: typeof object;
per_buyer_signals?: typeof object;
decisionLogicUrl: typeof url;
interestGroupBuyers: typeof array;
trustedScoringSignalsUrl?; typeof url;
additionalBids?: typeof array;
auctionSignals?: typeof object;
sellerSignals?: typeof object;
perBuyerSignals?: typeof object;
}
```

Expand All @@ -130,11 +130,11 @@ The following is the data structure with types for the options:
interface InterestGroup {
owner: typeof string;
name: typeof string;
bidding_logic_url: typeof url;
daily_update_url?: typeof url;
trusted_bidding_signals_url?; typeof url;
trusted_bidding_signals_keys?: typeof array;
user_bidding_signals?: typeof object;
biddingLogicUrl: typeof url;
dailyUpdateUrl?: typeof url;
trustedBiddingSignalsUrl?; typeof url;
trustedBiddingSignalsKeys?: typeof array;
userBiddingSignals?: typeof object;
ads?: typeof array;
}
```
Expand All @@ -161,11 +161,11 @@ The following is the data structure with types for the options:
interface InterestGroup {
owner: typeof string;
name: typeof string;
bidding_logic_url?: typeof url;
daily_update_url?: typeof url;
trusted_bidding_signals_url?; typeof url;
trusted_bidding_signals_keys?: typeof array;
user_bidding_signals?: typeof object;
biddingLogicUrl?: typeof url;
dailyUpdateUrl?: typeof url;
trustedBiddingSignalsUrl?; typeof url;
trustedBiddingSignalsKeys?: typeof array;
userBiddingSignals?: typeof object;
ads?: typeof array;
}
```
Expand Down
52 changes: 26 additions & 26 deletions docs/.prototypes/es-modules/auction/scripts/auction.js
Original file line number Diff line number Diff line change
@@ -1,18 +1,18 @@
/* eslint-disable camelcase */
import { generate_bid } from './dsp.js';
import { score_ad } from './ssp.js';
import { generateBid } from './dsp.js';
import { scoreAd } from './ssp.js';

const interestGroup = {
owner: 'dsp.com',
name: 'nike-womens-running-shoes',
bidding_logic_url: 'dsp.com/nike/bid.js',
daily_update_url: 'dsp.com/nike/update',
trusted_bidding_signals_url: 'kv-server.com',
trusted_bidding_signals_keys: [
biddingLogicUrl: 'dsp.com/nike/bid.js',
dailyUpdateUrl: 'dsp.com/nike/update',
trustedBiddingSignalsUrl: 'kv-server.com',
trustedBiddingSignalsKeys: [
'budget',
'size',
],
user_bidding_signals: {
userBiddingSignals: {
timestamp: 123456789,
hostname: 'nike.com',
path: '/w/womens-running-shoes',
Expand All @@ -25,23 +25,23 @@ const interestGroup = {

const auctionConfig = {
seller: 'magnite.com',
decision_logic_url: 'magnite.com/espn/auction.js',
interest_group_buyers: [
decisionLogicUrl: 'magnite.com/espn/auction.js',
interestGroupBuyers: [
'www.tradedesk.com',
'nike.com',
],
additional_bids: [
additionalBids: [
'other_source_ad1',
'other_source_ad2',
],
auction_signals: {
auctionSignals: {
ad_size: '300x250',
publisher_id: 123456,
},
seller_signals: {
seller_Sgnals: {
price_floor: 0.50,
},
per_buyer_signals: {
perBuyerSignals: {
'www.tradedesk.com': {
base_price: 1.00,
},
Expand All @@ -51,39 +51,39 @@ const auctionConfig = {
},
};

const bid = generate_bid(
const bid = generateBid(
interestGroup,
auctionConfig.auction_signals,
auctionConfig.per_buyer_signals['nike.com'],
auctionConfig.auctionSignals,
auctionConfig.perBuyerSignals['nike.com'],
{
budget: 10,
size: '300x250',
},
{
top_window_hostname: 'www.example-publisher.com',
topWindowHostname: 'www.example-publisher.com',
seller: 'www.example-ssp.com',
join_count: 3,
bid_count: 17,
prev_wins: [
joinCount: 3,
bidCount: 17,
prevWins: [
[ 'time1', 'ad1' ],
[ 'time2', 'ad2' ],
],
},
);

const score = score_ad(
const score = scoreAd(
bid.ad,
bid.bid,
auctionConfig,
{
url: 'https://example.com/creative.html',
},
{
top_window_hostname: 'www.example-publisher.com',
interest_group_owner: 'www.example-dsp.com',
interest_group_name: 'womens-running-shoes',
ad_render_fingerprint: 'M0rNy1D5RVowjnpa',
bidding_duration_msec: 12,
topWindowHostname: 'www.example-publisher.com',
interestGroupOwner: 'www.example-dsp.com',
interestGroupName: 'womens-running-shoes',
adRenderFingerprint: 'M0rNy1D5RVowjnpa',
biddingDurationMsec: 12,
},
);

Expand Down
15 changes: 7 additions & 8 deletions docs/auction.html
Original file line number Diff line number Diff line change
Expand Up @@ -27,12 +27,11 @@ <h4>Render timing: <span id="render-stats" class="font-weight-normal"></span></h

const options = {
seller: 'publisher.example',
interest_group_buyers: '*',
decision_logic_url: 'https://entertaining-glitter-bowler.glitch.me/score.js',
// decision_logic_url: 'http://localhost:3000/test/e2e/mock/dl.js',
trusted_scoring_signals_url: 'http://localhost:3000/test/e2e/tss/',
additional_bids: [],
auction_signals: {
interestGroupBuyers: '*',
decisionLogicUrl: 'https://entertaining-glitter-bowler.glitch.me/score.js',
trustedScoringSignalsUrl: 'http://example.com/',
additionalBids: [],
auctionSignals: {
size: {
w: 300,
h: 200,
Expand All @@ -45,13 +44,13 @@ <h4>Render timing: <span id="render-stats" class="font-weight-normal"></span></h
],
location: 'atf',
},
seller_signals: {
sellerSignals: {
account_id: 1234,
site_id: 1234,
zone_id: 1234,
size_id: 123,
},
per_buyer_signals: {
perBuyerSignals: {
'dsp.com': {
content_quality: 230,
},
Expand Down
4 changes: 2 additions & 2 deletions docs/interest-groups.html
Original file line number Diff line number Diff line change
Expand Up @@ -50,15 +50,15 @@ <h3>Currently Joined</h3>
await fledge.joinAdInterestGroup({
owner: document.getElementById('owner').value,
name: document.getElementById('name').value,
bidding_logic_url: document.getElementById('url').value
biddingLogicUrl: document.getElementById('url').value
}, parseInt(document.getElementById('expiration').value), true);
};

document.getElementById("leave-ig").onclick = async function leaveGroup() {
await fledge.leaveAdInterestGroup({
owner: document.getElementById('owner').value,
name: document.getElementById('name').value,
bidding_logic_url: document.getElementById('url').value
biddingLogicUrl: document.getElementById('url').value
}, parseInt(document.getElementById('expiration').value), true);
};

Expand Down
Loading

0 comments on commit 9f035d0

Please sign in to comment.