Class: LocSearch::ModsRecord
Constant Summary
collapse
- MODS_NS =
{ "mods" => "http://www.loc.gov/mods/v3" }
Constants inherited
from LocSearch
LOC_SRU_BASEURL
Instance Method Summary
collapse
Methods inherited from LocSearch
import_from_sru_response, #initialize, make_sru_request_uri, search
Constructor Details
This class inherits a constructor from LocSearch
Instance Method Details
#creator ⇒ Object
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
|
# File 'app/models/loc_search.rb', line 19
def creator
statement_of_responsibility = @node.at('.//mods:note[@type="statement of responsibility"]', MODS_NS).try(:content)
if statement_of_responsibility
statement_of_responsibility
else
names = @node.xpath('.//mods:name', MODS_NS)
creator = names.map do |name|
name.xpath('.//mods:namePart', MODS_NS).map do |part|
if part.content
part.content
else
nil
end
end.compact.join(", ")
end.join(" ; ")
creator
end
end
|
#isbn ⇒ Object
16
17
18
|
# File 'app/models/loc_search.rb', line 16
def isbn
@node.xpath('.//mods:mods/mods:identifier[@type="isbn"]', MODS_NS).first.try(:content)
end
|
#lccn ⇒ Object
13
14
15
|
# File 'app/models/loc_search.rb', line 13
def lccn
@node.xpath('.//mods:mods/mods:identifier[@type="lccn"]', MODS_NS).first.try(:content)
end
|
#publisher ⇒ Object
37
38
39
40
41
|
# File 'app/models/loc_search.rb', line 37
def publisher
@node.xpath('.//mods:publisher', MODS_NS).map do |e|
e.content
end.join(", ")
end
|
#pubyear ⇒ Object
42
43
44
|
# File 'app/models/loc_search.rb', line 42
def pubyear
@node.xpath('.//mods:dateIssued', MODS_NS).first.try(:content)
end
|
#title ⇒ Object
7
8
9
10
11
12
|
# File 'app/models/loc_search.rb', line 7
def title
title = @node.xpath('.//mods:titleInfo/mods:title', MODS_NS).first.content
subtitle = @node.xpath('.//mods:titleInfo/mods:subTitle', MODS_NS).first
title += " : #{ subtitle.content }" if subtitle
title
end
|