puree 1.0.0 → 1.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/lib/puree/extractor/publication.rb +2 -0
- data/lib/puree/model/publication.rb +6 -0
- data/lib/puree/version.rb +1 -1
- data/lib/puree/xml_extractor/publication.rb +26 -6
- data/puree.gemspec +0 -2
- metadata +3 -5
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 51982259947535b8a9b88916eca1d629004b1d78
|
4
|
+
data.tar.gz: 0b4469e3b0f0881d45ebbdc7a90eb69f7b4e29cb
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: e1ab192064572d2935d3546577c4bdbe4dbbd624f9056f173da1d9d91f910beb493aa0dd17a13a1162003f618ea215f213643e6a3fc98509acdd89e8fa21b416
|
7
|
+
data.tar.gz: 3e94e0b3ae0f86fa0f91911e142d435d428c088735108d19aa5ca49c182d18f16602d83441d374158a9bbc8a4635d60c250bff43d4fc711634d4bd551e2ed0c7
|
@@ -21,11 +21,13 @@ module Puree
|
|
21
21
|
@model.doi = @extractor.doi
|
22
22
|
@model.event = @extractor.event
|
23
23
|
@model.files = @extractor.files
|
24
|
+
@model.keywords = @extractor.keywords
|
24
25
|
@model.organisations = @extractor.organisations
|
25
26
|
@model.pages = @extractor.pages
|
26
27
|
@model.persons_internal = @extractor.persons_internal
|
27
28
|
@model.persons_external = @extractor.persons_external
|
28
29
|
@model.persons_other = @extractor.persons_other
|
30
|
+
@model.publisher = @extractor.publisher
|
29
31
|
@model.statuses = @extractor.statuses
|
30
32
|
@model.subtitle = @extractor.subtitle
|
31
33
|
@model.title = @extractor.title
|
@@ -20,6 +20,9 @@ module Puree
|
|
20
20
|
# @return [Array<Puree::Model::File>]
|
21
21
|
attr_accessor :files
|
22
22
|
|
23
|
+
# @return [Array<String>]
|
24
|
+
attr_accessor :keywords
|
25
|
+
|
23
26
|
# @return [Array<Puree::Model::OrganisationHeader>]
|
24
27
|
attr_accessor :organisations
|
25
28
|
|
@@ -35,6 +38,9 @@ module Puree
|
|
35
38
|
# @return [Array<Puree::Model::EndeavourPerson>]
|
36
39
|
attr_accessor :persons_other
|
37
40
|
|
41
|
+
# @return [String, nil]
|
42
|
+
attr_accessor :publisher
|
43
|
+
|
38
44
|
# @return [Array<Puree::Model::PublicationStatus>]
|
39
45
|
attr_accessor :statuses
|
40
46
|
|
data/lib/puree/version.rb
CHANGED
@@ -40,19 +40,33 @@ module Puree
|
|
40
40
|
|
41
41
|
# @return [Array<Puree::Model::File>]
|
42
42
|
def files
|
43
|
-
xpath_result = xpath_query '/electronicVersionAssociations/electronicVersionFileAssociations/electronicVersionFileAssociation
|
43
|
+
xpath_result = xpath_query '/electronicVersionAssociations/electronicVersionFileAssociations/electronicVersionFileAssociation'
|
44
44
|
docs = []
|
45
45
|
xpath_result.each do |d|
|
46
46
|
model = Puree::Model::File.new
|
47
|
-
model.name = d.xpath('fileName').text.strip
|
48
|
-
model.mime = d.xpath('mimeType').text.strip
|
49
|
-
model.size = d.xpath('size').text.strip.to_i
|
50
|
-
model.url = d.xpath('url').text.strip
|
47
|
+
model.name = d.xpath('file/fileName').text.strip
|
48
|
+
model.mime = d.xpath('file/mimeType').text.strip
|
49
|
+
model.size = d.xpath('file/size').text.strip.to_i
|
50
|
+
model.url = d.xpath('file/url').text.strip
|
51
|
+
document_license = d.xpath('licenseType')
|
52
|
+
if !document_license.empty?
|
53
|
+
license = Puree::Model::CopyrightLicense.new
|
54
|
+
license.name = document_license.xpath('term/localizedString').text.strip
|
55
|
+
license.url = document_license.xpath('description/localizedString').text.strip
|
56
|
+
model.license = license if license.data?
|
57
|
+
end
|
51
58
|
docs << model
|
52
59
|
end
|
53
60
|
docs.uniq { |d| d.url }
|
54
61
|
end
|
55
62
|
|
63
|
+
# @return [Array<String>]
|
64
|
+
def keywords
|
65
|
+
xpath_result = xpath_query '/keywordGroups/keywordGroup/keyword/userDefinedKeyword/freeKeyword'
|
66
|
+
data_arr = xpath_result.map { |i| i.text.strip }
|
67
|
+
data_arr.uniq
|
68
|
+
end
|
69
|
+
|
56
70
|
# @return [Array<Puree::Model::OrganisationHeader>]
|
57
71
|
def organisations
|
58
72
|
xpath_result = xpath_query '/organisations/association/organisation'
|
@@ -61,7 +75,8 @@ module Puree
|
|
61
75
|
|
62
76
|
# @return [Fixnum, nil]
|
63
77
|
def pages
|
64
|
-
xpath_query_for_single_value('/numberOfPages')
|
78
|
+
xpath_result = xpath_query_for_single_value('/numberOfPages')
|
79
|
+
xpath_result ? xpath_result.to_i : nil
|
65
80
|
end
|
66
81
|
|
67
82
|
# @return [Array<Puree::Model::EndeavourPerson>]
|
@@ -79,6 +94,11 @@ module Puree
|
|
79
94
|
persons 'other'
|
80
95
|
end
|
81
96
|
|
97
|
+
# @return [String, nil]
|
98
|
+
def publisher
|
99
|
+
xpath_query_for_single_value '/associatedPublisher/publisher/name'
|
100
|
+
end
|
101
|
+
|
82
102
|
# @return [Array<Puree::Model::PublicationStatus>]
|
83
103
|
def statuses
|
84
104
|
xpath_result = xpath_query '/publicationStatuses/publicationStatus'
|
data/puree.gemspec
CHANGED
@@ -9,8 +9,6 @@ Gem::Specification.new do |spec|
|
|
9
9
|
spec.authors = 'Adrian Albin-Clark'
|
10
10
|
spec.email = 'a.albin-clark@lancaster.ac.uk'
|
11
11
|
spec.summary = %q{Metadata extraction from the Pure Research Information System.}
|
12
|
-
spec.description = %q{Fetches metadata from the Pure Research Information System and
|
13
|
-
extracts it into Ruby data models.}
|
14
12
|
spec.homepage = 'https://github.com/lulibrary/puree'
|
15
13
|
spec.license = 'MIT'
|
16
14
|
spec.files = `git ls-files -z`.split("\x0")
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: puree
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.
|
4
|
+
version: 1.1.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Adrian Albin-Clark
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2017-03-
|
11
|
+
date: 2017-03-22 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: http
|
@@ -52,9 +52,7 @@ dependencies:
|
|
52
52
|
- - ">="
|
53
53
|
- !ruby/object:Gem::Version
|
54
54
|
version: '0'
|
55
|
-
description:
|
56
|
-
Fetches metadata from the Pure Research Information System and
|
57
|
-
extracts it into Ruby data models.
|
55
|
+
description:
|
58
56
|
email: a.albin-clark@lancaster.ac.uk
|
59
57
|
executables: []
|
60
58
|
extensions: []
|