Sha256: 55095e4245e5560557bbd271c591590706ae02b2eedb38451a52a7376ed26873

Contents?: true

Size: 1.03 KB

Versions: 2

Compression:

Stored size: 1.03 KB

Contents

module Spec
  module Support
    # Test API
    class API < Grape::API
      version 'v1'
      prefix 'api'
      format 'json'

      get 'custom_name', as: :my_custom_route_name do
        'hello'
      end

      get 'ping' do
        'pong'
      end

      resource :cats do
        get '/' do
          %w(cats cats cats)
        end

        route_param :id do
          get do
            'cat'
          end
        end
      end

      route :any, '*path' do
        'catch-all route'
      end
    end

    # API with more than one version
    class APIWithMultipleVersions < Grape::API
      version %w(beta alpha v1)

      get 'ping' do
        'pong'
      end
    end

    # API with another API mounted inside it
    class MountedAPI < Grape::API
      mount Spec::Support::API
      mount Spec::Support::APIWithMultipleVersions
    end

    # API with a version that would be illegal as a method name
    class APIWithIllegalVersion < Grape::API
      version 'beta-1'

      get 'ping' do
        'pong'
      end
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
grape-route-helpers-2.0.0 spec/support/api.rb
grape-route-helpers-1.2.2 spec/support/api.rb