Skip to content

Commit ea15c35

Browse files
Merge pull request #13 from taylorfinnell/tunes
Add Media model
2 parents 779fef0 + a471aa6 commit ea15c35

File tree

3 files changed

+30
-0
lines changed

3 files changed

+30
-0
lines changed

src/hqtrivia/model/question.cr

+10
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,15 @@ module HqTrivia
66
class Question
77
include WebSocketMessage
88

9+
class QuestionMedia
10+
JSON.mapping({
11+
key: String,
12+
media_id: {key: "mediaId", type: String},
13+
type: {key: "type", type: String},
14+
content_type: {key: "contentType", type: String},
15+
})
16+
end
17+
918
JSON.mapping({
1019
type: String,
1120
ts: Time,
@@ -18,6 +27,7 @@ module HqTrivia
1827
question_number: {key: "questionNumber", type: Int32},
1928
question_count: {key: "questionCount", type: Int32},
2029
ask_time: {key: "askTime", type: Time},
30+
question_media: {key: "questionMedia", type: QuestionMedia?},
2131
c: Int32,
2232
sent: Time,
2333
})

src/hqtrivia/model/question_summary.cr

+10
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,15 @@ module HqTrivia
66
class QuestionSummary
77
include WebSocketMessage
88

9+
class QuestionMedia
10+
JSON.mapping({
11+
key: String,
12+
media_id: {key: "mediaId", type: String},
13+
type: {key: "type", type: String},
14+
content_type: {key: "contentType", type: String},
15+
})
16+
end
17+
918
JSON.mapping({
1019
type: String,
1120
ts: Time,
@@ -18,6 +27,7 @@ module HqTrivia
1827
your_answer_id: {key: "yourAnswerId", type: Int32},
1928
saved_by_extra_life: {key: "savedByExtraLife", type: Bool},
2029
extra_lives_remaining: {key: "extraLivesRemaining", type: Int32},
30+
question_media: {key: "questionMedia", type: QuestionMedia?},
2131
c: Int32,
2232
sent: Time,
2333
})

src/hqtrivia/model/show.cr

+10
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,15 @@ module HqTrivia
44
module Model
55
# The JSON response from hitting the 'https://api-quiz.hype.space/shows/now?type=hq' endpoint.
66
class Show
7+
class Media
8+
JSON.mapping({
9+
media_id: {type: String, key: "mediaId"},
10+
media_url: {type: String, key: "mediaUrl"},
11+
hash: {type: String, key: "hash"},
12+
size: {type: Int64, key: "size"},
13+
})
14+
end
15+
716
JSON.mapping({
817
active: Bool,
918
show_id: {type: Int32?, key: "showId"},
@@ -12,6 +21,7 @@ module HqTrivia
1221
prize: Int32?,
1322
show_type: {type: String?, key: "showType"},
1423
game_type: {type: String?, key: "gameType"},
24+
media: {type: Array(Media)?},
1525
})
1626

1727
def initialize(@active : Bool, @show_id : Int32?, @start_time : Time?,

0 commit comments

Comments
 (0)