module GrapeSimpleAuth::Extension
Public Instance Methods
oauth2(*scopes)
click to toggle source
# File lib/grape_simple_auth/extension.rb, line 4 def oauth2(*scopes) description = if respond_to?(:route_setting) # >= grape-0.10.0 route_setting(:description) || route_setting(:description, {}) else @last_description ||= {} end description[:auth] = { scopes: scopes } description[:authorizations] = { oauth2: scopes.map { |x| { scope: x } } } end
optional_oauth2(*scopes)
click to toggle source
# File lib/grape_simple_auth/extension.rb, line 15 def optional_oauth2(*scopes) description = if respond_to?(:route_setting) # >= grape-0.10.0 route_setting(:description) || route_setting(:description, {}) else @last_description ||= {} end description[:authorizations] = { optional_oauth2: scopes.map { |x| { scope: x } } } end