class Exlibris::Aleph::Items

Attributes

record_id[R]

Public Class Methods

new(record_id) click to toggle source
# File lib/exlibris/aleph/items.rb, line 12
def initialize(record_id)
  @record_id = record_id
end

Public Instance Methods

to_a() click to toggle source
# File lib/exlibris/aleph/items.rb, line 16
def to_a
  @array ||= ids.map { |id| Item.new(record_id, id) }
end

Private Instance Methods

client() click to toggle source
# File lib/exlibris/aleph/items.rb, line 21
def client
  @client ||= API::Client::Record::Items.new(record_id)
end
ids() click to toggle source
# File lib/exlibris/aleph/items.rb, line 37
def ids
  @ids ||= begin
    if items.nil?
      []
    else
      items.map do |item|
        href = (items.size > 1) ? item['href'] : item[1]
        href.split('/').pop
      end
    end
  end
end
items() click to toggle source
# File lib/exlibris/aleph/items.rb, line 33
def items
  @items ||= items_root['item'] unless items_root.nil?
end
items_root() click to toggle source
# File lib/exlibris/aleph/items.rb, line 29
def items_root
  @items_root ||= root['items']
end
root() click to toggle source
# File lib/exlibris/aleph/items.rb, line 25
def root
  @root ||= client.root
end