class ROF::Translators::FedoraToRof

Responsible for translating Fedora PIDs to ROF objects

Attributes

config[R]
connection[R]
fedora_connection_information[R]
pids[R]

Public Class Methods

call(pids, config = {}) click to toggle source

@param [Array] pids - Fedora PIDs @param [Hash] config - Hash with symbol keys @option config [Hash] :fedora_connection_information - The Hash that contains the connection information for Fedora @return [Hash] The ROF representation of teh Fedora objects @see Rubydora.connect

# File lib/rof/translators/fedora_to_rof.rb, line 17
def self.call(pids, config = {})
  new(pids, config).to_rof
end
new(pids, config = {}) click to toggle source
# File lib/rof/translators/fedora_to_rof.rb, line 21
def initialize(pids, config = {})
  @pids = pids
  @fedora_connection_information = config.fetch(:fedora_connection_information)
  @config = config
  connect_to_fedora!
end

Public Instance Methods

to_rof() click to toggle source
# File lib/rof/translators/fedora_to_rof.rb, line 37
def to_rof
  # wrap the objects inside a JSON list
  pids.map do |pid|
    PidToRofElement.new(pid, connection, config).convert
  end
end

Private Instance Methods

connect_to_fedora!() click to toggle source
# File lib/rof/translators/fedora_to_rof.rb, line 31
def connect_to_fedora!
  @connection = Rubydora.connect(fedora_connection_information)
end