class HQTrivia::Schedule

The user themselves

Public Class Methods

new(key) click to toggle source

Get that user info! @param key [String] the key of the user

# File lib/hqtrivia/schedule.rb, line 5
def initialize(key)
  @key = key
  @data = JSON.parse(RestClient.get('https://api-quiz.hype.space/shows/schedule', Authorization: key, 'x-hq-client': 'iOS/1.4.15 b146'))
end

Public Instance Methods

announcements() click to toggle source

@return [Array<Announcement>] all announcements (shown in the schedule tab)

# File lib/hqtrivia/schedule.rb, line 23
def announcements
  announcements = []
  @data['tentpoles'].each { |announcement| announcements.push(Announcement.new(announcement)) }
  announcements
end
next() click to toggle source

@return [Show] the next game

# File lib/hqtrivia/schedule.rb, line 18
def next
  Show.new(@data['shows'][0])
end
shows() click to toggle source

@return [Array<Show>] all upcoming shows

# File lib/hqtrivia/schedule.rb, line 11
def shows
  shows = []
  @data['shows'].each { |show| shows.push(Show.new(show)) }
  shows
end