Sha256: 6f3b42d43633671fe6209b70fe860576db17cfc2d6aefca70d4df2c5a39c385f

Contents?: true

Size: 558 Bytes

Versions: 11

Compression:

Stored size: 558 Bytes

Contents

require 'sinatra/base'
require 'animal_service/animal_repository'

module AnimalService

  class Api < Sinatra::Base

    set :raise_errors, false
    set :show_exceptions, false

    error do
      e = env['sinatra.error']
      content_type :json
      status 500
      {:error => e.message, :backtrace => e.backtrace}.to_json
    end

    get '/alligators/:name' do
      if (alligator = AnimalRepository.find_alligator_by_name(params[:name]))
        content_type :json
        alligator.to_json
      else
        status 404
      end
    end

  end
end

Version data entries

11 entries across 11 versions & 1 rubygems

Version Path
pact-1.0.39 example/animal-service/lib/animal_service/api.rb
pact-1.1.0.rc2 example/animal-service/lib/animal_service/api.rb
pact-1.0.38 example/animal-service/lib/animal_service/api.rb
pact-1.1.0.rc1 example/animal-service/lib/animal_service/api.rb
pact-1.0.37 example/animal-service/lib/animal_service/api.rb
pact-1.0.36 example/animal-service/lib/animal_service/api.rb
pact-1.0.35 example/animal-service/lib/animal_service/api.rb
pact-1.0.34 example/animal-service/lib/animal_service/api.rb
pact-1.0.33 example/animal-service/lib/animal_service/api.rb
pact-1.0.32 example/animal-service/lib/animal_service/api.rb
pact-1.0.31 example/animal-service/lib/animal_service/api.rb