Class: Chronicle::ETL::Authorizer

Inherits:
Object
  • Object
show all
Defined in:
lib/chronicle/etl/authorizer.rb

Overview

An authorization strategy for a third-party data source

Direct Known Subclasses

OauthAuthorizer

Class Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

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_nameObject (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 |authorizer|
    authorizer.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

Raises:

  • (NotImplementedError)


29
30
31
# File 'lib/chronicle/etl/authorizer.rb', line 29

def authorize!
  raise NotImplementedError
end