Class: CDMBL::OaiGetRecord

Inherits:
Object
  • Object
show all
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

Instance Method Summary collapse

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

#identifierObject (readonly)

Returns the value of attribute identifier.



6
7
8
# File 'lib/cdmbl/oai_get_record.rb', line 6

def identifier
  @identifier
end

#oai_clientObject (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

#recordObject



16
17
18
# File 'lib/cdmbl/oai_get_record.rb', line 16

def record
  @record ||= oai_client.request query
end

#record_exists?Boolean

Returns:

  • (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