Class: Friday::DependenciesController

Inherits:
ApplicationController show all
Defined in:
app/controllers/friday/dependencies_controller.rb

Instance Method Summary collapse

Instance Method Details

#indexObject

GET /dependencies



8
9
10
11
12
# File 'app/controllers/friday/dependencies_controller.rb', line 8

def index
  @dependencies = Dependency.all

  render json: @dependencies
end

#showObject

GET /dependencies/:language/:name



15
16
17
18
19
20
21
# File 'app/controllers/friday/dependencies_controller.rb', line 15

def show
  return render json: {}, status: :bad_request if params[:language] != 'ruby' || params[:name].include?(':')

  @dependency = Dependency.new(params[:language], params[:name])

  render json: @dependency.with_dependents
end