6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
|
# File 'lib/openstax/api/routing_mapper_includes.rb', line 6
def api(version, options = {})
api_namespace = (options.delete(:namespace) || 'api').to_s
routing_error_app = options.delete(:routing_error_app) || \
OpenStax::Api.configuration.routing_error_app
constraints = Constraints.new(version: version,
default: options.delete(:default))
namespace api_namespace, defaults: {format: 'json'}.merge(options) do
scope(except: [:new, :edit],
module: version,
constraints: constraints) do
get '/', to: '/apipie/apipies#index', defaults: {format: 'html',
version: version.to_s}
yield
match '/*other', via: [:get, :post, :put, :patch, :delete], to: routing_error_app
end
end
end
|