Class: Orcid::ProfileRequest

Inherits:
ActiveRecord::Base
  • Object
show all
Defined in:
app/models/orcid/profile_request.rb

Overview

Responsible for:

  • acknowledging that an ORCID Profile was requested

  • submitting a request for an ORCID Profile

  • handling the response for the ORCID Profile creation

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.find_by_user(user) ⇒ Object



7
8
9
# File 'app/models/orcid/profile_request.rb', line 7

def self.find_by_user(user)
  where(user: user).first
end

Instance Method Details

#successful_profile_creation(orcid_profile_id) ⇒ Object



21
22
23
24
25
26
# File 'app/models/orcid/profile_request.rb', line 21

def successful_profile_creation(orcid_profile_id)
  self.class.transaction do
    update_column(:orcid_profile_id, orcid_profile_id)
    Orcid.connect_user_and_orcid_profile(user, orcid_profile_id)
  end
end

#validation_error_on_profile_creation(error_message) ⇒ Object



28
29
30
# File 'app/models/orcid/profile_request.rb', line 28

def validation_error_on_profile_creation(error_message)
  update_column(:response_text, error_message)
end