Class: Sword2Ruby::SwordStatementOAIORE
- Inherits:
-
Object
- Object
- Sword2Ruby::SwordStatementOAIORE
- Defined in:
- lib/sword2ruby/sword_statement_oai_ore.rb
Overview
This class models the OAI-ORE Sword Statement.
For more information, see the Sword2 specification: section 11.3. “OAI-ORE Serialisation”.
Instance Attribute Summary collapse
-
#rdf_descriptions ⇒ Object
readonly
An array of rdf:descriptions.
-
#statement_document ⇒ Object
readonly
The complete statement document, returned as a REXML::Document.
Instance Method Summary collapse
-
#initialize(sword_statement_uri, connection) ⇒ SwordStatementOAIORE
constructor
Creates a new SwordStatementOAIORE object, using the supplied URI and connection object.
Constructor Details
#initialize(sword_statement_uri, connection) ⇒ SwordStatementOAIORE
Creates a new SwordStatementOAIORE object, using the supplied URI and connection object.
Parameters
- sword_statement_uri
-
The URI string to the OAI-ORE Sword Statement.
- connection
-
Sword2Ruby::Connection object used to perform the operation.
19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 |
# File 'lib/sword2ruby/sword_statement_oai_ore.rb', line 19 def initialize(sword_statement_uri, connection) #Validate parameters Utility.check_argument_class('sword_statement_uri', sword_statement_uri, String) Utility.check_argument_class('connection', connection, Connection) response = connection.get(sword_statement_uri) if response.is_a? Net::HTTPSuccess @statement_document = REXML::Document.new(response.body) @rdf_descriptions = [] @statement_document.elements.each("/rdf:RDF/rdf:Description") do |description| @rdf_descriptions << description end else raise Sword2Ruby::Exception.new("Failed to do get(#{sword_statement_uri}): server returned code #{response.code} #{response.message}") end end |
Instance Attribute Details
#rdf_descriptions ⇒ Object (readonly)
An array of rdf:descriptions. See the overload methods in REXML::Element for each description’s methods.
13 14 15 |
# File 'lib/sword2ruby/sword_statement_oai_ore.rb', line 13 def rdf_descriptions @rdf_descriptions end |
#statement_document ⇒ Object (readonly)
The complete statement document, returned as a REXML::Document.
10 11 12 |
# File 'lib/sword2ruby/sword_statement_oai_ore.rb', line 10 def statement_document @statement_document end |