Class: HaveAPI::Authentication::Base
- Inherits:
-
Object
- Object
- HaveAPI::Authentication::Base
- Defined in:
- lib/haveapi/authentication/base.rb
Overview
Base class for authentication providers.
Direct Known Subclasses
Instance Attribute Summary collapse
- #name ⇒ Symbol readonly
Class Method Summary collapse
-
.auth_method(v = nil) ⇒ Symbol
Get or set auth method name.
Instance Method Summary collapse
-
#authenticate(request) ⇒ Object
Reimplement this method in your authentication provider.
-
#describe ⇒ Object
Reimplement to describe provider.
-
#initialize(server, v) ⇒ Base
constructor
A new instance of Base.
- #resource_module ⇒ Module?
Constructor Details
#initialize(server, v) ⇒ Base
Returns a new instance of Base.
19 20 21 22 23 24 |
# File 'lib/haveapi/authentication/base.rb', line 19 def initialize(server, v) @name = self.class.auth_method @server = server @version = v setup end |
Instance Attribute Details
#name ⇒ Symbol (readonly)
17 18 19 |
# File 'lib/haveapi/authentication/base.rb', line 17 def name @name end |
Class Method Details
.auth_method(v = nil) ⇒ Symbol
Get or set auth method name
8 9 10 11 12 13 14 |
# File 'lib/haveapi/authentication/base.rb', line 8 def self.auth_method(v = nil) if v @auth_method = v else @auth_method || name.split('::').last.underscore.to_sym end end |
Instance Method Details
#authenticate(request) ⇒ Object
Reimplement this method in your authentication provider. request
is passed directly from Sinatra.
33 34 35 |
# File 'lib/haveapi/authentication/base.rb', line 33 def authenticate(request) end |
#describe ⇒ Object
Reimplement to describe provider.
38 39 40 |
# File 'lib/haveapi/authentication/base.rb', line 38 def describe {} end |
#resource_module ⇒ Module?
27 28 29 |
# File 'lib/haveapi/authentication/base.rb', line 27 def resource_module nil end |