Class: Ddr::FindingAid

Inherits:
Object
  • Object
show all
Defined in:
app/models/ddr/finding_aid.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(ead_id) ⇒ FindingAid

Returns a new instance of FindingAid.



5
6
7
# File 'app/models/ddr/finding_aid.rb', line 5

def initialize(ead_id)
  @ead_id = ead_id
end

Instance Attribute Details

#ead_idObject (readonly)

Returns the value of attribute ead_id.



3
4
5
# File 'app/models/ddr/finding_aid.rb', line 3

def ead_id
  @ead_id
end

Instance Method Details

#abstractObject



38
39
40
41
# File 'app/models/ddr/finding_aid.rb', line 38

def abstract
  first_abstract = doc.fetch('abstract_tesim',[])&.first
  ActionController::Base.helpers.strip_tags(first_abstract)
end

#collection_date_spanObject



22
23
24
# File 'app/models/ddr/finding_aid.rb', line 22

def collection_date_span
  doc.fetch('normalized_date_ssm',[])&.first
end

#collection_numberObject



26
27
28
# File 'app/models/ddr/finding_aid.rb', line 26

def collection_number
  doc.fetch('unitid_ssm',[])&.first
end

#collection_titleObject



30
31
32
# File 'app/models/ddr/finding_aid.rb', line 30

def collection_title
  doc.fetch('title_ssm',[])&.first
end

#extentObject



34
35
36
# File 'app/models/ddr/finding_aid.rb', line 34

def extent
  doc.fetch('extent_ssm',[]).join("; ")
end

#repositoryObject



18
19
20
# File 'app/models/ddr/finding_aid.rb', line 18

def repository
  doc.fetch('repository_ssm',[])&.first
end

#titleObject



14
15
16
# File 'app/models/ddr/finding_aid.rb', line 14

def title
  doc.fetch('normalized_title_ssm',[])&.first
end

#urlObject

TODO: use permalinks in the future when all finding aids have ARKs



10
11
12
# File 'app/models/ddr/finding_aid.rb', line 10

def url
  [Ddr.finding_aid_base_url, '/catalog/', ead_id].join
end