Class: Inventory

Inherits:
ApplicationRecord
  • Object
show all
Defined in:
app/models/inventory.rb

Instance Method Summary collapse

Instance Method Details

#foundObject



28
29
30
31
32
33
34
# File 'app/models/inventory.rb', line 28

def found
  if item.rended?
    item.circulation_status = CirculationStatus.find_by(name: 'On Loan')
  else
    item.circulation_status = CirculationStatus.find_by(name: 'Available On Shelf')
  end
end

#lostObject



24
25
26
# File 'app/models/inventory.rb', line 24

def lost
  item.circulation_status = CirculationStatus.find_by(name: 'Missing')
end

#to_hashObject



10
11
12
13
14
15
16
17
18
19
20
21
22
# File 'app/models/inventory.rb', line 10

def to_hash
  {
    created_at: created_at,
    identifier: item_identifier,
    item_identifier: item.try(:item_identifier),
    current_shelf: current_shelf_name,
    shelf: item.try(:shelf),
    call_number: item.try(:call_number),
    circulation_status: item.try(:circulation_status).try(:name),
    title: item.try(:manifestation).try(:original_title),
    extent: item.try(:manifestation).try(:extent)
  }
end