class HQTrivia::Schedule::Show

The Schedule Show Class. This is a show on the schedule

Public Class Methods

new(data) click to toggle source

@param data [JSON] the data. @!visibility private

# File lib/hqtrivia/schedule/show.rb, line 5
def initialize(data)
  @data = data
end

Public Instance Methods

accent_color() click to toggle source

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
background_image() click to toggle source

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
background_video() click to toggle source

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
currency() click to toggle source

@return [String] the currency the prize will be in

# File lib/hqtrivia/schedule/show.rb, line 115
def currency
  @data['currency']
end
description() click to toggle source

The description displayed in the app. @return [String] the description.

# File lib/hqtrivia/schedule/show.rb, line 76
def description
  @data['display']['description']
end
game_type() click to toggle source

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
general?() click to toggle source

@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
id() click to toggle source

@return [Integer] the ID of this show

# File lib/hqtrivia/schedule/show.rb, line 23
def id
  @data['showId']
end
image() click to toggle source

The image displayed in the app. @return [String] the image.

# File lib/hqtrivia/schedule/show.rb, line 82
def image
  @data['display']['image']
end
opt() click to toggle source

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
prize() click to toggle source

@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
prize_cents() click to toggle source

@return [Integer] the prize in cents.

# File lib/hqtrivia/schedule/show.rb, line 105
def prize_cents
  @data['prizeCents']
end
season_name() click to toggle source

@return [String] the season this game will count towards

# File lib/hqtrivia/schedule/show.rb, line 120
def season_name
  @data['seasonName']
end
show_type() click to toggle source

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
sports?() click to toggle source

@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
start_time() click to toggle source

@return [Time] the start time of this game

# File lib/hqtrivia/schedule/show.rb, line 52
def start_time
  Time.parse(@data['startTime'])
end
summary() click to toggle source

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
title() click to toggle source

The title displayed in the app. @return [String] the title.

# File lib/hqtrivia/schedule/show.rb, line 58
def title
  @data['display']['title']
end
trivia?() click to toggle source

@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
vertical() click to toggle source

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
words?() click to toggle source

@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