Module: ActiveFedora::FixtureExporter
- Defined in:
- lib/active_fedora/fixture_exporter.rb
Class Method Summary collapse
Class Method Details
.export(pid, extra_params = {}) ⇒ Object
13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 |
# File 'lib/active_fedora/fixture_exporter.rb', line 13 def self.export(pid, extra_params={}) extra_params = {:format=>:foxml, :context=>:archive}.merge!(extra_params) if extra_params[:format].kind_of?(String) format = extra_params[:format] else format = case extra_params[:format] when :atom then "info:fedora/fedora-system:ATOM-1.1" when :atom_zip then "info:fedora/fedora-system:ATOMZip-1.1" when :mets then "info:fedora/fedora-system:METSFedoraExt-1.1" when :foxml then "info:fedora/fedora-system:FOXML-1.1" else "info:fedora/fedora-system:FOXML-1.1" end end ActiveFedora::Base.connection_for_pid(pid).export(:pid=>pid, :format=>format, :context=>extra_params[:context].to_s) end |
.export_to_path(pid, path, extra_params = {}) ⇒ Object
4 5 6 7 8 9 10 11 |
# File 'lib/active_fedora/fixture_exporter.rb', line 4 def self.export_to_path(pid, path, extra_params={}) foxml = export(pid, extra_params) name = "#{pid.gsub(":","_")}.foxml.xml" filename = File.join(path, name) file = File.new(filename,"w") file.syswrite(foxml) filename end |