Skip to content

Commit

Permalink
Merge pull request bsm#44 from mxmCherry/master
Browse files Browse the repository at this point in the history
OpenRTB 2.5 Source object added (BidRequest.source)
  • Loading branch information
dim authored Jun 13, 2017
2 parents 87492d9 + 07fe175 commit 1979186
Show file tree
Hide file tree
Showing 4 changed files with 40 additions and 0 deletions.
1 change: 1 addition & 0 deletions bidrequest.go
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ type BidRequest struct {
Bcat []string `json:"bcat,omitempty"` // Blocked Advertiser Categories.
BAdv []string `json:"badv,omitempty"` // Array of strings of blocked toplevel domains of advertisers
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.
Source *Source `json:"source,omitempty"` // A Source object that provides data about the inventory source and which entity makes the final decision
Regs *Regulations `json:"regs,omitempty"`
Ext Extension `json:"ext,omitempty"`

Expand Down
9 changes: 9 additions & 0 deletions source.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
package openrtb

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

import (
. "github.com/onsi/ginkgo"
. "github.com/onsi/gomega"
)

var _ = Describe("Source", func() {
var subject *Source

BeforeEach(func() {
err := fixture("source", &subject)
Expect(err).NotTo(HaveOccurred())
})

It("should parse correctly", func() {
Expect(subject).To(Equal(&Source{
FinalSaleDecision: 1,
TransactionID: "transaction-id",
PaymentChain: "payment-chain",
Ext: Extension("{}"),
}))
})
})
6 changes: 6 additions & 0 deletions testdata/source.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"fd": 1,
"tid": "transaction-id",
"pchain": "payment-chain",
"ext": {}
}

0 comments on commit 1979186

Please sign in to comment.