Module: GrapeSimpleAuth::Extension
Instance Method Summary collapse
Instance Method Details
#oauth2(*scopes) ⇒ Object
4 5 6 7 8 9 10 11 12 13 |
# 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) ⇒ Object
15 16 17 18 19 20 21 22 23 |
# 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 |