Sha256: 9c2b8994fe705c0cfcf1f43f5961ce21d4902d50004ed9fbf61e0c993e7908b0

Contents?: true

Size: 714 Bytes

Versions: 4

Compression:

Stored size: 714 Bytes

Contents

# frozen_string_literal: true

module WineBouncer
  module Extension
    def oauth2(*scopes)
      scopes = Doorkeeper.configuration.default_scopes.all if scopes.all? { |x| x.nil? }
      description = if respond_to?(:route_setting) # >= grape-0.10.0
                      route_setting(:description) || route_setting(:description, {})
                    else
                      @last_description ||= {}
                    end
      # case WineBouncer.configuration.auth_strategy
      # when :default
      description[:auth] = { scopes: scopes }
      # when :swagger
      description[:authorizations] = { oauth2: scopes.map { |x| { scope: x } } }
      # end
    end

    Grape::API.extend self
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
wine_bouncer-1.0.3 lib/wine_bouncer/extension.rb
wine_bouncer-1.0.2 lib/wine_bouncer/extension.rb
wine_bouncer-1.0.1 lib/wine_bouncer/extension.rb
wine_bouncer-1.0.0 lib/wine_bouncer/extension.rb