Class: Chronicle::ETL::Authorizer
- Inherits:
-
Object
- Object
- Chronicle::ETL::Authorizer
- Defined in:
- lib/chronicle/etl/authorizer.rb
Overview
An authorization strategy for a third-party data source
Direct Known Subclasses
Class Attribute Summary collapse
-
.provider_name ⇒ Object
readonly
Returns the value of attribute provider_name.
Class Method Summary collapse
-
.find_by_provider(provider) ⇒ Object
From all loaded Authorizers, return the first one that matches a given provider.
-
.provider(provider_name) ⇒ Object
Macro for setting provider on an Authorizer.
Instance Method Summary collapse
-
#authorize! ⇒ Object
Main entry-point for authorization flows.
-
#initialize(args) ⇒ Authorizer
constructor
Construct a new authorizer.
Constructor Details
#initialize(args) ⇒ Authorizer
Construct a new authorizer
26 |
# File 'lib/chronicle/etl/authorizer.rb', line 26 def initialize(args); end |
Class Attribute Details
.provider_name ⇒ Object (readonly)
Returns the value of attribute provider_name.
6 7 8 |
# File 'lib/chronicle/etl/authorizer.rb', line 6 def provider_name @provider_name end |
Class Method Details
.find_by_provider(provider) ⇒ Object
TODO:
Have a proper identifier system for authorizers (to have more than one per plugin)
From all loaded Authorizers, return the first one that matches a given provider
18 19 20 21 22 |
# File 'lib/chronicle/etl/authorizer.rb', line 18 def find_by_provider(provider) ObjectSpace.each_object(::Class).select { |klass| klass < self }.find do || .provider_name == provider end end |
.provider(provider_name) ⇒ Object
Macro for setting provider on an Authorizer
9 10 11 |
# File 'lib/chronicle/etl/authorizer.rb', line 9 def provider(provider_name) @provider_name = provider_name.to_sym end |
Instance Method Details
#authorize! ⇒ Object
Main entry-point for authorization flows. Implemented by subclass
29 30 31 |
# File 'lib/chronicle/etl/authorizer.rb', line 29 def raise NotImplementedError end |