Skip to content

Commit 8fdbe80

Browse files
author
Vu Pham
authored
Merge pull request #11 from UnityTech/APIN-1859
[APIN-1859] Loopme AR: Add CreativeType to ortb + tests
2 parents 84cfa71 + 5ec45f5 commit 8fdbe80

3 files changed

Lines changed: 64 additions & 0 deletions

File tree

bid.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,7 @@ type Bid struct {
4444
Exp int `json:"exp,omitempty"` // Advisory as to the number of seconds the bidder is willing to wait between the auction and the actual impression.
4545
ContentType string `json:"-"` // content of the bid
4646
MediaType string `json:"-"` // media of the impression e.g. video/display
47+
CreativeType string `json:"crtype"` // CreativeType specifically used by Loopme Mraid AR
4748
Ext Extension `json:"ext,omitempty"`
4849
}
4950

bid_test.go

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,3 +37,41 @@ var _ = Describe("Bid", func() {
3737
})
3838

3939
})
40+
41+
var _ = Describe("Loopme AR Bid", func() {
42+
var subject *Bid
43+
44+
BeforeEach(func() {
45+
err := fixture("bid.loopme.ar", &subject)
46+
Expect(err).NotTo(HaveOccurred())
47+
})
48+
49+
It("should parse correctly", func() {
50+
Expect(subject).To(Equal(&Bid{
51+
ID: "5d4b3b3be8250678c813f475",
52+
ImpID: "1",
53+
Price: 29.7,
54+
AdID: "2056515",
55+
NURL: "https://us.fake-url.com/tr?et=BID_WIN&a_ecp=29.7&a_price=${AUCTION_PRICE:BF}&name=imp_nurl",
56+
AdMarkup: "<img>",
57+
AdvDomain: []string{"unity.com"},
58+
IURL: "https://fake-url.net/assets/2690-e3c0-aa99-9efd38cd1fa6.jpg",
59+
CampaignID: "2001626",
60+
CreativeID: "2056515",
61+
Attr: []int{99},
62+
Protocol: 2,
63+
Cat: []string{"IAB19"},
64+
LURL: "https://fake-url.com?et=BID_LOSS&meta=&a_id=${AUCTION_ID}&a_bid_id=${AUCTION_BID_ID}&a_loss_id=${AUCTION_LOSS}",
65+
H: 320,
66+
W: 480,
67+
CreativeType: "MRAID AR",
68+
}))
69+
})
70+
71+
It("should validate", func() {
72+
Expect((&Bid{}).Validate()).To(Equal(ErrInvalidBidNoID))
73+
Expect((&Bid{ID: "BIDID"}).Validate()).To(Equal(ErrInvalidBidNoImpID))
74+
Expect(subject.Validate()).NotTo(HaveOccurred())
75+
})
76+
77+
})

testdata/bid.loopme.ar.json

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
{
2+
"id": "5d4b3b3be8250678c813f475",
3+
"impid": "1",
4+
"price": 29.7,
5+
"adid": "2056515",
6+
"nurl": "https://us.fake-url.com/tr?et=BID_WIN&a_ecp=29.7&a_price=${AUCTION_PRICE:BF}&name=imp_nurl",
7+
"adm": "<img>",
8+
"adomain": [
9+
"unity.com"
10+
],
11+
"iurl": "https://fake-url.net/assets/2690-e3c0-aa99-9efd38cd1fa6.jpg",
12+
"cid": "2001626",
13+
"crid": "2056515",
14+
"attr": [
15+
99
16+
],
17+
"protocol": 2,
18+
"cat": [
19+
"IAB19"
20+
],
21+
"lurl": "https://fake-url.com?et=BID_LOSS&meta=&a_id=${AUCTION_ID}&a_bid_id=${AUCTION_BID_ID}&a_loss_id=${AUCTION_LOSS}",
22+
"h": 320,
23+
"w": 480,
24+
"crtype": "MRAID AR"
25+
}

0 commit comments

Comments
 (0)