Skip to content

Commit de6e90d

Browse files
authored
Merge pull request bsm#54 from MadHive/master
Change type on Content.Context from int to NumberOrString
2 parents 8d41110 + fd328b9 commit de6e90d

File tree

3 files changed

+71
-26
lines changed

3 files changed

+71
-26
lines changed

content.go

Lines changed: 26 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -6,30 +6,30 @@ package openrtb
66
// knowledge of the page where the content is running, as a result of the syndication method. For
77
// example might be a video impression embedded in an iframe on an unknown web property or device.
88
type Content struct {
9-
ID string `json:"id,omitempty"` // ID uniquely identifying the content.
10-
Episode int `json:"episode,omitempty"` // Episode number (typically applies to video content).
11-
Title string `json:"title,omitempty"` // Content title.
12-
Series string `json:"series,omitempty"` // Content series.
13-
Season string `json:"season,omitempty"` // Content season.
14-
Artist string `json:"artist,omitempty"` // Artist credited with the content.
15-
Genre string `json:"genre,omitempty"` // Genre that best describes the content
16-
Album string `json:"album,omitempty"` // Album to which the content belongs; typically for audio.
17-
ISRC string `json:"isrc,omitempty"` // International Standard Recording Code conforming to ISO - 3901.
18-
Producer *Producer `json:"producer,omitempty"` // The producer.
19-
URL string `json:"url,omitempty"` // URL of the content, for buy-side contextualization or review.
20-
Cat []string `json:"cat,omitempty"` // Array of IAB content categories that describe the content.
21-
ProdQuality int `json:"prodq,omitempty"` // Production quality per IAB's classification.
22-
VideoQuality int `json:"videoquality,omitempty"` // Video quality per IAB's classification.
23-
Context int `json:"context,omitempty"` // Type of content (game, video, text, etc.).
24-
ContentRating string `json:"contentrating,omitempty"` // Content rating (e.g., MPAA).
25-
UserRating string `json:"userrating,omitempty"` // User rating of the content (e.g., number of stars, likes, etc.).
26-
QAGMediaRating int `json:"qagmediarating,omitempty"` // Media rating per QAG guidelines.
27-
Keywords string `json:"keywords,omitempty"` // Comma separated list of keywords describing the content.
28-
LiveStream int `json:"livestream,omitempty"` // 0 = not live, 1 = content is live (e.g., stream, live blog).
29-
SourceRelationship int `json:"sourcerelationship,omitempty"` // 0 = indirect, 1 = direct.
30-
Len int `json:"len,omitempty"` // Length of content in seconds; appropriate for video or audio.
31-
Language string `json:"language,omitempty"` // Content language using ISO-639-1-alpha-2.
32-
Embeddable int `json:"embeddable,omitempty"` // Indicator of whether or not the content is embeddable (e.g., an embeddable video player), where 0 = no, 1 = yes.
33-
Data []Data `json:"data,omitempty"` // Additional content data.
34-
Ext Extension `json:"ext,omitempty"`
9+
ID string `json:"id,omitempty"` // ID uniquely identifying the content.
10+
Episode int `json:"episode,omitempty"` // Episode number (typically applies to video content).
11+
Title string `json:"title,omitempty"` // Content title.
12+
Series string `json:"series,omitempty"` // Content series.
13+
Season string `json:"season,omitempty"` // Content season.
14+
Artist string `json:"artist,omitempty"` // Artist credited with the content.
15+
Genre string `json:"genre,omitempty"` // Genre that best describes the content
16+
Album string `json:"album,omitempty"` // Album to which the content belongs; typically for audio.
17+
ISRC string `json:"isrc,omitempty"` // International Standard Recording Code conforming to ISO - 3901.
18+
Producer *Producer `json:"producer,omitempty"` // The producer.
19+
URL string `json:"url,omitempty"` // URL of the content, for buy-side contextualization or review.
20+
Cat []string `json:"cat,omitempty"` // Array of IAB content categories that describe the content.
21+
ProdQuality int `json:"prodq,omitempty"` // Production quality per IAB's classification.
22+
VideoQuality int `json:"videoquality,omitempty"` // Video quality per IAB's classification.
23+
Context NumberOrString `json:"context,omitempty"` // Type of content (game, video, text, etc.).
24+
ContentRating string `json:"contentrating,omitempty"` // Content rating (e.g., MPAA).
25+
UserRating string `json:"userrating,omitempty"` // User rating of the content (e.g., number of stars, likes, etc.).
26+
QAGMediaRating int `json:"qagmediarating,omitempty"` // Media rating per QAG guidelines.
27+
Keywords string `json:"keywords,omitempty"` // Comma separated list of keywords describing the content.
28+
LiveStream int `json:"livestream,omitempty"` // 0 = not live, 1 = content is live (e.g., stream, live blog).
29+
SourceRelationship int `json:"sourcerelationship,omitempty"` // 0 = indirect, 1 = direct.
30+
Len int `json:"len,omitempty"` // Length of content in seconds; appropriate for video or audio.
31+
Language string `json:"language,omitempty"` // Content language using ISO-639-1-alpha-2.
32+
Embeddable int `json:"embeddable,omitempty"` // Indicator of whether or not the content is embeddable (e.g., an embeddable video player), where 0 = no, 1 = yes.
33+
Data []Data `json:"data,omitempty"` // Additional content data.
34+
Ext Extension `json:"ext,omitempty"`
3535
}

content_test.go

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,3 +26,32 @@ var _ = Describe("Content", func() {
2626
})
2727

2828
})
29+
30+
var _ = Describe("QuotedContent", func() {
31+
var subject *Content
32+
33+
BeforeEach(func() {
34+
err := fixture("content.quoted", &subject)
35+
Expect(err).NotTo(HaveOccurred())
36+
})
37+
38+
It("should parse correctly", func() {
39+
Expect(subject).To(Equal(&Content{
40+
Keywords: "Orwell, 1984",
41+
UserRating: "3",
42+
Episode: 1,
43+
Title: "This is the video title",
44+
URL: "http://cdnp.tremormedia.com/video/1984.flv",
45+
LiveStream: 0,
46+
ContentRating: "G",
47+
Len: 129,
48+
Series: "book reading",
49+
VideoQuality: 2,
50+
Context: 1,
51+
Season: "1",
52+
SourceRelationship: 0,
53+
ID: "eb9f13ede5fd225333971523f6042f9d",
54+
}))
55+
})
56+
57+
})

testdata/content.quoted.json

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
{
2+
"keywords": "Orwell, 1984",
3+
"userrating": "3",
4+
"episode": 1,
5+
"title": "This is the video title",
6+
"url": "http://cdnp.tremormedia.com/video/1984.flv",
7+
"livestream": 0,
8+
"contentrating": "G",
9+
"len": 129,
10+
"series": "book reading",
11+
"videoquality": 2,
12+
"context": "1",
13+
"season": "1",
14+
"sourcerelationship": 0,
15+
"id": "eb9f13ede5fd225333971523f6042f9d"
16+
}

0 commit comments

Comments
 (0)