Class: Barker::Api::Response::GameShow

Inherits:
Base
  • Object
show all
Extended by:
Forwardable
Defined in:
lib/barker/api/response/game_show.rb

Instance Method Summary collapse

Methods inherited from Base

#error?, #ok?

Instance Method Details

#candidatesObject



9
10
11
# File 'lib/barker/api/response/game_show.rb', line 9

def candidates
  game_show.candidates.map {|candidate| Response::Candidate.new(:candidate => candidate)}
end

#jokersObject



17
18
19
# File 'lib/barker/api/response/game_show.rb', line 17

def jokers
  game_show.jokers.map {|joker| Response::Joker.new(:joker => joker)}
end

#roundsObject



13
14
15
# File 'lib/barker/api/response/game_show.rb', line 13

def rounds
  game_show.rounds.map {|round| Response::Round.new(:round => round)}
end

#to_hashObject



21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
# File 'lib/barker/api/response/game_show.rb', line 21

def to_hash
  {
    'id'           => id,
    'game_show_id' => game_show_id,
    'jokers'       => jokers.map(&:to_hash),
    'joker_ids'    => joker_ids,
    'started_at'   => to_i(started_at),
    'finished_at'  => to_i(finished_at),
    'aborted_at'   => to_i(aborted_at),
    'started?'     => started?,
    'finished?'    => finished?,
    'aborted?'     => aborted?,
    'running?'     => running?,
    'stage'        => stage,
    'round'        => round,
    'next_stage?'  => next_stage?,
    'next_round?'  => next_round?,
    'candidates'   => candidates.map(&:to_hash),
    'rounds'       => rounds.map(&:to_hash),
    'round_time'   => round_time
  }
end