Module: OpenStax::Api::RouteExtensions

Defined in:
lib/openstax/api/route_extensions.rb

Instance Method Summary collapse

Instance Method Details

#api(version, options = {}) ⇒ Object



6
7
8
9
10
11
12
13
# File 'lib/openstax/api/route_extensions.rb', line 6

def api(version, options = {})
  constraints = Constraints.new(version: version,
                                default: options.delete(:default))
  namespace :api, defaults: {format: 'json'}.merge(options) do
    scope(module: version,
          constraints: constraints) { yield }
  end
end