app/models/proquest_behaviors.rb
# Given a ppid, load the configured JSON file of registrar data, return the portion
# relevant to the user in question
# @param [String] ppid
# @return [Hash]
Given a ppid, load the configured JSON file of registrar data, return the portion
relevant to the user in question
Given a ppid load the configured JSON file of registrar data return the portion relevant to the user in question
def load_registrar_data_for_user(ppid)
    ppid = "P0000001" if Rails.env.development? || ENV['FAKE_DATA'] 
    registrar_hash = JSON.parse(File.read(ENV['REGISTRAR_DATA_PATH']))
    @registrar_data = registrar_hash.select { |p| p.match(ppid) }.values.first
    return @registrar_data if @registrar_data
    Rails.logger.error "FAILURE TO EXPORT PROQUEST PACKAGE: Cannot find registrar data for user #{ppid} etd #{id}"
    raise "Cannot find registrar data for user #{ppid} etd #{id}"
  end
def load_registrar_data_for_user ( ppid ) ppid = "P0000001" if Rails . env . development? || ENV [ 'FAKE_DATA' ] registrar_hash = JSON . parse ( File . read ( ENV [ 'REGISTRAR_DATA_PATH' ] ) ) @registrar_data = registrar_hash . select { | p | p . match ( ppid ) } . values . first return @registrar_data if @registrar_data Rails . logger . error "FAILURE TO EXPORT PROQUEST PACKAGE: Cannot find registrar data for user #{ppid} etd #{id}" raise "Cannot find registrar data for user #{ppid} etd #{id}" end
Given a ppid, load the configured JSON file of registrar data, return the portion
relevant to the user in question
Given a ppid load the configured JSON file of registrar data return the portion relevant to the user in question
# Otherwise it will never find registrar data for our fake users
None
Hash
ppid
<not_specific>
<not_specific>
None