Sha256: 36af8d3169b667e970b055b6af836d8d8e2a5887dd70be2274f3086e6e3a3666

Contents?: true

Size: 531 Bytes

Versions: 5

Compression:

Stored size: 531 Bytes

Contents

require 'openstax/api/constraints'

module OpenStax
  module Api
    module RouteExtensions
      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
    end
  end
end

ActionDispatch::Routing::Mapper.send :include, OpenStax::Api::RouteExtensions

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
openstax_api-1.0.4 lib/openstax/api/route_extensions.rb
openstax_api-1.0.3 lib/openstax/api/route_extensions.rb
openstax_api-1.0.2 lib/openstax/api/route_extensions.rb
openstax_api-1.0.1 lib/openstax/api/route_extensions.rb
openstax_api-1.0.0 lib/openstax/api/route_extensions.rb