puree 2.8.1 → 2.9.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +5 -1
- data/README.md +1 -0
- data/lib/puree/version.rb +1 -1
- data/lib/puree/xml_extractor/collection.rb +1 -1
- data/lib/puree/xml_extractor/dataset.rb +3 -3
- data/lib/puree/xml_extractor/external_organisation.rb +1 -1
- data/lib/puree/xml_extractor/journal_article.rb +1 -1
- data/lib/puree/xml_extractor/mixins/abstract_mixin.rb +1 -1
- data/lib/puree/xml_extractor/mixins/event_mixin.rb +1 -1
- data/lib/puree/xml_extractor/mixins/identifier_mixin.rb +2 -2
- data/lib/puree/xml_extractor/mixins/person_mixin.rb +1 -1
- data/lib/puree/xml_extractor/mixins/project_mixin.rb +2 -2
- data/lib/puree/xml_extractor/mixins/publisher_mixin.rb +2 -2
- data/lib/puree/xml_extractor/mixins/research_output_mixin.rb +2 -2
- data/lib/puree/xml_extractor/mixins/title_mixin.rb +1 -1
- data/lib/puree/xml_extractor/mixins/type_mixin.rb +1 -1
- data/lib/puree/xml_extractor/mixins/workflow_mixin.rb +1 -1
- data/lib/puree/xml_extractor/organisational_unit.rb +3 -3
- data/lib/puree/xml_extractor/person.rb +1 -1
- data/lib/puree/xml_extractor/project.rb +1 -1
- data/lib/puree/xml_extractor/research_output.rb +7 -7
- data/lib/puree/xml_extractor/shared.rb +4 -4
- data/lib/puree/xml_extractor/thesis.rb +1 -1
- data/puree.gemspec +1 -1
- data/test/xml_extractor/xml_extractor_person_test.rb +2 -0
- data/test/xml_extractor/xml_extractor_research_output_test.rb +11 -8
- metadata +5 -5
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: a88708a008306a99ad43c36f4fb1692fd5b59159b70c839b2b1fee47527076fe
|
4
|
+
data.tar.gz: 1de184b1546eeb9712474426ef927c0f15d6c148c44e3614770bb26a0e093355
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 5e18a7383b6547cd0929b8259eac4cbbfeec3e049b5574e36433b525f1dc4d2d939e3f3d81099df8d38943cb36758108cda032baac864499aa0c159c51dbc857
|
7
|
+
data.tar.gz: 780d8bc2d9703342529ea151d84e4a697ccf96345ff34606c267883ce8b6fdd82e9b72b13726877c5585e7b4e700bb8e3247ff74c1900c55818f0498b9088165
|
data/CHANGELOG.md
CHANGED
@@ -2,6 +2,10 @@
|
|
2
2
|
All notable changes to this project will be documented in this file.
|
3
3
|
This project adheres to [Semantic Versioning](http://semver.org/).
|
4
4
|
|
5
|
+
## 2.9.0 2020-02-14
|
6
|
+
### Changed
|
7
|
+
- For Pure API 515, 516.
|
8
|
+
|
5
9
|
## 2.8.1 2019-10-02
|
6
10
|
### Fixed
|
7
11
|
- Research output - title.
|
@@ -17,7 +21,7 @@ This project adheres to [Semantic Versioning](http://semver.org/).
|
|
17
21
|
## 2.7.0 2019-06-06
|
18
22
|
### Changed
|
19
23
|
- For Pure API 513.
|
20
|
-
|
24
|
+
- Dataset, person, research output - keywords.
|
21
25
|
|
22
26
|
### Added
|
23
27
|
- Resource subclasses - id.
|
data/README.md
CHANGED
data/lib/puree/version.rb
CHANGED
@@ -86,7 +86,7 @@ module Puree
|
|
86
86
|
other: []
|
87
87
|
}
|
88
88
|
xpath_result.each do |research_output|
|
89
|
-
xpath_result_type = research_output.xpath('
|
89
|
+
xpath_result_type = research_output.xpath('type/term/text')
|
90
90
|
type = xpath_result_type.first.text.strip unless xpath_result_type.empty?
|
91
91
|
if type
|
92
92
|
case type
|
@@ -46,10 +46,10 @@ module Puree
|
|
46
46
|
# doc['createdDate'] = d.xpath('createdDate').text.strip
|
47
47
|
# doc['visibleOnPortalDate'] = d.xpath('visibleOnPortalDate').text.strip
|
48
48
|
# doc['limitedVisibility'] = d.xpath('limitedVisibility').text.strip
|
49
|
-
document_license = d.xpath('
|
49
|
+
document_license = d.xpath('documentLicense').first
|
50
50
|
if document_license
|
51
51
|
license = Puree::Model::CopyrightLicense.new
|
52
|
-
license.name = document_license.text.strip
|
52
|
+
license.name = document_license.xpath('term/text').text.strip
|
53
53
|
# license.name = document_license.xpath('term/localizedString').text.strip
|
54
54
|
# license.url = document_license.xpath('description/localizedString').text.strip
|
55
55
|
doc.license = license if license.data?
|
@@ -88,7 +88,7 @@ module Puree
|
|
88
88
|
# @return [Array<String>]
|
89
89
|
def spatial_places
|
90
90
|
# Data from free-form text box
|
91
|
-
xpath_result = xpath_query '/
|
91
|
+
xpath_result = xpath_query '/geographicalCoverage'
|
92
92
|
data = []
|
93
93
|
xpath_result.each do |i|
|
94
94
|
data << i.text.strip
|
@@ -26,7 +26,7 @@ module Puree
|
|
26
26
|
header = Puree::Model::JournalHeader.new
|
27
27
|
header.title = xpath_result.xpath('title').text.strip
|
28
28
|
journal = xpath_result.xpath('journal')
|
29
|
-
xpath_result_type = journal.xpath('
|
29
|
+
xpath_result_type = journal.xpath('type/term/text')
|
30
30
|
header.type = xpath_result_type.first.text.strip unless xpath_result_type.empty?
|
31
31
|
header.uuid = journal.attr('uuid').text.strip
|
32
32
|
header
|
@@ -12,7 +12,7 @@ module Puree
|
|
12
12
|
if !xpath_result.empty?
|
13
13
|
header = Puree::Model::EventHeader.new
|
14
14
|
header.uuid = xpath_result.xpath('@uuid').text.strip
|
15
|
-
xpath_result_name = xpath_result.xpath('
|
15
|
+
xpath_result_name = xpath_result.xpath('name/text')
|
16
16
|
header.title = xpath_result_name.first.text.strip unless xpath_result_name.empty?
|
17
17
|
return header if header.data?
|
18
18
|
end
|
@@ -12,8 +12,8 @@ module Puree
|
|
12
12
|
data = []
|
13
13
|
xpath_result.each do |d|
|
14
14
|
identifier = Puree::Model::Identifier.new
|
15
|
-
identifier.id = d.text.strip
|
16
|
-
identifier.type = d.
|
15
|
+
identifier.id = d.xpath('value').text.strip
|
16
|
+
identifier.type = d.xpath('type/term/text').text.strip
|
17
17
|
data << identifier
|
18
18
|
end
|
19
19
|
data.uniq { |d| d.id }
|
@@ -32,7 +32,7 @@ module Puree
|
|
32
32
|
name.first = i.xpath('name/firstName').text.strip
|
33
33
|
name.last = i.xpath('name/lastName').text.strip
|
34
34
|
person.name = name if name.data?
|
35
|
-
xpath_result_role = i.xpath('
|
35
|
+
xpath_result_role = i.xpath('personRole/term/text')
|
36
36
|
person.role = xpath_result_role.first.text.strip unless xpath_result_role.empty?
|
37
37
|
arr << person if person.data?
|
38
38
|
end
|
@@ -14,9 +14,9 @@ module Puree
|
|
14
14
|
xpath_result.each { |i|
|
15
15
|
related = Puree::Model::RelatedContentHeader.new
|
16
16
|
related.uuid = i.attr('uuid').strip
|
17
|
-
xpath_result_name = i.xpath('
|
17
|
+
xpath_result_name = i.xpath('name/text')
|
18
18
|
related.title = xpath_result_name.first.text.strip unless xpath_result_name.empty?
|
19
|
-
xpath_result_type = i.xpath('
|
19
|
+
xpath_result_type = i.xpath('type/term/text')
|
20
20
|
related.type = xpath_result_type.first.text.strip unless xpath_result_type.empty?
|
21
21
|
data_arr << related
|
22
22
|
}
|
@@ -11,9 +11,9 @@ module Puree
|
|
11
11
|
xpath_result = xpath_query '/publisher'
|
12
12
|
h = Puree::Model::PublisherHeader.new
|
13
13
|
h.uuid = xpath_result.xpath('@uuid').text.strip
|
14
|
-
xpath_result_name = xpath_result.xpath('
|
14
|
+
xpath_result_name = xpath_result.xpath('name/text')
|
15
15
|
h.name = xpath_result_name.first.text.strip unless xpath_result_name.empty?
|
16
|
-
xpath_result_type = xpath_result.xpath('
|
16
|
+
xpath_result_type = xpath_result.xpath('type/term/text')
|
17
17
|
h.type = xpath_result_type.first.text.strip unless xpath_result_type.empty?
|
18
18
|
h.data? ? h : nil
|
19
19
|
end
|
@@ -14,9 +14,9 @@ module Puree
|
|
14
14
|
xpath_result.each { |i|
|
15
15
|
related = Puree::Model::RelatedContentHeader.new
|
16
16
|
related.uuid = i.attr('uuid').strip
|
17
|
-
xpath_result_name = i.xpath('
|
17
|
+
xpath_result_name = i.xpath('name/text')
|
18
18
|
related.title = xpath_result_name.first.text.strip unless xpath_result_name.empty?
|
19
|
-
xpath_result_type = i.xpath('
|
19
|
+
xpath_result_type = i.xpath('type/term/text')
|
20
20
|
related.type = xpath_result_type.first.text.strip unless xpath_result_type.empty?
|
21
21
|
data_arr << related
|
22
22
|
}
|
@@ -25,8 +25,8 @@ module Puree
|
|
25
25
|
a.postcode = postcode unless building.empty?
|
26
26
|
city = xpath_result.xpath('city').text.strip
|
27
27
|
a.city = city unless city.empty?
|
28
|
-
country = xpath_result.xpath('
|
29
|
-
a.country = country.
|
28
|
+
country = xpath_result.xpath('country/term/text')
|
29
|
+
a.country = country.text.strip unless country.empty?
|
30
30
|
a
|
31
31
|
end
|
32
32
|
end
|
@@ -38,7 +38,7 @@ module Puree
|
|
38
38
|
|
39
39
|
# @return [String, nil]
|
40
40
|
def name
|
41
|
-
xpath_query_for_single_value '/
|
41
|
+
xpath_query_for_single_value '/name/text'
|
42
42
|
end
|
43
43
|
|
44
44
|
# First parent
|
@@ -22,12 +22,12 @@ module Puree
|
|
22
22
|
|
23
23
|
# @return [String, nil]
|
24
24
|
def bibliographical_note
|
25
|
-
xpath_query_for_single_value '/
|
25
|
+
xpath_query_for_single_value '/bibliographicalNote/text'
|
26
26
|
end
|
27
27
|
|
28
28
|
# @return [String, nil]
|
29
29
|
def category
|
30
|
-
xpath_query_for_single_value '/
|
30
|
+
xpath_query_for_single_value '/category/term/text'
|
31
31
|
end
|
32
32
|
|
33
33
|
# Digital Object Identifier (first one, if many)
|
@@ -72,7 +72,7 @@ module Puree
|
|
72
72
|
|
73
73
|
# @return [String, nil]
|
74
74
|
def language
|
75
|
-
xpath_query_for_single_value '/
|
75
|
+
xpath_query_for_single_value '/language/term/text'
|
76
76
|
end
|
77
77
|
|
78
78
|
# @return [Array<String>, nil]
|
@@ -82,7 +82,7 @@ module Puree
|
|
82
82
|
|
83
83
|
# @return [String, nil]
|
84
84
|
def open_access_permission
|
85
|
-
xpath_query_for_single_value '/
|
85
|
+
xpath_query_for_single_value '/openAccessPermission/term/text'
|
86
86
|
end
|
87
87
|
|
88
88
|
# @return [Array<Puree::Model::EndeavourPerson>]
|
@@ -106,7 +106,7 @@ module Puree
|
|
106
106
|
data = []
|
107
107
|
xpath_result.each do |i|
|
108
108
|
s = Puree::Model::PublicationStatus.new
|
109
|
-
s.stage = i.xpath('
|
109
|
+
s.stage = i.xpath('publicationStatus/term/text').text.strip
|
110
110
|
|
111
111
|
ymd = {}
|
112
112
|
ymd['year'] = i.xpath('publicationDate/year').text.strip
|
@@ -160,12 +160,12 @@ module Puree
|
|
160
160
|
|
161
161
|
# @return [String, nil]
|
162
162
|
def translated_subtitle
|
163
|
-
xpath_query_for_single_value '/
|
163
|
+
xpath_query_for_single_value '/translatedSubTitle/text'
|
164
164
|
end
|
165
165
|
|
166
166
|
# @return [String, nil]
|
167
167
|
def translated_title
|
168
|
-
xpath_query_for_single_value '/
|
168
|
+
xpath_query_for_single_value '/translatedTitle/text'
|
169
169
|
end
|
170
170
|
|
171
171
|
private
|
@@ -10,9 +10,9 @@ module Puree
|
|
10
10
|
def self.external_organisation_header(nokogiri_xml_element)
|
11
11
|
h = Puree::Model::ExternalOrganisationHeader.new
|
12
12
|
h.uuid = nokogiri_xml_element.xpath('@uuid').text.strip
|
13
|
-
xpath_result_name = nokogiri_xml_element.xpath('
|
13
|
+
xpath_result_name = nokogiri_xml_element.xpath('name/text')
|
14
14
|
h.name = xpath_result_name.first.text.strip unless xpath_result_name.empty?
|
15
|
-
xpath_result_type = nokogiri_xml_element.xpath('
|
15
|
+
xpath_result_type = nokogiri_xml_element.xpath('type/term/text')
|
16
16
|
h.type = xpath_result_type.first.text.strip unless xpath_result_type.empty?
|
17
17
|
h.data? ? h : nil
|
18
18
|
end
|
@@ -31,9 +31,9 @@ module Puree
|
|
31
31
|
def self.organisation_header(nokogiri_xml_element)
|
32
32
|
h = Puree::Model::OrganisationalUnitHeader.new
|
33
33
|
h.uuid = nokogiri_xml_element.xpath('@uuid').text.strip
|
34
|
-
xpath_result_name = nokogiri_xml_element.xpath('
|
34
|
+
xpath_result_name = nokogiri_xml_element.xpath('name/text')
|
35
35
|
h.name = xpath_result_name.first.text.strip unless xpath_result_name.empty?
|
36
|
-
xpath_result_type = nokogiri_xml_element.xpath('
|
36
|
+
xpath_result_type = nokogiri_xml_element.xpath('type/term/text')
|
37
37
|
h.type = xpath_result_type.first.text.strip unless xpath_result_type.empty?
|
38
38
|
h.data? ? h : nil
|
39
39
|
end
|
@@ -27,7 +27,7 @@ module Puree
|
|
27
27
|
|
28
28
|
# @return [String, nil]
|
29
29
|
def qualification
|
30
|
-
xpath_query_for_single_value('/
|
30
|
+
xpath_query_for_single_value('/qualification/term/text')
|
31
31
|
end
|
32
32
|
|
33
33
|
# @return [Array<Puree::Model::ExternalOrganisationHeader>]
|
data/puree.gemspec
CHANGED
@@ -21,7 +21,7 @@ Gem::Specification.new do |spec|
|
|
21
21
|
|
22
22
|
spec.required_ruby_version = '~> 2.1'
|
23
23
|
|
24
|
-
spec.add_runtime_dependency 'http', '~>
|
24
|
+
spec.add_runtime_dependency 'http', '~> 4.0'
|
25
25
|
spec.add_runtime_dependency 'nokogiri', '~> 1.6'
|
26
26
|
|
27
27
|
spec.add_development_dependency 'minitest-reporters', '~> 1.1'
|
@@ -20,6 +20,7 @@ class TestXMLExtractorPerson < Minitest::Test
|
|
20
20
|
def test_core
|
21
21
|
# Peter Diggle
|
22
22
|
id = '811d7fc3-047a-40d2-89e6-c85d14a97fb8'
|
23
|
+
|
23
24
|
x = xml_extractor_from_id id
|
24
25
|
|
25
26
|
asserts_resource x
|
@@ -92,6 +93,7 @@ class TestXMLExtractorPerson < Minitest::Test
|
|
92
93
|
def test_model
|
93
94
|
# Peter Diggle
|
94
95
|
id = '811d7fc3-047a-40d2-89e6-c85d14a97fb8'
|
96
|
+
|
95
97
|
x = xml_extractor_from_id id
|
96
98
|
|
97
99
|
assert_instance_of Puree::Model::Person, x.model
|
@@ -293,14 +293,17 @@ class TestXMLExtractorResearchOutput < Minitest::Test
|
|
293
293
|
xml =
|
294
294
|
'<contributionToJournal>
|
295
295
|
<relatedProjects>
|
296
|
-
<relatedProject uuid="
|
297
|
-
<
|
298
|
-
|
299
|
-
|
300
|
-
|
301
|
-
|
302
|
-
|
303
|
-
|
296
|
+
<relatedProject uuid="f74685fd-f1a9-4de9-b9d7-288f690755c6">
|
297
|
+
<link ref="content" href="https://pure.lancs.ac.uk/ws/api/515/projects/f74685fd-f1a9-4de9-b9d7-288f690755c6"/>
|
298
|
+
<name formatted="false">
|
299
|
+
<text locale="en_GB">The Language Bases of Reading Comprehension</text>
|
300
|
+
</name>
|
301
|
+
<type pureId="236382102" uri="/dk/atira/pure/upmproject/upmprojecttypes/upmproject/research">
|
302
|
+
<term formatted="false">
|
303
|
+
<text locale="en_GB">Research</text>
|
304
|
+
</term>
|
305
|
+
</type>
|
306
|
+
</relatedProject>
|
304
307
|
</relatedProjects>
|
305
308
|
</contributionToJournal>'
|
306
309
|
|
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: 2.
|
4
|
+
version: 2.9.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:
|
11
|
+
date: 2020-02-14 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: http
|
@@ -16,14 +16,14 @@ dependencies:
|
|
16
16
|
requirements:
|
17
17
|
- - "~>"
|
18
18
|
- !ruby/object:Gem::Version
|
19
|
-
version: '
|
19
|
+
version: '4.0'
|
20
20
|
type: :runtime
|
21
21
|
prerelease: false
|
22
22
|
version_requirements: !ruby/object:Gem::Requirement
|
23
23
|
requirements:
|
24
24
|
- - "~>"
|
25
25
|
- !ruby/object:Gem::Version
|
26
|
-
version: '
|
26
|
+
version: '4.0'
|
27
27
|
- !ruby/object:Gem::Dependency
|
28
28
|
name: nokogiri
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|
@@ -236,7 +236,7 @@ licenses:
|
|
236
236
|
- MIT
|
237
237
|
metadata:
|
238
238
|
source_code_uri: https://github.com/lulibrary/puree
|
239
|
-
documentation_uri: https://www.rubydoc.info/gems/puree/2.
|
239
|
+
documentation_uri: https://www.rubydoc.info/gems/puree/2.9.0
|
240
240
|
post_install_message:
|
241
241
|
rdoc_options: []
|
242
242
|
require_paths:
|