Skip to content

Commit a10703f

Browse files
committed
Merge branch 'master' of github.com:hailsryan/openrtb
2 parents 8bc583e + 4b107f1 commit a10703f

7 files changed

Lines changed: 68 additions & 0 deletions

File tree

bid.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,7 @@ type Bid struct {
4242
WRatio int `json:"wratio,omitempty"` // Relative width of the creative when expressing size as a ratio.
4343
HRatio int `json:"hratio,omitempty"` // Relative height of the creative when expressing size as a ratio.
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.
45+
ContentType string `json:"-"` // content of the bid
4546
Ext Extension `json:"ext,omitempty"`
4647
}
4748

impression.go

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ var (
1717
// subordinate to the Imp object indicates the type of impression being offered.
1818
type Impression struct {
1919
ID string `json:"id"` // A unique identifier for this impression
20+
Metric []*Metric `json:"metric,omitempty"`
2021
Banner *Banner `json:"banner,omitempty"`
2122
Video *Video `json:"video,omitempty"`
2223
Audio *Audio `json:"audio,omitempty"`
@@ -31,6 +32,7 @@ type Impression struct {
3132
Secure NumberOrString `json:"secure,omitempty"` // Flag to indicate whether the impression requires secure HTTPS URL creative assets and markup.
3233
Exp int `json:"exp,omitempty"` // Advisory as to the number of seconds that may elapse between the auction and the actual impression.
3334
IFrameBuster []string `json:"iframebuster,omitempty"` // Array of names for supportediframe busters.
35+
ContentType string `json:"-"` // Used to attribute bid to a content - not sent in request
3436
Ext Extension `json:"ext,omitempty"`
3537
}
3638

impression_test.go

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,18 @@ var _ = Describe("Impression", func() {
1616
It("should parse correctly", func() {
1717
Expect(subject).To(Equal(&Impression{
1818
ID: "1",
19+
Metric: []*Metric{
20+
{
21+
Type: "viewable_percentage_1",
22+
Value: 0.99,
23+
Vendor: "MOAT",
24+
},
25+
{
26+
Type: "viewable_percentage_2",
27+
Value: 0.98,
28+
Vendor: "MOAT",
29+
},
30+
},
1931
Banner: &Banner{
2032
W: 300,
2133
H: 250,

metric.go

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
package openrtb
2+
3+
// Metric object is associated with an impression as an array of metrics. These metrics can offer insight into
4+
// the impression to assist with decisioning such as average recent viewability, click-through rate, etc. Each
5+
// metric is identified by its type, reports the value of the metric, and optionally identifies the source or
6+
// vendor measuring the value.
7+
type Metric struct {
8+
Type string `json:"type"`
9+
Value float64 `json:"value"`
10+
Vendor string `json:"vendor"`
11+
Ext Extension `json:"ext,omitempty"`
12+
}

metric_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("Metric", func() {
9+
var metric *Metric
10+
11+
BeforeEach(func() {
12+
err := fixture("metric", &metric)
13+
Expect(err).NotTo(HaveOccurred())
14+
})
15+
16+
It("should parse correctly", func() {
17+
Expect(metric).To(Equal(&Metric{
18+
Type: "viewable_percentage",
19+
Value: 0.99,
20+
Vendor: "MOAT",
21+
}))
22+
})
23+
24+
})

testdata/impression.json

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,17 @@
11
{
22
"id": "1",
3+
"metric": [
4+
{
5+
"type": "viewable_percentage_1",
6+
"value": 0.99,
7+
"vendor": "MOAT"
8+
},
9+
{
10+
"type": "viewable_percentage_2",
11+
"value": 0.98,
12+
"vendor": "MOAT"
13+
}
14+
],
315
"banner": {
416
"h": 250,
517
"w": 300,

testdata/metric.json

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
{
2+
"type": "viewable_percentage",
3+
"value": 0.99,
4+
"vendor": "MOAT"
5+
}

0 commit comments

Comments
 (0)