Class: Orcid::ProfileRequestCoordinator
- Inherits:
-
Object
- Object
- Orcid::ProfileRequestCoordinator
- Defined in:
- app/services/orcid/profile_request_coordinator.rb
Overview
Responsible for converting an Orcid::ProfileRequest into an Orcid::Profile.
Instance Attribute Summary collapse
-
#profile_request ⇒ Object
readonly
Returns the value of attribute profile_request.
Class Method Summary collapse
Instance Method Summary collapse
- #call ⇒ Object
-
#initialize(profile_request, collaborators = {}) ⇒ ProfileRequestCoordinator
constructor
A new instance of ProfileRequestCoordinator.
Constructor Details
#initialize(profile_request, collaborators = {}) ⇒ ProfileRequestCoordinator
Returns a new instance of ProfileRequestCoordinator.
11 12 13 14 15 16 |
# File 'app/services/orcid/profile_request_coordinator.rb', line 11 def initialize(profile_request, collaborators = {}) self.profile_request = profile_request @remote_service = collaborators.fetch(:remote_service) { default_remote_service } @profile_state_finder = collaborators.fetch(:profile_state_finder) { default_profile_state_finder } @logger = collaborators.fetch(:logger) { default_logger } end |
Instance Attribute Details
#profile_request ⇒ Object
Returns the value of attribute profile_request.
18 19 20 |
# File 'app/services/orcid/profile_request_coordinator.rb', line 18 def profile_request @profile_request end |
Class Method Details
.call(profile_request, collaborators = {}) ⇒ Object
7 8 9 |
# File 'app/services/orcid/profile_request_coordinator.rb', line 7 def self.call(profile_request, collaborators = {}) new(profile_request, collaborators).call end |
Instance Method Details
#call ⇒ Object
21 22 23 24 25 26 27 28 29 |
# File 'app/services/orcid/profile_request_coordinator.rb', line 21 def call profile_state_finder.call(user) do |on| on.unknown { handle_unknown_profile_state } on.profile_request_pending { |request| handle_profile_request } on.pending_connection { |profile| handle_pending_connection_for(profile) } on.authenticated_connection { |profile| handle_authenticated_connection_for(profile) } end true end |