Module: HydraPbcore
- Extended by:
- ActiveSupport::Autoload
- Defined in:
- lib/hydra-pbcore.rb,
lib/hydra_pbcore/version.rb,
lib/hydra_pbcore/behaviors.rb
Defined Under Namespace
Modules: Datastream, Methods, Templates Classes: Behaviors
Constant Summary collapse
- DocumentNodes =
[ "pbcoreAssetType", "pbcoreAssetDate", "pbcoreIdentifier", "pbcoreTitle", "pbcoreSubject", "pbcoreDescription", "pbcoreGenre", "pbcoreRelation", "pbcoreCoverage", "pbcoreAudienceLevel", "pbcoreAudienceRating", "pbcoreCreator", "pbcoreContributor", "pbcorePublisher", "pbcoreRightsSummary", "pbcoreInstantiation", "pbcoreAnnotation", "pbcorePart", "pbcoreExtension", ]
- InstantiationNodes =
[ "instantiationIdentifier", "instantiationDate", "instantiationDimensions", "instantiationPhysical", "instantiationDigital", "instantiationStandard", "instantiationLocation", "instantiationMediaType", "instantiationGenerations", "instantiationFileSize", "instantiationTimeStart", "instantiationDuration", "instantiationDataRate", "instantiationColors", "instantiationTracks", "instantiationChannelConfiguration", "instantiationLanguage", "instantiationAlternativeModes", "instantiationEssenceTrack", "instantiationRelation", "instantiationRights", "instantiationAnnotation", "instantiationPart", "instantiationExtension", ]
- Config =
{ "institution" => "Rock and Roll Hall of Fame and Museum", "relator" => "MARC relator terms", "address" => "Rock and Roll Hall of Fame and Museum,\n2809 Woodland Ave.,\nCleveland, OH, 44115\n216-515-1956\[email protected]" }
- VERSION =
"3.3.2"
Instance Attribute Summary collapse
-
#logger ⇒ Object
Returns the value of attribute logger.
Class Method Summary collapse
-
.blank ⇒ Object
Returns a blank pbccoreDocument.
-
.config(opts = {}) ⇒ Object
load our config file.
-
.is_valid?(xml) ⇒ Boolean
Validates a supplied xml document against the PBCore schema.
- .logger ⇒ Object
- .version ⇒ Object
Instance Attribute Details
#logger ⇒ Object
Returns the value of attribute logger.
12 13 14 |
# File 'lib/hydra-pbcore.rb', line 12 def logger @logger end |
Class Method Details
.blank ⇒ Object
Returns a blank pbccoreDocument
86 87 88 89 |
# File 'lib/hydra-pbcore.rb', line 86 def self.blank xml = '<?xml version="1.0"?><pbcoreDescriptionDocument xmlns="http://www.pbcore.org/PBCore/PBCoreNamespace.html" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://www.pbcore.org/PBCore/PBCoreNamespace.html" xsi:schemaLocation="http://www.pbcore.org/PBCore/PBCoreNamespace.html"></pbcoreDescriptionDocument>' Nokogiri::XML(xml) end |
.config(opts = {}) ⇒ Object
load our config file
70 71 72 73 74 75 76 77 78 79 |
# File 'lib/hydra-pbcore.rb', line 70 def self.config opts = {} if File.exists? "config/pbcore.yml" config = ::YAML::load(IO.read("config/pbcore.yml")) Config.keys.collect { |k| config[k] = Config[k] if config[k].nil? } else logger.info "pbcore.yml file not found, using default values" config = Config end return config end |
.is_valid?(xml) ⇒ Boolean
Validates a supplied xml document against the PBCore schema. This differs from HydraPbcore::Methods.valid? which validates self, instead of the supplied argument. Argument must be a Nokogiri::XML::Document.
94 95 96 97 |
# File 'lib/hydra-pbcore.rb', line 94 def self.is_valid? xml xsd = Nokogiri::XML::Schema(open("http://pbcore.org/xsd/pbcore-2.0.xsd")) xsd.validate(xml) end |
.logger ⇒ Object
99 100 101 |
# File 'lib/hydra-pbcore.rb', line 99 def self.logger @logger ||= Logger.new(STDOUT) end |
.version ⇒ Object
81 82 83 |
# File 'lib/hydra-pbcore.rb', line 81 def self.version HydraPbcore::VERSION end |