Class: Apia::Authenticator
- Inherits:
-
Object
- Object
- Apia::Authenticator
- Extended by:
- Defineable
- Includes:
- CallableWithEnvironment
- Defined in:
- lib/apia/authenticator.rb
Class Method Summary collapse
-
.authorized_scope?(environment, scopes) ⇒ Boolean
If any of the given scopes are valid.
-
.collate_objects(set) ⇒ void
Finds all objects referenced by this authenticator and add them to the provided set.
-
.definition ⇒ Apia::Definitions::Authenticator
Return the definition for this authenticator.
-
.execute(environment) ⇒ void
Execute this authenticator within the given environment.
Methods included from Defineable
create, inspect, method_missing, name, respond_to_missing?
Methods included from CallableWithEnvironment
#call, #call_with_error_handling, #initialize, #method_missing, #respond_to_missing?
Dynamic Method Handling
This class handles dynamic methods through the method_missing method in the class Apia::CallableWithEnvironment
Class Method Details
.authorized_scope?(environment, scopes) ⇒ Boolean
If any of the given scopes are valid
47 48 49 50 51 52 |
# File 'lib/apia/authenticator.rb', line 47 def (environment, scopes) return true if definition.scope_validator.nil? return true if scopes.empty? scopes.any? { |s| environment.call(s, &definition.scope_validator) } end |
.collate_objects(set) ⇒ void
This method returns an undefined value.
Finds all objects referenced by this authenticator and add them to the provided set.
28 29 30 31 32 |
# File 'lib/apia/authenticator.rb', line 28 def collate_objects(set) definition.potential_errors.each do |error| set.add_object(error) end end |
.definition ⇒ Apia::Definitions::Authenticator
Return the definition for this authenticator
19 20 21 |
# File 'lib/apia/authenticator.rb', line 19 def definition @definition ||= Definitions::Authenticator.new(Helpers.class_name_to_id(name)) end |
.execute(environment) ⇒ void
This method returns an undefined value.
Execute this authenticator within the given environment
38 39 40 |
# File 'lib/apia/authenticator.rb', line 38 def execute(environment) new(environment).call end |