Class: Orcid::Configuration

Inherits:
Object
  • Object
show all
Defined in:
lib/orcid/configuration.rb,
lib/orcid/configuration/provider.rb

Overview

Responsible for exposing the customization mechanism

Defined Under Namespace

Classes: Provider

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(options = {}) ⇒ Configuration

Returns a new instance of Configuration.



5
6
7
8
9
10
11
12
13
14
# File 'lib/orcid/configuration.rb', line 5

def initialize(options = {})
  @mapper = options.fetch(:mapper) { default_mapper }
  @provider = options.fetch(:provider) { default_provider }
  @authentication_model = options.fetch(:authentication_model) do
    default_authenticaton_model
  end
  @parent_controller = options.fetch(:parent_controller) do
    '::ApplicationController'
  end
end

Instance Attribute Details

#authentication_modelObject

Returns the value of attribute authentication_model.



17
18
19
# File 'lib/orcid/configuration.rb', line 17

def authentication_model
  @authentication_model
end

#mapperObject (readonly)

Returns the value of attribute mapper.



4
5
6
# File 'lib/orcid/configuration.rb', line 4

def mapper
  @mapper
end

#parent_controllerObject

Returns the value of attribute parent_controller.



18
19
20
# File 'lib/orcid/configuration.rb', line 18

def parent_controller
  @parent_controller
end

#providerObject

Returns the value of attribute provider.



16
17
18
# File 'lib/orcid/configuration.rb', line 16

def provider
  @provider
end

Instance Method Details

#register_mapping_to_orcid_work(source_type, legend) ⇒ Object



20
21
22
23
24
25
26
27
28
# File 'lib/orcid/configuration.rb', line 20

def register_mapping_to_orcid_work(source_type, legend)
  mapper.configure do |config|
    config.register(
      source: source_type,
      target: 'orcid/work',
      legend: legend
    )
  end
end