puree 2.5.0 → 2.5.1

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: d4e5029fa4e6560d831820e7a7852891d3d5aba9ab46fdc0b96d2db151ba0b07
4
- data.tar.gz: 53c2ccd0e77dc22cc61b9e2813e6c97f8bc7c070074de26dde67dfe2b28c8575
3
+ metadata.gz: 823c32f826a65eb4b0721134ab79bcadcd62f748c6ed78d4d471466e503c1312
4
+ data.tar.gz: '0860c55ae39eaece7f7e23a756d0b02d665f5d0e8c437340e1200d416edf93aa'
5
5
  SHA512:
6
- metadata.gz: 9764da69c66d18d6ff3f4ae53e35154f2ca509df28d157be2f751a576cbec4421b47ee722635de65850758493ec2d74148f9b70f081b791d7ca9bc1146d18184
7
- data.tar.gz: 350872633c7a925cf81ef4c67a527b1205a720882860abf71ae81236c93c9adaccaa6f4f7e921efd4e92d06f9c52a51627fc3f1f032eeb7015a2533ced37f92e
6
+ metadata.gz: 622f8407995641df0034b05d141440aa489a4d3b424b6fd5bd6062a9aac5ee0e519afb6fc4a96ebb87021f44f2edb75454f0f66194d075e7ac9f7ccc0d9d9c66
7
+ data.tar.gz: d506dee62955ebdce2076f2b74a6f347d5beb1ad22093a64ed5b248d2520377477fd0e77d8459836971ff51c737082d77c8c09d21683ebdd0e8c72da309fd0fe
@@ -2,6 +2,12 @@
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.5.1 2019-01-11
6
+ ### Fixed
7
+ - Research output - file URL, scopus metric data types.
8
+ - Conference paper - event title.
9
+ - Organisational unit - address post code.
10
+
5
11
  ## 2.5.0 2019-01-04
6
12
  ### Added
7
13
  - REST timeouts.
@@ -6,20 +6,10 @@ module Puree
6
6
  class ResearchOutputScopusMetric < Puree::Model::Structure
7
7
 
8
8
  # @return [Integer, nil]
9
- attr_reader :value
9
+ attr_accessor :value
10
10
 
11
11
  # @return [Integer, nil]
12
- attr_reader :year
13
-
14
- # @param v [Integer]
15
- def value=(v)
16
- @value = v if v && !v.empty?
17
- end
18
-
19
- # @param v [Integer]
20
- def year=(v)
21
- @year = v if v && !v.empty?
22
- end
12
+ attr_accessor :year
23
13
 
24
14
  end
25
15
  end
@@ -1,5 +1,5 @@
1
1
  module Puree
2
2
  # Semantic version number
3
3
  #
4
- VERSION = "2.5.0"
4
+ VERSION = "2.5.1"
5
5
  end
@@ -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
- header.title = xpath_result.xpath('title/localizedString').text.strip
15
+ header.title = xpath_result.xpath('name').text.strip
16
16
  return header if header.data?
17
17
  end
18
18
  nil
@@ -21,7 +21,7 @@ module Puree
21
21
  a.street = street unless street.empty?
22
22
  building = xpath_result.xpath('building').text.strip
23
23
  a.building = building unless building.empty?
24
- postcode = xpath_result.xpath('postalCode').text.strip
24
+ postcode = xpath_result.xpath('postalcode').text.strip
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?
@@ -53,7 +53,7 @@ module Puree
53
53
  model.name = d.xpath('file/fileName').text.strip
54
54
  model.mime = d.xpath('file/mimeType').text.strip
55
55
  model.size = d.xpath('file/size').text.strip.to_i
56
- model.url = d.xpath('file/URL').text.strip
56
+ model.url = d.xpath('file/fileURL').text.strip
57
57
  # document_license = d.xpath('licenseType')
58
58
  # if !document_license.empty?
59
59
  # license = Puree::Model::CopyrightLicense.new
@@ -142,8 +142,8 @@ module Puree
142
142
  data = []
143
143
  xpath_result.each do |i|
144
144
  s = Puree::Model::ResearchOutputScopusMetric.new
145
- s.value = i.xpath('value').text.strip
146
- s.year = i.xpath('year').text.strip
145
+ s.value = i.xpath('value').text.strip.to_i
146
+ s.year = i.xpath('year').text.strip.to_i
147
147
  data << s
148
148
  end
149
149
  data
@@ -0,0 +1,14 @@
1
+ def assert_address(data)
2
+ assert_instance_of Puree::Model::Address, data
3
+ assert data.data?
4
+ assert_instance_of String, data.street
5
+ refute_empty data.street
6
+ assert_instance_of String, data.building
7
+ refute_empty data.building
8
+ assert_instance_of String, data.postcode
9
+ refute_empty data.postcode
10
+ assert_instance_of String, data.city
11
+ refute_empty data.city
12
+ assert_instance_of String, data.country
13
+ refute_empty data.country
14
+ end
@@ -0,0 +1,11 @@
1
+ require_relative 'person_name'
2
+
3
+ def assert_endeavour_person(data)
4
+ assert_instance_of Puree::Model::EndeavourPerson, data
5
+ assert data.data?
6
+ assert_instance_of String, data.uuid
7
+ refute_empty data.uuid
8
+ assert_instance_of String, data.role
9
+ refute_empty data.role
10
+ assert_person_name data.name
11
+ end
@@ -0,0 +1,9 @@
1
+ def assert_name_header(data)
2
+ assert data.data?
3
+ assert_instance_of String, data.uuid
4
+ refute_empty data.uuid
5
+ assert_instance_of String, data.name
6
+ refute_empty data.name
7
+ assert_instance_of String, data.type
8
+ refute_empty data.type
9
+ end
@@ -0,0 +1,8 @@
1
+ def assert_person_name(data)
2
+ assert_instance_of Puree::Model::PersonName, data
3
+ assert data.data?
4
+ assert_instance_of String, data.first
5
+ refute_empty data.first
6
+ assert_instance_of String, data.last
7
+ refute_empty data.last
8
+ end
@@ -0,0 +1,10 @@
1
+ def assert_related_content_header(data)
2
+ assert_instance_of Puree::Model::RelatedContentHeader, data
3
+ assert data.data?
4
+ assert_instance_of String, data.uuid
5
+ refute_empty data.uuid
6
+ assert_instance_of String, data.title
7
+ refute_empty data.title
8
+ assert_instance_of String, data.type
9
+ refute_empty data.type
10
+ end
@@ -0,0 +1,5 @@
1
+ def assert_temporal_range(data)
2
+ assert data.data?
3
+ assert_instance_of Time, data.start
4
+ assert_instance_of Time, data.end
5
+ end
@@ -0,0 +1,9 @@
1
+ def assert_title_header(data)
2
+ assert data.data?
3
+ assert_instance_of String, data.uuid
4
+ refute_empty data.uuid
5
+ assert_instance_of String, data.title
6
+ refute_empty data.title
7
+ assert_instance_of String, data.type
8
+ refute_empty data.type
9
+ end
@@ -76,7 +76,11 @@ class TestResourceFind < Minitest::Test
76
76
 
77
77
  def test_project
78
78
  # The Channel Scheme - Preston
79
- id = '2af1fb5c-ac04-40f3-9cb4-073fb92fcf96'
79
+ # id = '2af1fb5c-ac04-40f3-9cb4-073fb92fcf96'
80
+ # FINISHED
81
+ # uuid changed to
82
+ id = '6acfd7ae-4012-4c82-bb71-2976dbbafbd6'
83
+ # pure_id = '236466684'
80
84
  extractor = Puree::Extractor::Project.new config
81
85
  model = extractor.find id
82
86
 
@@ -0,0 +1,37 @@
1
+ require 'test_model_helper'
2
+
3
+ class TestPersonName < Minitest::Test
4
+
5
+ def person_name_new
6
+ Puree::Model::PersonName.new
7
+ end
8
+
9
+ def test_new
10
+ assert_instance_of Puree::Model::PersonName, person_name_new
11
+ end
12
+
13
+ def person_name
14
+ name = person_name_new
15
+ name.first = 'Foo'
16
+ name.last = 'Bar'
17
+ name
18
+ end
19
+
20
+ def test_first_last
21
+ assert_equal person_name.first_last, 'Foo Bar'
22
+ end
23
+
24
+ def test_last_first
25
+ assert_equal person_name.last_first, 'Bar, Foo'
26
+ end
27
+
28
+ def test_initial_last
29
+ assert_equal person_name.initial_last, 'F. Bar'
30
+ end
31
+
32
+ def test_last_initial
33
+ assert_equal person_name.last_initial, 'Bar, F.'
34
+ end
35
+
36
+ end
37
+
@@ -0,0 +1 @@
1
+ require 'test_helper'
@@ -22,8 +22,15 @@ class TestXMLExtractorPaper < Minitest::Test
22
22
 
23
23
  asserts_resource x
24
24
 
25
- assert_instance_of Puree::Model::EventHeader, x.event
26
- assert_equal true, x.event.data?
25
+ event = x.event
26
+ assert_instance_of Puree::Model::EventHeader, event
27
+ assert event.data?
28
+
29
+ assert_instance_of String, event.title
30
+ refute_empty event.title
31
+
32
+ assert_instance_of String, event.uuid
33
+ refute_empty event.uuid
27
34
 
28
35
  assert_instance_of Integer, x.pages
29
36
  end
@@ -42,7 +49,7 @@ class TestXMLExtractorPaper < Minitest::Test
42
49
  id = 'db2193b7-5cc7-496d-9bd5-35192c6d7ece'
43
50
  x = xml_extractor_from_id id
44
51
 
45
- assert_equal true, x.peer_reviewed
52
+ assert x.peer_reviewed
46
53
  end
47
54
 
48
55
  def test_absence
@@ -1,4 +1,8 @@
1
1
  require 'test_xml_extractor_helper'
2
+ require_relative '../common/endeavour_person'
3
+ require_relative '../common/name_header'
4
+ require_relative '../common/related_content_header'
5
+ require_relative '../common/temporal_range'
2
6
 
3
7
  class TestXMLExtractorDataset < Minitest::Test
4
8
 
@@ -28,11 +32,25 @@ class TestXMLExtractorDataset < Minitest::Test
28
32
  refute_empty x.description
29
33
 
30
34
  assert_instance_of String, x.doi
31
- refute_empty x.doi.to_s
35
+ refute_empty x.doi
32
36
 
33
37
  assert_instance_of Array, x.files
34
38
  assert_instance_of Puree::Model::File, x.files.first
35
- assert_equal true, x.files.first.data?
39
+ assert x.files.first.data?
40
+
41
+ data = x.files.first
42
+ assert_instance_of Puree::Model::File, data
43
+ assert data.data?
44
+ assert_instance_of String, data.name
45
+ refute_empty data.name
46
+ # assert_instance_of String, data.mime
47
+ # refute_empty data.mime
48
+ # assert_instance_of Integer, data.size
49
+ assert_instance_of String, data.url
50
+ refute_empty data.url
51
+ assert_instance_of Puree::Model::CopyrightLicense, data.license
52
+ assert_instance_of String, data.license.name
53
+ refute_empty data.license.name
36
54
 
37
55
  assert_instance_of Array, x.keywords
38
56
  assert_instance_of String, x.keywords.first
@@ -40,35 +58,34 @@ class TestXMLExtractorDataset < Minitest::Test
40
58
 
41
59
  assert_instance_of Array, x.organisational_units
42
60
  assert_instance_of Puree::Model::OrganisationalUnitHeader, x.organisational_units.first
43
- assert_equal true, x.organisational_units.first.data?
61
+ assert_name_header x.organisational_units.first
44
62
 
45
63
  assert_instance_of Puree::Model::OrganisationalUnitHeader, x.owner
46
- assert_equal true, x.owner.data?
64
+ assert_name_header x.owner
47
65
 
48
66
  assert_instance_of Array, x.persons_internal
49
67
  assert_instance_of Puree::Model::EndeavourPerson, x.persons_internal.first
50
- assert_equal true, x.persons_internal.first.data?
68
+ assert_endeavour_person x.persons_internal.first
51
69
 
52
70
  assert_instance_of Array, x.persons_external
53
71
  assert_instance_of Puree::Model::EndeavourPerson, x.persons_external.first
54
- assert_equal true, x.persons_external.first.data?
72
+ assert_endeavour_person x.persons_external.first
55
73
 
56
74
  assert_instance_of Puree::Model::TemporalRange, x.production
57
- assert_equal true, x.production.data?
75
+ assert_temporal_range x.production
58
76
 
59
77
  assert_instance_of Array, x.research_outputs
60
- assert_instance_of Puree::Model::RelatedContentHeader, x.research_outputs.first
61
- assert_equal true, x.research_outputs.first.data?
78
+ assert_related_content_header x.research_outputs.first
62
79
 
63
80
  assert_instance_of Puree::Model::PublisherHeader, x.publisher
64
- assert_equal true, x.publisher.data?
81
+ assert_name_header x.publisher
65
82
 
66
83
  assert_instance_of Array, x.spatial_places
67
84
  assert_instance_of String, x.spatial_places.first
68
85
  refute_empty x.spatial_places.first
69
86
 
70
87
  assert_instance_of Puree::Model::TemporalRange, x.temporal
71
- assert_equal true, x.temporal.data?
88
+ assert_temporal_range x.temporal
72
89
 
73
90
  assert_instance_of String, x.title
74
91
  refute_empty x.title
@@ -83,8 +100,12 @@ class TestXMLExtractorDataset < Minitest::Test
83
100
  x = xml_extractor_from_id id
84
101
 
85
102
  assert_instance_of Array, x.persons_other
86
- assert_instance_of Puree::Model::EndeavourPerson, x.persons_other.first
87
- assert_equal true, x.persons_other.first.data?
103
+ data = x.persons_other.first
104
+ assert_instance_of Puree::Model::EndeavourPerson, data
105
+ assert data.data?
106
+ assert_instance_of String, data.role
107
+ refute_empty data.role
108
+ assert_person_name data.name
88
109
  end
89
110
 
90
111
  def test_spatial_point
@@ -93,7 +114,9 @@ class TestXMLExtractorDataset < Minitest::Test
93
114
  x = xml_extractor_from_id id
94
115
 
95
116
  assert_instance_of Puree::Model::SpatialPoint, x.spatial_point
96
- assert_equal true, x.spatial_point.data?
117
+ assert x.spatial_point.data?
118
+ assert_instance_of Float, x.spatial_point.latitude
119
+ assert_instance_of Float, x.spatial_point.longitude
97
120
  end
98
121
 
99
122
  def test_absence
@@ -26,7 +26,7 @@ class TestXMLEventJournal < Minitest::Test
26
26
  refute_empty x.city
27
27
 
28
28
  assert_instance_of Puree::Model::TemporalRange, x.date
29
- assert_equal true, x.date.data?
29
+ assert x.date.data?
30
30
 
31
31
  assert_instance_of String, x.title
32
32
  refute_empty x.title
@@ -1,4 +1,5 @@
1
1
  require 'test_xml_extractor_helper'
2
+ require_relative '../common/name_header'
2
3
 
3
4
  class TestXMLExtractorExternalOrganisation < Minitest::Test
4
5
 
@@ -1,4 +1,5 @@
1
1
  require 'test_xml_extractor_helper'
2
+ require_relative '../common/title_header'
2
3
 
3
4
  class TestXMLExtractorJournalArticle < Minitest::Test
4
5
 
@@ -25,14 +26,14 @@ class TestXMLExtractorJournalArticle < Minitest::Test
25
26
  assert_instance_of Integer, x.issue
26
27
 
27
28
  assert_instance_of Puree::Model::JournalHeader, x.journal
28
- assert_equal true, x.journal.data?
29
+ assert_title_header x.journal
29
30
 
30
31
  assert_instance_of String, x.page_range
31
32
  refute_empty x.page_range
32
33
 
33
34
  assert_instance_of Integer, x.pages
34
35
 
35
- assert_includes [true, false], x.peer_reviewed
36
+ assert [true, false].include? x.peer_reviewed
36
37
 
37
38
  assert_instance_of Integer, x.volume
38
39
  end
@@ -1,4 +1,5 @@
1
1
  require 'test_xml_extractor_helper'
2
+ require_relative '../common/name_header'
2
3
 
3
4
  class TestXMLExtractorJournal < Minitest::Test
4
5
 
@@ -26,7 +27,8 @@ class TestXMLExtractorJournal < Minitest::Test
26
27
  refute_empty x.issn
27
28
 
28
29
  assert_instance_of Puree::Model::PublisherHeader, x.publisher
29
- assert_equal true, x.publisher.data?
30
+ assert x.publisher.data?
31
+ assert_name_header x.publisher
30
32
 
31
33
  assert_instance_of String, x.title
32
34
  refute_empty x.title
@@ -1,4 +1,6 @@
1
1
  require 'test_xml_extractor_helper'
2
+ require_relative '../common/name_header'
3
+ require_relative '../common/address'
2
4
 
3
5
  class TestXMLExtractorOrganisation < Minitest::Test
4
6
 
@@ -23,7 +25,7 @@ class TestXMLExtractorOrganisation < Minitest::Test
23
25
  asserts_resource x
24
26
 
25
27
  assert_instance_of Puree::Model::Address, x.address
26
- assert_equal true, x.address.data?
28
+ assert_address x.address
27
29
 
28
30
  assert_instance_of Array, x.email_addresses
29
31
  assert_instance_of String, x.email_addresses.first
@@ -33,11 +35,13 @@ class TestXMLExtractorOrganisation < Minitest::Test
33
35
  refute_empty x.name
34
36
 
35
37
  assert_instance_of Puree::Model::OrganisationalUnitHeader, x.parent
36
- assert_equal true, x.parent.data?
38
+ assert x.parent.data?
39
+ assert_name_header x.parent
37
40
 
38
41
  assert_instance_of Array, x.parents
39
42
  assert_instance_of Puree::Model::OrganisationalUnitHeader, x.parents.first
40
- assert_equal true, x.parents.first.data?
43
+ assert x.parents.first.data?
44
+ assert_name_header x.parents.first
41
45
 
42
46
  assert_instance_of Array, x.phone_numbers
43
47
  assert_instance_of String, x.phone_numbers.first
@@ -1,4 +1,6 @@
1
1
  require 'test_xml_extractor_helper'
2
+ require_relative '../common/name_header'
3
+ require_relative '../common/person_name'
2
4
 
3
5
  class TestXMLExtractorPerson < Minitest::Test
4
6
 
@@ -24,7 +26,8 @@ class TestXMLExtractorPerson < Minitest::Test
24
26
 
25
27
  assert_instance_of Array, x.affiliations
26
28
  assert_instance_of Puree::Model::OrganisationalUnitHeader, x.affiliations.first
27
- assert_equal true, x.affiliations.first.data?
29
+ assert x.affiliations.first.data?
30
+ assert_name_header x.affiliations.first
28
31
 
29
32
  assert_instance_of Array, x.email_addresses
30
33
  assert_instance_of String, x.email_addresses.first
@@ -36,14 +39,15 @@ class TestXMLExtractorPerson < Minitest::Test
36
39
 
37
40
  assert_instance_of Array, x.identifiers
38
41
  assert_instance_of Puree::Model::Identifier, x.identifiers.first
39
- assert_equal true, x.identifiers.first.data?
42
+ assert x.identifiers.first.data?
40
43
 
41
44
  assert_instance_of Array, x.keywords
42
45
  assert_instance_of String, x.keywords.first
43
46
  refute_empty x.keywords.first
44
47
 
45
48
  assert_instance_of Puree::Model::PersonName, x.name
46
- assert_equal true, x.name.data?
49
+ assert x.name.data?
50
+ assert_person_name x.name
47
51
 
48
52
  assert_instance_of String, x.orcid
49
53
  refute_empty x.orcid
@@ -1,4 +1,7 @@
1
1
  require 'test_xml_extractor_helper'
2
+ require_relative '../common/endeavour_person'
3
+ require_relative '../common/name_header'
4
+ require_relative '../common/temporal_range'
2
5
 
3
6
  class TestXMLExtractorProject < Minitest::Test
4
7
 
@@ -17,7 +20,11 @@ class TestXMLExtractorProject < Minitest::Test
17
20
 
18
21
  def test_core
19
22
  # The Channel Scheme - Preston
20
- id = '2af1fb5c-ac04-40f3-9cb4-073fb92fcf96'
23
+ # id = '2af1fb5c-ac04-40f3-9cb4-073fb92fcf96'
24
+ # FINISHED
25
+ # uuid changed to
26
+ id = '6acfd7ae-4012-4c82-bb71-2976dbbafbd6'
27
+ # pure_id = '236466684'
21
28
  x = xml_extractor_from_id id
22
29
 
23
30
  assert_instance_of String, x.acronym
@@ -25,11 +32,13 @@ class TestXMLExtractorProject < Minitest::Test
25
32
 
26
33
  assert_instance_of Array, x.external_organisations
27
34
  assert_instance_of Puree::Model::ExternalOrganisationHeader, x.external_organisations.first
28
- assert_equal true, x.external_organisations.first.data?
35
+ assert x.external_organisations.first.data?
36
+ assert_name_header x.external_organisations.first
29
37
 
30
38
  assert_instance_of Array, x.organisational_units
31
39
  assert_instance_of Puree::Model::OrganisationalUnitHeader, x.organisational_units.first
32
- assert_equal true, x.organisational_units.first.data?
40
+ assert x.organisational_units.first.data?
41
+ assert_name_header x.organisational_units.first
33
42
 
34
43
  assert_instance_of String, x.status
35
44
  refute_empty x.status
@@ -42,17 +51,22 @@ class TestXMLExtractorProject < Minitest::Test
42
51
 
43
52
  assert_instance_of Array, x.persons_internal
44
53
  assert_instance_of Puree::Model::EndeavourPerson, x.persons_internal.first
45
- assert_equal true, x.persons_internal.first.data?
54
+ assert x.persons_internal.first.data?
55
+ assert_endeavour_person x.persons_internal.first
46
56
 
47
57
  # persons_other, see Dataset test
48
58
 
49
59
  assert_instance_of Puree::Model::TemporalRange, x.temporal
50
- assert_equal true, x.temporal.data?
60
+ assert_temporal_range x.temporal
51
61
  end
52
62
 
53
63
  def test_description
54
64
  # Designing an inclusive curriculum in higher education
55
- id = '926f34e9-e461-406a-a2b8-3f831456ada0'
65
+ # id = '926f34e9-e461-406a-a2b8-3f831456ada0'
66
+ # FINISHED
67
+ # uuid changed to
68
+ id = '2bf4b724-7c3a-49c7-8a5a-4060a2fc975f'
69
+ # pure_id = '236382102'
56
70
  x = xml_extractor_from_id id
57
71
 
58
72
  assert_instance_of String, x.description
@@ -61,17 +75,25 @@ class TestXMLExtractorProject < Minitest::Test
61
75
 
62
76
  def test_identifiers
63
77
  # Blackburn Parenting and Intensive Family Support Project
64
- id = '1b15fa94-39f0-4809-976a-a04b53592004'
78
+ # id = '1b15fa94-39f0-4809-976a-a04b53592004'
79
+ # FINISHED
80
+ # uuid changed to
81
+ id = 'fc3baafd-f147-4c07-9acc-c98b269fcc4c'
82
+ # pure_id = '236466374'
65
83
  x = xml_extractor_from_id id
66
84
 
67
85
  assert_instance_of Array, x.identifiers
68
86
  assert_instance_of Puree::Model::Identifier, x.identifiers.first
69
- assert_equal true, x.identifiers.first.data?
87
+ assert x.identifiers.first.data?
70
88
  end
71
89
 
72
90
  def test_url
73
91
  # Designing an inclusive curriculum in higher education
74
- id = '926f34e9-e461-406a-a2b8-3f831456ada0'
92
+ # id = '926f34e9-e461-406a-a2b8-3f831456ada0'
93
+ # FINISHED
94
+ # uuid changed to
95
+ id = '2bf4b724-7c3a-49c7-8a5a-4060a2fc975f'
96
+ # pure_id = '236382102'
75
97
  x = xml_extractor_from_id id
76
98
 
77
99
  assert_instance_of String, x.url
@@ -80,12 +102,17 @@ class TestXMLExtractorProject < Minitest::Test
80
102
 
81
103
  def test_persons_external
82
104
  # Children, flood and urban resilience
83
- id = 'a4d07102-8bbb-4110-8969-580a8fd019c0'
105
+ # id = 'a4d07102-8bbb-4110-8969-580a8fd019c0'
106
+ # FINISHED
107
+ # uuid changed to
108
+ id = '31834af4-2b68-49c4-9caf-6875d1ba78eb'
109
+ # pure_id = '236476404'
84
110
  x = xml_extractor_from_id id
85
111
 
86
112
  assert_instance_of Array, x.persons_external
87
113
  assert_instance_of Puree::Model::EndeavourPerson, x.persons_external.first
88
- assert_equal true, x.persons_external.first.data?
114
+ assert x.persons_external.first.data?
115
+ assert_endeavour_person x.persons_external.first
89
116
  end
90
117
 
91
118
  def test_absence
@@ -127,7 +154,11 @@ class TestXMLExtractorProject < Minitest::Test
127
154
 
128
155
  def test_model
129
156
  # The Channel Scheme - Preston
130
- id = '2af1fb5c-ac04-40f3-9cb4-073fb92fcf96'
157
+ # id = '2af1fb5c-ac04-40f3-9cb4-073fb92fcf96'
158
+ # FINISHED
159
+ # uuid changed to
160
+ id = '6acfd7ae-4012-4c82-bb71-2976dbbafbd6'
161
+ # pure_id = '236466684'
131
162
  x = xml_extractor_from_id id
132
163
 
133
164
  assert_instance_of Puree::Model::Project, x.model
@@ -1,4 +1,7 @@
1
1
  require 'test_xml_extractor_helper'
2
+ require_relative '../common/endeavour_person'
3
+ require_relative '../common/name_header'
4
+ require_relative '../common/related_content_header'
2
5
 
3
6
  # Tests Resource methods, via a JournalArticle
4
7
  # Unless otherwise stated, tests ResearchOutput methods via a JournalArticle
@@ -34,8 +37,16 @@ class TestXMLExtractorResearchOutput < Minitest::Test
34
37
  refute_empty x.doi.to_s
35
38
 
36
39
  assert_instance_of Array, x.files
37
- assert_instance_of Puree::Model::File, x.files.first
38
- assert_equal true, x.files.first.data?
40
+ data = x.files.first
41
+ assert_instance_of Puree::Model::File, data
42
+ assert data.data?
43
+ assert_instance_of String, data.name
44
+ refute_empty data.name
45
+ assert_instance_of String, data.mime
46
+ refute_empty data.mime
47
+ assert_instance_of Integer, data.size
48
+ assert_instance_of String, data.url
49
+ refute_empty data.url
39
50
 
40
51
  assert_instance_of String, x.language
41
52
  refute_empty x.language
@@ -48,29 +59,28 @@ class TestXMLExtractorResearchOutput < Minitest::Test
48
59
  refute_empty x.open_access_permission
49
60
 
50
61
  assert_instance_of Array, x.organisational_units
51
- assert_instance_of Puree::Model::OrganisationalUnitHeader, x.organisational_units.first
52
- assert_equal true, x.organisational_units.first.data?
62
+ assert_name_header x.organisational_units.first
53
63
 
54
- assert_instance_of Puree::Model::OrganisationalUnitHeader, x.owner
55
- assert_equal true, x.owner.data?
64
+ assert_name_header x.owner
56
65
 
57
66
  assert_instance_of Array, x.persons_internal
58
- assert_instance_of Puree::Model::EndeavourPerson, x.persons_internal.first
59
- assert_equal true, x.persons_internal.first.data?
67
+ assert_endeavour_person x.persons_internal.first
60
68
 
61
69
  assert_instance_of Array, x.persons_external
62
- assert_instance_of Puree::Model::EndeavourPerson, x.persons_external.first
63
- assert_equal true, x.persons_external.first.data?
70
+ assert_endeavour_person x.persons_external.first
64
71
 
65
72
  assert_instance_of Array, x.publication_statuses
66
- assert_instance_of Puree::Model::PublicationStatus, x.publication_statuses.first
67
- assert_equal true, x.publication_statuses.first.data?
73
+ data = x.publication_statuses.first
74
+ assert_instance_of Puree::Model::PublicationStatus, data
75
+ assert data.data?
76
+ assert_instance_of String, data.stage
77
+ refute_empty data.stage
78
+ assert_instance_of Time, data.date
68
79
 
69
80
  # persons_other, see Dataset test
70
81
 
71
82
  assert_instance_of Array, x.research_outputs
72
- assert_instance_of Puree::Model::RelatedContentHeader, x.research_outputs.first
73
- assert_equal true, x.research_outputs.first.data?
83
+ assert_related_content_header x.research_outputs.first
74
84
 
75
85
  assert_instance_of String, x.type
76
86
  refute_empty x.type
@@ -94,6 +104,7 @@ class TestXMLExtractorResearchOutput < Minitest::Test
94
104
  x = xml_extractor_from_id id
95
105
 
96
106
  assert_instance_of Array, x.dois
107
+ assert_instance_of String, x.dois.first
97
108
  refute_empty x.dois
98
109
  end
99
110
 
@@ -107,14 +118,31 @@ class TestXMLExtractorResearchOutput < Minitest::Test
107
118
  refute_empty x.keywords.first
108
119
  end
109
120
 
110
- def test_projects
111
- # Measurements of the Higgs boson production and decay rates and coupling strengths using pp collision data at s√=7s=7 and 8 TeV in the ATLAS experiment
112
- id = '24ec62e9-a3cc-4402-9ec9-396067949031'
121
+ # def test_projects
122
+ # # Measurements of the Higgs boson production and decay rates and coupling strengths using pp collision data at s√=7s=7 and 8 TeV in the ATLAS experiment
123
+ # id = '24ec62e9-a3cc-4402-9ec9-396067949031'
124
+ # x = xml_extractor_from_id id
125
+ #
126
+ # assert_instance_of Array, x.projects
127
+ #
128
+ # assert_instance_of Puree::Model::RelatedContentHeader, x.projects.first
129
+ # assert_related_content_header x.projects.first
130
+ # Project ATLAS: ATLAS listed as relation in Pure app but no longer available in API response
131
+ # end
132
+
133
+ def test_projects_2
134
+ # Plant diversity and root traits benefit physical properties key to soil function in grasslands
135
+ id = '458ad0e7-6950-4e30-9374-125fbf628548'
113
136
  x = xml_extractor_from_id id
114
137
 
115
138
  assert_instance_of Array, x.projects
139
+
140
+ # Lancaster Environment Centre Project
141
+ # Active on 2019-01-11
142
+ # pure_id = '236382106'
116
143
  assert_instance_of Puree::Model::RelatedContentHeader, x.projects.first
117
- assert_equal true, x.projects.first.data?
144
+ assert_related_content_header x.projects.first
145
+ assert x.projects.first.uuid === 'a2bf957f-d54b-495a-97ac-cf360eeda67f'
118
146
  end
119
147
 
120
148
  def test_scopus_citations_count
@@ -138,8 +166,11 @@ class TestXMLExtractorResearchOutput < Minitest::Test
138
166
  x = xml_extractor_from_id id
139
167
 
140
168
  assert_instance_of Array, x.scopus_metrics
141
- assert_instance_of Puree::Model::ResearchOutputScopusMetric, x.scopus_metrics.first
142
- assert_equal true, x.scopus_metrics.first.data?
169
+ data = x.scopus_metrics.first
170
+ assert_instance_of Puree::Model::ResearchOutputScopusMetric, data
171
+ assert data.data?
172
+ assert_instance_of Integer, data.value
173
+ assert_instance_of Integer, data.year
143
174
  end
144
175
 
145
176
  def test_subtitle
@@ -260,6 +291,6 @@ class TestXMLExtractorResearchOutput < Minitest::Test
260
291
  x = Puree::XMLExtractor::JournalArticle.new xml
261
292
  assert_instance_of Array, x.projects
262
293
  assert_instance_of Puree::Model::RelatedContentHeader, x.projects.first
263
- assert_equal true, x.projects.first.data?
294
+ assert_related_content_header x.projects.first
264
295
  end
265
296
  end
@@ -1,4 +1,5 @@
1
1
  require 'test_xml_extractor_helper'
2
+ require_relative '../common/name_header'
2
3
 
3
4
  class TestXMLExtractorThesis < Minitest::Test
4
5
 
@@ -24,11 +25,10 @@ class TestXMLExtractorThesis < Minitest::Test
24
25
 
25
26
  assert_instance_of Time, x.award_date
26
27
 
27
- assert_instance_of Puree::Model::ExternalOrganisationHeader, x.awarding_institution
28
- assert_equal true, x.awarding_institution.data?
28
+ assert_name_header x.awarding_institution
29
29
 
30
30
  assert_instance_of Puree::Model::PublisherHeader, x.publisher
31
- assert_equal true, x.publisher.data?
31
+ assert_name_header x.publisher
32
32
 
33
33
  assert_instance_of String, x.type
34
34
  refute_empty x.type
@@ -41,7 +41,7 @@ class TestXMLExtractorThesis < Minitest::Test
41
41
 
42
42
  assert_instance_of Array, x.sponsors
43
43
  assert_instance_of Puree::Model::ExternalOrganisationHeader, x.sponsors.first
44
- assert_equal true, x.sponsors.first.data?
44
+ assert_name_header x.sponsors.first
45
45
  end
46
46
 
47
47
  def test_qualification
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.5.0
4
+ version: 2.5.1
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: 2019-01-04 00:00:00.000000000 Z
11
+ date: 2019-01-14 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: http
@@ -199,14 +199,23 @@ files:
199
199
  - lib/puree/xml_extractor/thesis.rb
200
200
  - lib/puree/xml_extractor/xml_extractor.rb
201
201
  - puree.gemspec
202
+ - test/common/address.rb
203
+ - test/common/endeavour_person.rb
204
+ - test/common/name_header.rb
205
+ - test/common/person_name.rb
206
+ - test/common/related_content_header.rb
207
+ - test/common/temporal_range.rb
208
+ - test/common/title_header.rb
202
209
  - test/extractor/resource_count_test.rb
203
210
  - test/extractor/resource_find_test.rb
204
211
  - test/extractor/resource_random_test.rb
205
212
  - test/integration/research_output_types_test.rb
213
+ - test/model/person_name_test.rb
206
214
  - test/rest/base_test.rb
207
215
  - test/rest/common_test.rb
208
216
  - test/test_extractor_helper.rb
209
217
  - test/test_helper.rb
218
+ - test/test_model_helper.rb
210
219
  - test/test_rest_helper.rb
211
220
  - test/test_xml_extractor_helper.rb
212
221
  - test/xml_extractor/xml_extractor_collection_test.rb
@@ -248,14 +257,23 @@ signing_key:
248
257
  specification_version: 4
249
258
  summary: Metadata extraction from the Pure Research Information System.
250
259
  test_files:
260
+ - test/common/address.rb
261
+ - test/common/endeavour_person.rb
262
+ - test/common/name_header.rb
263
+ - test/common/person_name.rb
264
+ - test/common/related_content_header.rb
265
+ - test/common/temporal_range.rb
266
+ - test/common/title_header.rb
251
267
  - test/extractor/resource_count_test.rb
252
268
  - test/extractor/resource_find_test.rb
253
269
  - test/extractor/resource_random_test.rb
254
270
  - test/integration/research_output_types_test.rb
271
+ - test/model/person_name_test.rb
255
272
  - test/rest/base_test.rb
256
273
  - test/rest/common_test.rb
257
274
  - test/test_extractor_helper.rb
258
275
  - test/test_helper.rb
276
+ - test/test_model_helper.rb
259
277
  - test/test_rest_helper.rb
260
278
  - test/test_xml_extractor_helper.rb
261
279
  - test/xml_extractor/xml_extractor_collection_test.rb