Skip to content

Commit 1979186

Browse files
authored
Merge pull request #44 from mxmCherry/master
OpenRTB 2.5 Source object added (BidRequest.source)
2 parents 87492d9 + 07fe175 commit 1979186

File tree

4 files changed

+40
-0
lines changed

4 files changed

+40
-0
lines changed

bidrequest.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@ type BidRequest struct {
3030
Bcat []string `json:"bcat,omitempty"` // Blocked Advertiser Categories.
3131
BAdv []string `json:"badv,omitempty"` // Array of strings of blocked toplevel domains of advertisers
3232
BApp []string `json:"bapp,omitempty"` // Block list of applications by their platform-specific exchange-independent application identifiers. On Android, these should be bundle or package names (e.g., com.foo.mygame). On iOS, these are numeric IDs.
33+
Source *Source `json:"source,omitempty"` // A Source object that provides data about the inventory source and which entity makes the final decision
3334
Regs *Regulations `json:"regs,omitempty"`
3435
Ext Extension `json:"ext,omitempty"`
3536

source.go

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
package openrtb
2+
3+
// Source object describes the nature and behavior of the entity that is the source of the bid request upstream from the exchange.
4+
type Source struct {
5+
FinalSaleDecision int `json:"fd,omitempty"` // Entity responsible for the final impression sale decision, where 0 = exchange, 1 = upstream source.
6+
TransactionID string `json:"tid,omitempty"` // Transaction ID that must be common across all participants in this bid request (e.g., potentially multiple exchanges).
7+
PaymentChain string `json:"pchain,omitempty"` // Payment ID chain string containing embedded syntax described in the TAG Payment ID Protocol v1.0.
8+
Ext Extension `json:"ext,omitempty"` // Placeholder for exchange-specific extensions to OpenRTB.
9+
}

source_test.go

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
package openrtb
2+
3+
import (
4+
. "github.com/onsi/ginkgo"
5+
. "github.com/onsi/gomega"
6+
)
7+
8+
var _ = Describe("Source", func() {
9+
var subject *Source
10+
11+
BeforeEach(func() {
12+
err := fixture("source", &subject)
13+
Expect(err).NotTo(HaveOccurred())
14+
})
15+
16+
It("should parse correctly", func() {
17+
Expect(subject).To(Equal(&Source{
18+
FinalSaleDecision: 1,
19+
TransactionID: "transaction-id",
20+
PaymentChain: "payment-chain",
21+
Ext: Extension("{}"),
22+
}))
23+
})
24+
})

testdata/source.json

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
{
2+
"fd": 1,
3+
"tid": "transaction-id",
4+
"pchain": "payment-chain",
5+
"ext": {}
6+
}

0 commit comments

Comments
 (0)