class HQTrivia::Schedule::Show
The Schedule Show
Class. This is a show on the schedule
Public Class Methods
@param data [JSON] the data. @!visibility private
# File lib/hqtrivia/schedule/show.rb, line 5 def initialize(data) @data = data end
Public Instance Methods
The accent color displayed in the app. @return [String] the accent color.
# File lib/hqtrivia/schedule/show.rb, line 70 def accent_color @data['display']['accentColor'] end
The background image displayed in the app. @return [String] the background image.
# File lib/hqtrivia/schedule/show.rb, line 94 def background_image @data['display']['bgImage'] end
The background video displayed in the app. @return [String] the background video.
# File lib/hqtrivia/schedule/show.rb, line 100 def background_video @data['display']['bgVideo'] end
@return [String] the currency the prize will be in
# File lib/hqtrivia/schedule/show.rb, line 115 def currency @data['currency'] end
The description displayed in the app. @return [String] the description.
# File lib/hqtrivia/schedule/show.rb, line 76 def description @data['display']['description'] end
This returns the game type. “trivia” is trivia (general/sports). “words” is words. @return [String] the type of this game
# File lib/hqtrivia/schedule/show.rb, line 31 def game_type @data['gameType'] end
@return [true, false] if this show is an HQ Trivia (not sports) game
# File lib/hqtrivia/schedule/show.rb, line 146 def general? return true if vertical == 'general' false end
@return [Integer] the ID of this show
# File lib/hqtrivia/schedule/show.rb, line 23 def id @data['showId'] end
The image displayed in the app. @return [String] the image.
# File lib/hqtrivia/schedule/show.rb, line 82 def image @data['display']['image'] end
The logo displayed in the app. @return [String] the logo.
# File lib/hqtrivia/schedule/show.rb, line 88 def logo @data['display']['logo'] end
The opt is found in preferences. @see HQTrivia::Me#preferences
@return [String] the opt.
# File lib/hqtrivia/schedule/show.rb, line 47 def opt @show['vertical'] end
@return [String] the prize.
# File lib/hqtrivia/schedule/show.rb, line 110 def prize "$#{(@data['prizeCents'] / 100).to_s.gsub(/(\d)(?=\d{3}+(\.\d*)?$)/, '\1' + ",")}" end
@return [Integer] the prize in cents.
# File lib/hqtrivia/schedule/show.rb, line 105 def prize_cents @data['prizeCents'] end
@return [String] the season this game will count towards
# File lib/hqtrivia/schedule/show.rb, line 120 def season_name @data['seasonName'] end
This returns the show type. “hq” is general trivia. “hq-sports” is sports “hq-words” is words. @see words? @see general? @see sports? @see trivia? @return [String] the show type
# File lib/hqtrivia/schedule/show.rb, line 18 def show_type @data['showType'] end
@return [true, false] if this show is an HQ Sports game
# File lib/hqtrivia/schedule/show.rb, line 139 def sports? return true if vertical == 'sports' false end
@return [Time] the start time of this game
# File lib/hqtrivia/schedule/show.rb, line 52 def start_time Time.parse(@data['startTime']) end
The summary displayed in the app. @return [String] the show summary.
# File lib/hqtrivia/schedule/show.rb, line 64 def summary @data['display']['summary'] end
The title displayed in the app. @return [String] the title.
# File lib/hqtrivia/schedule/show.rb, line 58 def title @data['display']['title'] end
@return [true, false] if this show is an HQ Trivia game (general or sports)
# File lib/hqtrivia/schedule/show.rb, line 132 def trivia? return true if game_type == 'trivia' false end
The “vertical” is a more specific game type. “general” is normal trivia game “sports” is a sports trivia game “words” is a words game. @return [String] the vertical of this game.
# File lib/hqtrivia/schedule/show.rb, line 40 def vertical @show['vertical'] end
@return [true, false] if this show is an HQ Words game
# File lib/hqtrivia/schedule/show.rb, line 125 def words? return true if vertical == 'words' false end