Sha256: 269d62d4de1fc052a3b7129faa1aaa3f331b4e687dd59cf1f529fb216ad4464f

Contents?: true

Size: 1011 Bytes

Versions: 6

Compression:

Stored size: 1011 Bytes

Contents

module Api

  ###
  # Api under test, default doorkeeper scope is 'account'
  ##
  class MountedDefaultApiUnderTest < Grape::API
    desc 'Protected method with public', auth: { scopes: ['public'] }
    get '/protected' do
      { hello: 'world' }
    end

    desc 'Protected method with private', auth: { scopes: ['private'] }
    get '/protected_with_private_scope' do
      { hello: 'scoped world' }
    end

    desc 'Unprotected method'
    get '/unprotected' do
      { hello: 'unprotected world' }
    end

    desc 'Protected method with public that returns the user name', auth: { scopes: ['public'] }
    get '/protected_user' do
      { hello: resource_owner.name }
    end

    desc 'This method uses Doorkeepers default scopes', auth: { }
    get '/protected_without_scope' do
      { hello: 'protected unscoped world' }
    end
  end

  class DefaultApiUnderTest < Grape::API
    default_format :json
    format :json
    use ::WineBouncer::OAuth2
    mount MountedDefaultApiUnderTest
  end

end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
wine_bouncer-0.2.2 spec/dummy/app/api/default_api.rb
wine_bouncer-0.2.1 spec/dummy/app/api/default_api.rb
wine_bouncer-0.2.0 spec/dummy/app/api/default_api.rb
wine_bouncer-0.1.2 spec/dummy/app/api/default_api.rb
wine_bouncer-0.1.1 spec/dummy/app/api/default_api.rb
wine_bouncer-0.1.0 spec/dummy/app/api/default_api.rb