Skip to content

Commit

Permalink
Merge pull request bsm#54 from MadHive/master
Browse files Browse the repository at this point in the history
Change type on Content.Context from int to NumberOrString
  • Loading branch information
dim authored Sep 27, 2018
2 parents 8d41110 + fd328b9 commit de6e90d
Show file tree
Hide file tree
Showing 3 changed files with 71 additions and 26 deletions.
52 changes: 26 additions & 26 deletions content.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,30 +6,30 @@ package openrtb
// knowledge of the page where the content is running, as a result of the syndication method. For
// example might be a video impression embedded in an iframe on an unknown web property or device.
type Content struct {
ID string `json:"id,omitempty"` // ID uniquely identifying the content.
Episode int `json:"episode,omitempty"` // Episode number (typically applies to video content).
Title string `json:"title,omitempty"` // Content title.
Series string `json:"series,omitempty"` // Content series.
Season string `json:"season,omitempty"` // Content season.
Artist string `json:"artist,omitempty"` // Artist credited with the content.
Genre string `json:"genre,omitempty"` // Genre that best describes the content
Album string `json:"album,omitempty"` // Album to which the content belongs; typically for audio.
ISRC string `json:"isrc,omitempty"` // International Standard Recording Code conforming to ISO - 3901.
Producer *Producer `json:"producer,omitempty"` // The producer.
URL string `json:"url,omitempty"` // URL of the content, for buy-side contextualization or review.
Cat []string `json:"cat,omitempty"` // Array of IAB content categories that describe the content.
ProdQuality int `json:"prodq,omitempty"` // Production quality per IAB's classification.
VideoQuality int `json:"videoquality,omitempty"` // Video quality per IAB's classification.
Context int `json:"context,omitempty"` // Type of content (game, video, text, etc.).
ContentRating string `json:"contentrating,omitempty"` // Content rating (e.g., MPAA).
UserRating string `json:"userrating,omitempty"` // User rating of the content (e.g., number of stars, likes, etc.).
QAGMediaRating int `json:"qagmediarating,omitempty"` // Media rating per QAG guidelines.
Keywords string `json:"keywords,omitempty"` // Comma separated list of keywords describing the content.
LiveStream int `json:"livestream,omitempty"` // 0 = not live, 1 = content is live (e.g., stream, live blog).
SourceRelationship int `json:"sourcerelationship,omitempty"` // 0 = indirect, 1 = direct.
Len int `json:"len,omitempty"` // Length of content in seconds; appropriate for video or audio.
Language string `json:"language,omitempty"` // Content language using ISO-639-1-alpha-2.
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.
Data []Data `json:"data,omitempty"` // Additional content data.
Ext Extension `json:"ext,omitempty"`
ID string `json:"id,omitempty"` // ID uniquely identifying the content.
Episode int `json:"episode,omitempty"` // Episode number (typically applies to video content).
Title string `json:"title,omitempty"` // Content title.
Series string `json:"series,omitempty"` // Content series.
Season string `json:"season,omitempty"` // Content season.
Artist string `json:"artist,omitempty"` // Artist credited with the content.
Genre string `json:"genre,omitempty"` // Genre that best describes the content
Album string `json:"album,omitempty"` // Album to which the content belongs; typically for audio.
ISRC string `json:"isrc,omitempty"` // International Standard Recording Code conforming to ISO - 3901.
Producer *Producer `json:"producer,omitempty"` // The producer.
URL string `json:"url,omitempty"` // URL of the content, for buy-side contextualization or review.
Cat []string `json:"cat,omitempty"` // Array of IAB content categories that describe the content.
ProdQuality int `json:"prodq,omitempty"` // Production quality per IAB's classification.
VideoQuality int `json:"videoquality,omitempty"` // Video quality per IAB's classification.
Context NumberOrString `json:"context,omitempty"` // Type of content (game, video, text, etc.).
ContentRating string `json:"contentrating,omitempty"` // Content rating (e.g., MPAA).
UserRating string `json:"userrating,omitempty"` // User rating of the content (e.g., number of stars, likes, etc.).
QAGMediaRating int `json:"qagmediarating,omitempty"` // Media rating per QAG guidelines.
Keywords string `json:"keywords,omitempty"` // Comma separated list of keywords describing the content.
LiveStream int `json:"livestream,omitempty"` // 0 = not live, 1 = content is live (e.g., stream, live blog).
SourceRelationship int `json:"sourcerelationship,omitempty"` // 0 = indirect, 1 = direct.
Len int `json:"len,omitempty"` // Length of content in seconds; appropriate for video or audio.
Language string `json:"language,omitempty"` // Content language using ISO-639-1-alpha-2.
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.
Data []Data `json:"data,omitempty"` // Additional content data.
Ext Extension `json:"ext,omitempty"`
}
29 changes: 29 additions & 0 deletions content_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -26,3 +26,32 @@ var _ = Describe("Content", func() {
})

})

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

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

It("should parse correctly", func() {
Expect(subject).To(Equal(&Content{
Keywords: "Orwell, 1984",
UserRating: "3",
Episode: 1,
Title: "This is the video title",
URL: "http://cdnp.tremormedia.com/video/1984.flv",
LiveStream: 0,
ContentRating: "G",
Len: 129,
Series: "book reading",
VideoQuality: 2,
Context: 1,
Season: "1",
SourceRelationship: 0,
ID: "eb9f13ede5fd225333971523f6042f9d",
}))
})

})
16 changes: 16 additions & 0 deletions testdata/content.quoted.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
{
"keywords": "Orwell, 1984",
"userrating": "3",
"episode": 1,
"title": "This is the video title",
"url": "http://cdnp.tremormedia.com/video/1984.flv",
"livestream": 0,
"contentrating": "G",
"len": 129,
"series": "book reading",
"videoquality": 2,
"context": "1",
"season": "1",
"sourcerelationship": 0,
"id": "eb9f13ede5fd225333971523f6042f9d"
}

0 comments on commit de6e90d

Please sign in to comment.