Class: FootStatsSimulator::ApiController

Inherits:
ApplicationController show all
Defined in:
app/controllers/foot_stats_simulator/api_controller.rb

Instance Method Summary collapse

Instance Method Details

#championshipObject



5
6
7
# File 'app/controllers/foot_stats_simulator/api_controller.rb', line 5

def championship
  render_foot_stats SimulatorChampionship.to_foot_stats
end

#championship_classificationObject



19
20
21
22
# File 'app/controllers/foot_stats_simulator/api_controller.rb', line 19

def championship_classification
  championship = SimulatorChampionship.find_by_source_id(params[:Campeonato])
  render_foot_stats championship.classification.to_foot_stats
end

#championship_matchObject



24
25
26
27
# File 'app/controllers/foot_stats_simulator/api_controller.rb', line 24

def championship_match
  championship = SimulatorChampionship.find_by_source_id(params[:Campeonato])
  render_foot_stats championship.simulator_matches.to_foot_stats
end

#championship_round_matchObject



29
30
31
32
# File 'app/controllers/foot_stats_simulator/api_controller.rb', line 29

def championship_round_match
  championship = SimulatorChampionship.find_by_source_id(params[:Campeonato])
  render_foot_stats championship.simulator_matches.where(round: params[:Rodada]).to_foot_stats
end

#championship_teamsObject



9
10
11
12
# File 'app/controllers/foot_stats_simulator/api_controller.rb', line 9

def championship_teams
  championship = SimulatorChampionship.find_by_source_id params[:IdCampeonato]
  render_foot_stats championship.simulator_teams.to_foot_stats
end

#live_matchObject



34
35
36
# File 'app/controllers/foot_stats_simulator/api_controller.rb', line 34

def live_match
  render_foot_stats SimulatorMatch.find_by_source_id(params[:IdPartida]).to_foot_stats_live
end

#match_narrationObject



38
39
40
# File 'app/controllers/foot_stats_simulator/api_controller.rb', line 38

def match_narration
  render_foot_stats SimulatorMatch.find_by_source_id(params[:Partida]).to_foot_stats_narration
end

#team_playersObject



14
15
16
17
# File 'app/controllers/foot_stats_simulator/api_controller.rb', line 14

def team_players
  team = SimulatorTeam.find_by_source_id params[:Equipe]
  render_foot_stats team.simulator_players.to_foot_stats
end