Class: Evergreen::BibRecord

Inherits:
IDLObject show all
Includes:
Mixins::AnonymousPcrud
Defined in:
lib/evergreen/bib_record.rb

Overview

A bibliographic record (title)

Instance Method Summary collapse

Methods included from Mixins::AnonymousPcrud

#data

Methods inherited from IDLObject

#get, #idl_fields

Constructor Details

#initialize(id:, configuration:, idl:) ⇒ BibRecord

Returns a new instance of BibRecord.



10
11
12
13
14
# File 'lib/evergreen/bib_record.rb', line 10

def initialize(id:, configuration:, idl:)
  @id = id
  @configuration = configuration
  super(idl)
end

Instance Method Details

#holdingsObject

rubocop:enable Naming/MemoizedInstanceVariableName



22
23
24
25
26
27
28
29
# File 'lib/evergreen/bib_record.rb', line 22

def holdings
  payload = OpenSRF::ClassAndData.new(klass: 'osrfMessage', data: {
                                        'method' => 'open-ils.cat.asset.copy_tree.global.retrieve',
                                        'params' => ['', @id.to_s]
                                      }).to_h
  OpenSRF::HTTPTranslatorRequest.new(payload: payload, configuration: @configuration,
                                     service: 'open-ils.cat').response
end

#tcnObject



31
32
33
# File 'lib/evergreen/bib_record.rb', line 31

def tcn
  get 'tcn_value'
end

#to_marcObject

rubocop:disable Naming/MemoizedInstanceVariableName



17
18
19
# File 'lib/evergreen/bib_record.rb', line 17

def to_marc
  @marc ||= MARC::XMLReader.new(StringIO.new(get('marc'))).first
end