Class: CatchBox::Auth
- Inherits:
-
Object
- Object
- CatchBox::Auth
- Defined in:
- lib/catch_box/auth.rb
Instance Method Summary collapse
- #call(auth) ⇒ Object
-
#initialize(auth: proc { false }) ⇒ Auth
constructor
A new instance of Auth.
- #map(payload, env) ⇒ Object
Constructor Details
#initialize(auth: proc { false }) ⇒ Auth
Returns a new instance of Auth.
7 8 9 |
# File 'lib/catch_box/auth.rb', line 7 def initialize(auth: proc { false }) @auth = auth end |
Instance Method Details
#call(auth) ⇒ Object
11 12 13 |
# File 'lib/catch_box/auth.rb', line 11 def call(auth) @auth = auth end |
#map(payload, env) ⇒ Object
15 16 17 18 19 |
# File 'lib/catch_box/auth.rb', line 15 def map(payload, env) return if @auth.call(payload, env) raise ::CatchBox::NotAuthorized end |