Class: Api::GamesController

Inherits:
ApplicationController
  • Object
show all
Defined in:
app/controllers/api/games_controller.rb

Instance Method Summary collapse

Instance Method Details

#indexObject


2
3
4
# File 'app/controllers/api/games_controller.rb', line 2

def index
  render json: games_repository.all.as_json
end

#showObject


6
7
8
9
10
11
12
13
14
# File 'app/controllers/api/games_controller.rb', line 6

def show
  game = games_repository.find(id: params[:id])

  if game = listings_parser(game).parse
    render json: game.as_full_json, status: :ok
  else
    render json: {}, status: :unprocessable_entity
  end
end