travis-api/lib/travis/api/app/endpoint.rb
2012-07-27 15:55:57 +02:00

17 lines
458 B
Ruby

require 'travis/api/app'
class Travis::Api::App
# Superclass for HTTP endpoints. Takes care of prefixing.
class Endpoint < Responder
set(:prefix) { "/" << name[/[^:]+$/].underscore }
before { content_type :json }
error(ActiveRecord::RecordNotFound, Sinatra::NotFound) { not_found }
not_found { content_type =~ /json/ ? { 'file' => 'not found' } : 'file not found' }
# TODO: Dummy method.
def self.scope(name)
end
end
end