Class: CDMBL::OaiGetRecord
- Inherits:
-
Object
- Object
- CDMBL::OaiGetRecord
- Defined in:
- lib/cdmbl/oai_get_record.rb
Overview
Request a single item from an OAI endpoint identifier should be forward slash delimited: colllection/identifier
Instance Attribute Summary collapse
-
#identifier ⇒ Object
readonly
Returns the value of attribute identifier.
-
#oai_client ⇒ Object
readonly
Returns the value of attribute oai_client.
Instance Method Summary collapse
-
#initialize(identifier: '', oai_client: OaiClient.new) ⇒ OaiGetRecord
constructor
A new instance of OaiGetRecord.
- #record ⇒ Object
- #record_exists? ⇒ Boolean
Constructor Details
#initialize(identifier: '', oai_client: OaiClient.new) ⇒ OaiGetRecord
Returns a new instance of OaiGetRecord.
7 8 9 10 |
# File 'lib/cdmbl/oai_get_record.rb', line 7 def initialize(identifier: '', oai_client: OaiClient.new) @identifier = identifier @oai_client = oai_client end |
Instance Attribute Details
#identifier ⇒ Object (readonly)
Returns the value of attribute identifier.
6 7 8 |
# File 'lib/cdmbl/oai_get_record.rb', line 6 def identifier @identifier end |
#oai_client ⇒ Object (readonly)
Returns the value of attribute oai_client.
6 7 8 |
# File 'lib/cdmbl/oai_get_record.rb', line 6 def oai_client @oai_client end |
Instance Method Details
#record ⇒ Object
16 17 18 |
# File 'lib/cdmbl/oai_get_record.rb', line 16 def record @record ||= oai_client.request query end |
#record_exists? ⇒ Boolean
12 13 14 |
# File 'lib/cdmbl/oai_get_record.rb', line 12 def record_exists? (/The value of the identifier argument is unknown/ =~ record_errors) == nil end |