puree 1.9.1 → 2.0.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 -12
- data/Gemfile +1 -1
- data/README.md +106 -75
- data/lib/puree/extractor/conference_paper.rb +6 -14
- data/lib/puree/extractor/dataset.rb +5 -41
- data/lib/puree/extractor/doctoral_thesis.rb +5 -6
- data/lib/puree/extractor/event.rb +6 -14
- data/lib/puree/extractor/external_organisation.rb +5 -8
- data/lib/puree/extractor/extractor.rb +19 -0
- data/lib/puree/extractor/journal.rb +5 -9
- data/lib/puree/extractor/journal_article.rb +6 -15
- data/lib/puree/extractor/masters_thesis.rb +5 -6
- data/lib/puree/extractor/organisational_unit.rb +25 -0
- data/lib/puree/extractor/paper.rb +6 -11
- data/lib/puree/extractor/person.rb +4 -53
- data/lib/puree/extractor/project.rb +5 -28
- data/lib/puree/extractor/publisher.rb +5 -12
- data/lib/puree/extractor/research_output.rb +20 -0
- data/lib/puree/extractor/resource.rb +22 -58
- data/lib/puree/extractor/thesis.rb +6 -17
- data/lib/puree/model/conference_paper.rb +1 -1
- data/lib/puree/model/dataset.rb +8 -25
- data/lib/puree/model/event.rb +0 -9
- data/lib/puree/model/external_organisation.rb +1 -1
- data/lib/puree/model/external_organisation_header.rb +2 -19
- data/lib/puree/model/identifier.rb +26 -0
- data/lib/puree/model/journal.rb +1 -1
- data/lib/puree/model/journal_article.rb +1 -4
- data/lib/puree/model/model.rb +43 -0
- data/lib/puree/model/{organisation_header.rb → organisation_header_base.rb} +2 -2
- data/lib/puree/model/{organisation.rb → organisational_unit.rb} +3 -6
- data/lib/puree/model/organisational_unit_header.rb +9 -0
- data/lib/puree/model/paper.rb +10 -1
- data/lib/puree/model/person.rb +3 -9
- data/lib/puree/model/project.rb +7 -14
- data/lib/puree/model/publication_status.rb +1 -1
- data/lib/puree/model/publisher.rb +3 -0
- data/lib/puree/model/publisher_header.rb +9 -0
- data/lib/puree/model/{publication.rb → research_output.rb} +18 -20
- data/lib/puree/model/research_output_scopus_metric.rb +26 -0
- data/lib/puree/model/resource.rb +19 -11
- data/lib/puree/model/thesis.rb +6 -3
- data/lib/puree/rest/activity.rb +24 -0
- data/lib/puree/rest/application.rb +24 -0
- data/lib/puree/rest/base.rb +131 -0
- data/lib/puree/rest/classification_scheme.rb +24 -0
- data/lib/puree/rest/client.rb +105 -0
- data/lib/puree/rest/curricula_vitae.rb +24 -0
- data/lib/puree/rest/dataset.rb +24 -0
- data/lib/puree/rest/equipment.rb +24 -0
- data/lib/puree/rest/event.rb +24 -0
- data/lib/puree/rest/external_organisation.rb +24 -0
- data/lib/puree/rest/external_person.rb +24 -0
- data/lib/puree/rest/impact.rb +24 -0
- data/lib/puree/rest/journal.rb +24 -0
- data/lib/puree/rest/mixins/active_mixin.rb +14 -0
- data/lib/puree/rest/mixins/activity_mixin.rb +14 -0
- data/lib/puree/rest/mixins/application_mixin.rb +15 -0
- data/lib/puree/rest/mixins/award_mixin.rb +15 -0
- data/lib/puree/rest/mixins/dataset_mixin.rb +15 -0
- data/lib/puree/rest/mixins/former_mixin.rb +14 -0
- data/lib/puree/rest/mixins/impact_mixin.rb +15 -0
- data/lib/puree/rest/mixins/person_mixin.rb +15 -0
- data/lib/puree/rest/mixins/press_media_mixin.rb +15 -0
- data/lib/puree/rest/mixins/prize_mixin.rb +15 -0
- data/lib/puree/rest/mixins/project_mixin.rb +15 -0
- data/lib/puree/rest/mixins/research_output_mixin.rb +15 -0
- data/lib/puree/rest/mixins/student_thesis_mixin.rb +15 -0
- data/lib/puree/rest/organisational_unit.rb +51 -0
- data/lib/puree/rest/person.rb +58 -0
- data/lib/puree/rest/press_media.rb +24 -0
- data/lib/puree/rest/prize.rb +24 -0
- data/lib/puree/rest/project.rb +27 -0
- data/lib/puree/rest/publisher.rb +31 -0
- data/lib/puree/rest/research_output.rb +24 -0
- data/lib/puree/rest/rest.rb +30 -0
- data/lib/puree/util/util.rb +3 -0
- data/lib/puree/version.rb +1 -1
- data/lib/puree/xml_extractor/base.rb +6 -6
- data/lib/puree/xml_extractor/collection.rb +112 -19
- data/lib/puree/xml_extractor/conference_paper.rb +9 -2
- data/lib/puree/xml_extractor/dataset.rb +56 -166
- data/lib/puree/xml_extractor/doctoral_thesis.rb +1 -1
- data/lib/puree/xml_extractor/event.rb +16 -19
- data/lib/puree/xml_extractor/external_organisation.rb +14 -5
- data/lib/puree/xml_extractor/journal.rb +18 -8
- data/lib/puree/xml_extractor/journal_article.rb +24 -11
- data/lib/puree/xml_extractor/masters_thesis.rb +1 -1
- data/lib/puree/xml_extractor/mixins/abstract_mixin.rb +17 -0
- data/lib/puree/xml_extractor/mixins/description_mixin.rb +17 -0
- data/lib/puree/xml_extractor/mixins/{external_organisations_mixin.rb → external_organisation_mixin.rb} +2 -2
- data/lib/puree/xml_extractor/mixins/identifier_mixin.rb +25 -0
- data/lib/puree/xml_extractor/mixins/keyword_mixin.rb +21 -0
- data/lib/puree/xml_extractor/mixins/organisational_unit_mixin.rb +18 -0
- data/lib/puree/xml_extractor/mixins/owner_mixin.rb +18 -0
- data/lib/puree/xml_extractor/mixins/peer_reviewed_mixin.rb +1 -1
- data/lib/puree/xml_extractor/mixins/person_mixin.rb +45 -0
- data/lib/puree/xml_extractor/mixins/publisher_mixin.rb +22 -0
- data/lib/puree/xml_extractor/mixins/{associated_mixin.rb → research_output_mixin.rb} +7 -7
- data/lib/puree/xml_extractor/mixins/title_mixin.rb +17 -0
- data/lib/puree/xml_extractor/mixins/type_mixin.rb +17 -0
- data/lib/puree/xml_extractor/mixins/workflow_mixin.rb +17 -0
- data/lib/puree/xml_extractor/organisational_unit.rb +82 -0
- data/lib/puree/xml_extractor/paper.rb +17 -3
- data/lib/puree/xml_extractor/person.rb +30 -35
- data/lib/puree/xml_extractor/project.rb +39 -75
- data/lib/puree/xml_extractor/publisher.rb +15 -6
- data/lib/puree/xml_extractor/research_output.rb +189 -0
- data/lib/puree/xml_extractor/resource.rb +28 -36
- data/lib/puree/xml_extractor/shared.rb +12 -9
- data/lib/puree/xml_extractor/thesis.rb +29 -15
- data/lib/puree/xml_extractor/xml_extractor.rb +43 -0
- data/lib/puree.rb +5 -114
- data/puree.gemspec +1 -1
- data/test/extractor/resource_test.rb +103 -0
- data/test/rest/base_test.rb +45 -0
- data/test/rest/common_test.rb +44 -0
- data/test/test_extractor_helper.rb +1 -0
- data/test/test_helper.rb +17 -0
- data/test/test_rest_helper.rb +82 -0
- data/test/test_xml_extractor_helper.rb +17 -0
- data/test/xml_extractor/xml_extractor_collection_test.rb +120 -0
- data/test/xml_extractor/xml_extractor_conference_paper_test.rb +69 -0
- data/test/xml_extractor/xml_extractor_dataset_test.rb +156 -0
- data/test/xml_extractor/xml_extractor_event_test.rb +58 -0
- data/test/xml_extractor/xml_extractor_external_organisation_test.rb +49 -0
- data/test/xml_extractor/xml_extractor_journal_article_test.rb +66 -0
- data/test/xml_extractor/xml_extractor_journal_test.rb +53 -0
- data/test/xml_extractor/xml_extractor_organisation_test.rb +80 -0
- data/test/xml_extractor/xml_extractor_person_test.rb +88 -0
- data/test/xml_extractor/xml_extractor_project_test.rb +136 -0
- data/test/xml_extractor/xml_extractor_publisher_test.rb +49 -0
- data/test/xml_extractor/xml_extractor_research_output_test.rb +214 -0
- data/test/xml_extractor/xml_extractor_thesis_test.rb +80 -0
- metadata +105 -68
- data/lib/puree/api/api.rb +0 -9
- data/lib/puree/api/authentication.rb +0 -33
- data/lib/puree/api/configuration.rb +0 -43
- data/lib/puree/api/map.rb +0 -80
- data/lib/puree/api/person_request.rb +0 -64
- data/lib/puree/api/request.rb +0 -119
- data/lib/puree/extractor/collection.rb +0 -131
- data/lib/puree/extractor/download.rb +0 -71
- data/lib/puree/extractor/organisation.rb +0 -34
- data/lib/puree/extractor/paper_base.rb +0 -28
- data/lib/puree/extractor/publication.rb +0 -53
- data/lib/puree/extractor/server.rb +0 -56
- data/lib/puree/model/download_header.rb +0 -21
- data/lib/puree/model/paper_base.rb +0 -19
- data/lib/puree/model/server.rb +0 -13
- data/lib/puree/query/funding.rb +0 -54
- data/lib/puree/query/person.rb +0 -121
- data/lib/puree/query/query.rb +0 -6
- data/lib/puree/xml_extractor/download.rb +0 -42
- data/lib/puree/xml_extractor/mixins/workflow_state_mixin.rb +0 -18
- data/lib/puree/xml_extractor/organisation.rb +0 -75
- data/lib/puree/xml_extractor/paper_base.rb +0 -17
- data/lib/puree/xml_extractor/publication.rb +0 -257
- data/lib/puree/xml_extractor/server.rb +0 -32
- data/spec/download_http_spec.rb +0 -31
- data/spec/open_api_dataset_http_spec.rb +0 -15
- data/spec/query/funding_http_spec.rb +0 -29
- data/spec/query/person_http_spec.rb +0 -52
- data/spec/resource/collection_all_http_spec.rb +0 -77
- data/spec/resource/collection_http_spec.rb +0 -65
- data/spec/resource/dataset_http_spec.rb +0 -112
- data/spec/resource/event_http_spec.rb +0 -52
- data/spec/resource/journal_http_spec.rb +0 -36
- data/spec/resource/organisation_http_spec.rb +0 -52
- data/spec/resource/person_http_spec.rb +0 -60
- data/spec/resource/project_http_spec.rb +0 -89
- data/spec/resource/publication_http_spec.rb +0 -126
- data/spec/resource/publisher_http_spec.rb +0 -26
- data/spec/server_http_spec.rb +0 -26
- data/spec/spec_helper.rb +0 -159
@@ -0,0 +1,66 @@
|
|
1
|
+
require 'test_xml_extractor_helper'
|
2
|
+
|
3
|
+
class TestXMLExtractorJournalArticle < Minitest::Test
|
4
|
+
|
5
|
+
def xml_extractor_from_id(id)
|
6
|
+
client = Puree::REST::Client.new config
|
7
|
+
response = client.research_outputs.find id: id
|
8
|
+
Puree::XMLExtractor::JournalArticle.new response.to_s
|
9
|
+
end
|
10
|
+
|
11
|
+
def test_initialize
|
12
|
+
xml = '<foo/>'
|
13
|
+
xml_extractor = Puree::XMLExtractor::JournalArticle.new xml
|
14
|
+
|
15
|
+
assert_instance_of Puree::XMLExtractor::JournalArticle, xml_extractor
|
16
|
+
end
|
17
|
+
|
18
|
+
def test_core
|
19
|
+
# A theoretical framework for estimation of AUCs in complete and incomplete sampling designs
|
20
|
+
id = 'a7c104d0-e243-463e-a2a4-b4e07bcfde3f'
|
21
|
+
x = xml_extractor_from_id id
|
22
|
+
|
23
|
+
asserts_resource x
|
24
|
+
|
25
|
+
assert_instance_of Fixnum, x.issue
|
26
|
+
|
27
|
+
assert_instance_of Puree::Model::JournalHeader, x.journal
|
28
|
+
assert_equal true, x.journal.data?
|
29
|
+
|
30
|
+
assert_instance_of String, x.page_range
|
31
|
+
refute_empty x.page_range
|
32
|
+
|
33
|
+
assert_instance_of Fixnum, x.pages
|
34
|
+
|
35
|
+
assert_includes [true, false], x.peer_reviewed
|
36
|
+
|
37
|
+
assert_instance_of Fixnum, x.volume
|
38
|
+
end
|
39
|
+
|
40
|
+
def test_absence
|
41
|
+
xml = '<foo/>'
|
42
|
+
x = Puree::XMLExtractor::JournalArticle.new xml
|
43
|
+
|
44
|
+
assert_nil x.issue
|
45
|
+
|
46
|
+
assert_nil x.journal
|
47
|
+
|
48
|
+
assert_nil x.page_range
|
49
|
+
|
50
|
+
assert_nil x.pages
|
51
|
+
|
52
|
+
assert_nil x.peer_reviewed
|
53
|
+
|
54
|
+
assert_nil x.volume
|
55
|
+
end
|
56
|
+
|
57
|
+
def test_model
|
58
|
+
# A theoretical framework for estimation of AUCs in complete and incomplete sampling designs
|
59
|
+
id = 'a7c104d0-e243-463e-a2a4-b4e07bcfde3f'
|
60
|
+
x = xml_extractor_from_id id
|
61
|
+
|
62
|
+
assert_instance_of Puree::Model::JournalArticle, x.model
|
63
|
+
|
64
|
+
end
|
65
|
+
|
66
|
+
end
|
@@ -0,0 +1,53 @@
|
|
1
|
+
require 'test_xml_extractor_helper'
|
2
|
+
|
3
|
+
class TestXMLExtractorJournal < Minitest::Test
|
4
|
+
|
5
|
+
def xml_extractor_from_id(id)
|
6
|
+
client = Puree::REST::Client.new config
|
7
|
+
response = client.journals.find id: id
|
8
|
+
Puree::XMLExtractor::Journal.new response.to_s
|
9
|
+
end
|
10
|
+
|
11
|
+
def test_initialize
|
12
|
+
xml = '<foo/>'
|
13
|
+
xml_extractor = Puree::XMLExtractor::Journal.new xml
|
14
|
+
|
15
|
+
assert_instance_of Puree::XMLExtractor::Journal, xml_extractor
|
16
|
+
end
|
17
|
+
|
18
|
+
def test_core
|
19
|
+
# Chemical Geology
|
20
|
+
id = '95e40a10-1799-4e74-9a70-8b03f27d9acb'
|
21
|
+
x = xml_extractor_from_id id
|
22
|
+
|
23
|
+
asserts_resource x
|
24
|
+
|
25
|
+
assert_instance_of String, x.issn
|
26
|
+
refute_empty x.issn
|
27
|
+
|
28
|
+
assert_instance_of Puree::Model::PublisherHeader, x.publisher
|
29
|
+
assert_equal true, x.publisher.data?
|
30
|
+
|
31
|
+
assert_instance_of String, x.title
|
32
|
+
refute_empty x.title
|
33
|
+
end
|
34
|
+
|
35
|
+
def test_absence
|
36
|
+
xml = '<foo/>'
|
37
|
+
x = Puree::XMLExtractor::Journal.new xml
|
38
|
+
|
39
|
+
assert_nil x.issn
|
40
|
+
|
41
|
+
assert_nil x.publisher
|
42
|
+
|
43
|
+
assert_nil x.title
|
44
|
+
end
|
45
|
+
|
46
|
+
def test_model
|
47
|
+
# Chemical Geology
|
48
|
+
id = '95e40a10-1799-4e74-9a70-8b03f27d9acb'
|
49
|
+
x = xml_extractor_from_id id
|
50
|
+
|
51
|
+
assert_instance_of Puree::Model::Journal, x.model
|
52
|
+
end
|
53
|
+
end
|
@@ -0,0 +1,80 @@
|
|
1
|
+
require 'test_xml_extractor_helper'
|
2
|
+
|
3
|
+
class TestXMLExtractorOrganisation < Minitest::Test
|
4
|
+
|
5
|
+
def xml_extractor_from_id(id)
|
6
|
+
client = Puree::REST::Client.new config
|
7
|
+
response = client.organisational_units.find id: id
|
8
|
+
Puree::XMLExtractor::OrganisationalUnit.new response.to_s
|
9
|
+
end
|
10
|
+
|
11
|
+
def test_initialize
|
12
|
+
xml = '<foo/>'
|
13
|
+
xml_extractor = Puree::XMLExtractor::OrganisationalUnit.new xml
|
14
|
+
|
15
|
+
assert_instance_of Puree::XMLExtractor::OrganisationalUnit, xml_extractor
|
16
|
+
end
|
17
|
+
|
18
|
+
def test_core
|
19
|
+
# Faculty of Health and Medicine
|
20
|
+
id = '8a58c4ad-2d5a-463a-841a-38839ff73a63'
|
21
|
+
x = xml_extractor_from_id id
|
22
|
+
|
23
|
+
asserts_resource x
|
24
|
+
|
25
|
+
assert_instance_of Puree::Model::Address, x.address
|
26
|
+
assert_equal true, x.address.data?
|
27
|
+
|
28
|
+
assert_instance_of Array, x.email_addresses
|
29
|
+
assert_instance_of String, x.email_addresses.first
|
30
|
+
refute_empty x.email_addresses.first
|
31
|
+
|
32
|
+
assert_instance_of String, x.name
|
33
|
+
refute_empty x.name
|
34
|
+
|
35
|
+
assert_instance_of Puree::Model::OrganisationalUnitHeader, x.parent
|
36
|
+
assert_equal true, x.parent.data?
|
37
|
+
|
38
|
+
assert_instance_of Array, x.phone_numbers
|
39
|
+
assert_instance_of String, x.phone_numbers.first
|
40
|
+
refute_empty x.phone_numbers.first
|
41
|
+
|
42
|
+
assert_instance_of String, x.type
|
43
|
+
refute_empty x.type
|
44
|
+
|
45
|
+
assert_instance_of Array, x.urls
|
46
|
+
assert_instance_of String, x.urls.first
|
47
|
+
refute_empty x.urls.first
|
48
|
+
end
|
49
|
+
|
50
|
+
def test_absence
|
51
|
+
xml = '<foo/>'
|
52
|
+
x = Puree::XMLExtractor::OrganisationalUnit.new xml
|
53
|
+
|
54
|
+
assert_nil x.address
|
55
|
+
|
56
|
+
assert_instance_of Array, x.email_addresses
|
57
|
+
assert_empty x.email_addresses
|
58
|
+
|
59
|
+
assert_nil x.name
|
60
|
+
|
61
|
+
assert_nil x.parent
|
62
|
+
|
63
|
+
assert_instance_of Array, x.phone_numbers
|
64
|
+
assert_empty x.phone_numbers
|
65
|
+
|
66
|
+
assert_nil x.type
|
67
|
+
|
68
|
+
assert_instance_of Array, x.urls
|
69
|
+
assert_empty x.urls
|
70
|
+
end
|
71
|
+
|
72
|
+
def test_model
|
73
|
+
# Faculty of Health and Medicine
|
74
|
+
id = '8a58c4ad-2d5a-463a-841a-38839ff73a63'
|
75
|
+
x = xml_extractor_from_id id
|
76
|
+
|
77
|
+
assert_instance_of Puree::Model::OrganisationalUnit, x.model
|
78
|
+
end
|
79
|
+
|
80
|
+
end
|
@@ -0,0 +1,88 @@
|
|
1
|
+
require 'test_xml_extractor_helper'
|
2
|
+
|
3
|
+
class TestXMLExtractorPerson < Minitest::Test
|
4
|
+
|
5
|
+
def xml_extractor_from_id(id)
|
6
|
+
client = Puree::REST::Client.new config
|
7
|
+
response = client.persons.find id: id
|
8
|
+
Puree::XMLExtractor::Person.new response.to_s
|
9
|
+
end
|
10
|
+
|
11
|
+
def test_initialize
|
12
|
+
xml = '<foo/>'
|
13
|
+
xml_extractor = Puree::XMLExtractor::Person.new xml
|
14
|
+
|
15
|
+
assert_instance_of Puree::XMLExtractor::Person, xml_extractor
|
16
|
+
end
|
17
|
+
|
18
|
+
def test_core
|
19
|
+
# Peter Diggle
|
20
|
+
id = '811d7fc3-047a-40d2-89e6-c85d14a97fb8'
|
21
|
+
x = xml_extractor_from_id id
|
22
|
+
|
23
|
+
asserts_resource x
|
24
|
+
|
25
|
+
assert_instance_of Array, x.affiliations
|
26
|
+
assert_instance_of Puree::Model::OrganisationalUnitHeader, x.affiliations.first
|
27
|
+
assert_equal true, x.affiliations.first.data?
|
28
|
+
|
29
|
+
assert_instance_of Array, x.email_addresses
|
30
|
+
assert_instance_of String, x.email_addresses.first
|
31
|
+
refute_empty x.email_addresses.first
|
32
|
+
|
33
|
+
assert_instance_of Array, x.image_urls
|
34
|
+
assert_instance_of String, x.image_urls.first
|
35
|
+
refute_empty x.image_urls.first
|
36
|
+
|
37
|
+
assert_instance_of Array, x.identifiers
|
38
|
+
assert_instance_of Puree::Model::Identifier, x.identifiers.first
|
39
|
+
assert_equal true, x.identifiers.first.data?
|
40
|
+
|
41
|
+
assert_instance_of Array, x.keywords
|
42
|
+
assert_instance_of String, x.keywords.first
|
43
|
+
refute_empty x.keywords.first
|
44
|
+
|
45
|
+
assert_instance_of Puree::Model::PersonName, x.name
|
46
|
+
assert_equal true, x.name.data?
|
47
|
+
|
48
|
+
assert_instance_of String, x.orcid
|
49
|
+
refute_empty x.orcid
|
50
|
+
end
|
51
|
+
|
52
|
+
# def test_scopus_id
|
53
|
+
# # Elizabeth Shove
|
54
|
+
# id = '4c9b74b5-2f7a-4d4d-89fb-64a2e43d3cad'
|
55
|
+
# end
|
56
|
+
|
57
|
+
def test_absence
|
58
|
+
xml = '<foo/>'
|
59
|
+
x = Puree::XMLExtractor::Person.new xml
|
60
|
+
|
61
|
+
assert_instance_of Array, x.affiliations
|
62
|
+
assert_empty x.affiliations
|
63
|
+
|
64
|
+
assert_instance_of Array, x.email_addresses
|
65
|
+
assert_empty x.email_addresses
|
66
|
+
|
67
|
+
assert_instance_of Array, x.identifiers
|
68
|
+
assert_empty x.identifiers
|
69
|
+
|
70
|
+
assert_instance_of Array, x.image_urls
|
71
|
+
assert_empty x.image_urls
|
72
|
+
|
73
|
+
assert_instance_of Array, x.keywords
|
74
|
+
assert_empty x.keywords
|
75
|
+
|
76
|
+
assert_nil x.name
|
77
|
+
|
78
|
+
assert_nil x.orcid
|
79
|
+
end
|
80
|
+
|
81
|
+
def test_model
|
82
|
+
# Peter Diggle
|
83
|
+
id = '811d7fc3-047a-40d2-89e6-c85d14a97fb8'
|
84
|
+
x = xml_extractor_from_id id
|
85
|
+
|
86
|
+
assert_instance_of Puree::Model::Person, x.model
|
87
|
+
end
|
88
|
+
end
|
@@ -0,0 +1,136 @@
|
|
1
|
+
require 'test_xml_extractor_helper'
|
2
|
+
|
3
|
+
class TestXMLExtractorProject < Minitest::Test
|
4
|
+
|
5
|
+
def xml_extractor_from_id(id)
|
6
|
+
client = Puree::REST::Client.new config
|
7
|
+
response = client.projects.find id: id
|
8
|
+
Puree::XMLExtractor::Project.new response.to_s
|
9
|
+
end
|
10
|
+
|
11
|
+
def test_initialize
|
12
|
+
xml = '<foo/>'
|
13
|
+
xml_extractor = Puree::XMLExtractor::Project.new xml
|
14
|
+
|
15
|
+
assert_instance_of Puree::XMLExtractor::Project, xml_extractor
|
16
|
+
end
|
17
|
+
|
18
|
+
def test_core
|
19
|
+
# The Channel Scheme - Preston
|
20
|
+
id = '2af1fb5c-ac04-40f3-9cb4-073fb92fcf96'
|
21
|
+
x = xml_extractor_from_id id
|
22
|
+
|
23
|
+
assert_instance_of String, x.acronym
|
24
|
+
refute_empty x.acronym
|
25
|
+
|
26
|
+
assert_instance_of Array, x.external_organisations
|
27
|
+
assert_instance_of Puree::Model::ExternalOrganisationHeader, x.external_organisations.first
|
28
|
+
assert_equal true, x.external_organisations.first.data?
|
29
|
+
|
30
|
+
assert_instance_of Array, x.organisational_units
|
31
|
+
assert_instance_of Puree::Model::OrganisationalUnitHeader, x.organisational_units.first
|
32
|
+
assert_equal true, x.organisational_units.first.data?
|
33
|
+
|
34
|
+
assert_instance_of String, x.status
|
35
|
+
refute_empty x.status
|
36
|
+
|
37
|
+
assert_instance_of String, x.title
|
38
|
+
refute_empty x.title
|
39
|
+
|
40
|
+
assert_instance_of String, x.type
|
41
|
+
refute_empty x.type
|
42
|
+
|
43
|
+
assert_instance_of Array, x.persons_internal
|
44
|
+
assert_instance_of Puree::Model::EndeavourPerson, x.persons_internal.first
|
45
|
+
assert_equal true, x.persons_internal.first.data?
|
46
|
+
|
47
|
+
# persons_other, see Dataset test
|
48
|
+
|
49
|
+
assert_instance_of Puree::Model::TemporalRange, x.temporal
|
50
|
+
assert_equal true, x.temporal.data?
|
51
|
+
end
|
52
|
+
|
53
|
+
def test_description
|
54
|
+
# Designing an inclusive curriculum in higher education
|
55
|
+
id = '926f34e9-e461-406a-a2b8-3f831456ada0'
|
56
|
+
x = xml_extractor_from_id id
|
57
|
+
|
58
|
+
assert_instance_of String, x.description
|
59
|
+
refute_empty x.description
|
60
|
+
end
|
61
|
+
|
62
|
+
def test_identifiers
|
63
|
+
# Blackburn Parenting and Intensive Family Support Project
|
64
|
+
id = '1b15fa94-39f0-4809-976a-a04b53592004'
|
65
|
+
x = xml_extractor_from_id id
|
66
|
+
|
67
|
+
assert_instance_of Array, x.identifiers
|
68
|
+
assert_instance_of Puree::Model::Identifier, x.identifiers.first
|
69
|
+
assert_equal true, x.identifiers.first.data?
|
70
|
+
end
|
71
|
+
|
72
|
+
def test_url
|
73
|
+
# Designing an inclusive curriculum in higher education
|
74
|
+
id = '926f34e9-e461-406a-a2b8-3f831456ada0'
|
75
|
+
x = xml_extractor_from_id id
|
76
|
+
|
77
|
+
assert_instance_of String, x.url
|
78
|
+
refute_empty x.url
|
79
|
+
end
|
80
|
+
|
81
|
+
def test_persons_external
|
82
|
+
# Children, flood and urban resilience
|
83
|
+
id = 'a4d07102-8bbb-4110-8969-580a8fd019c0'
|
84
|
+
x = xml_extractor_from_id id
|
85
|
+
|
86
|
+
assert_instance_of Array, x.persons_external
|
87
|
+
assert_instance_of Puree::Model::EndeavourPerson, x.persons_external.first
|
88
|
+
assert_equal true, x.persons_external.first.data?
|
89
|
+
end
|
90
|
+
|
91
|
+
def test_absence
|
92
|
+
xml = '<foo/>'
|
93
|
+
x = Puree::XMLExtractor::Project.new xml
|
94
|
+
|
95
|
+
assert_nil x.acronym
|
96
|
+
|
97
|
+
assert_nil x.description
|
98
|
+
|
99
|
+
assert_instance_of Array, x.external_organisations
|
100
|
+
assert_empty x.external_organisations
|
101
|
+
|
102
|
+
assert_instance_of Array, x.identifiers
|
103
|
+
assert_empty x.identifiers
|
104
|
+
|
105
|
+
assert_instance_of Array, x.organisational_units
|
106
|
+
assert_empty x.organisational_units
|
107
|
+
|
108
|
+
assert_instance_of Array, x.persons_internal
|
109
|
+
assert_empty x.persons_internal
|
110
|
+
|
111
|
+
assert_instance_of Array, x.persons_external
|
112
|
+
assert_empty x.persons_external
|
113
|
+
|
114
|
+
assert_instance_of Array, x.persons_other
|
115
|
+
assert_empty x.persons_other
|
116
|
+
|
117
|
+
assert_nil x.status
|
118
|
+
|
119
|
+
assert_nil x.temporal
|
120
|
+
|
121
|
+
assert_nil x.title
|
122
|
+
|
123
|
+
assert_nil x.type
|
124
|
+
|
125
|
+
assert_nil x.url
|
126
|
+
end
|
127
|
+
|
128
|
+
def test_model
|
129
|
+
# The Channel Scheme - Preston
|
130
|
+
id = '2af1fb5c-ac04-40f3-9cb4-073fb92fcf96'
|
131
|
+
x = xml_extractor_from_id id
|
132
|
+
|
133
|
+
assert_instance_of Puree::Model::Project, x.model
|
134
|
+
end
|
135
|
+
|
136
|
+
end
|
@@ -0,0 +1,49 @@
|
|
1
|
+
require 'test_xml_extractor_helper'
|
2
|
+
|
3
|
+
class TestXMLExtractorExternalPublisher < Minitest::Test
|
4
|
+
|
5
|
+
def xml_extractor_from_id(id)
|
6
|
+
client = Puree::REST::Client.new config
|
7
|
+
response = client.publishers.find id: id
|
8
|
+
Puree::XMLExtractor::Publisher.new response.to_s
|
9
|
+
end
|
10
|
+
|
11
|
+
def test_initialize
|
12
|
+
xml = '<foo/>'
|
13
|
+
xml_extractor = Puree::XMLExtractor::Publisher.new xml
|
14
|
+
|
15
|
+
assert_instance_of Puree::XMLExtractor::Publisher, xml_extractor
|
16
|
+
end
|
17
|
+
|
18
|
+
def test_core
|
19
|
+
# Cambridge University Press
|
20
|
+
id = '46065866-5e59-4761-a982-55b382579fdf'
|
21
|
+
x = xml_extractor_from_id id
|
22
|
+
|
23
|
+
asserts_resource x
|
24
|
+
|
25
|
+
assert_instance_of String, x.name
|
26
|
+
refute_empty x.name
|
27
|
+
|
28
|
+
assert_instance_of String, x.type
|
29
|
+
refute_empty x.type
|
30
|
+
end
|
31
|
+
|
32
|
+
def test_absence
|
33
|
+
xml = '<foo/>'
|
34
|
+
x = Puree::XMLExtractor::Publisher.new xml
|
35
|
+
|
36
|
+
assert_nil x.name
|
37
|
+
|
38
|
+
assert_nil x.type
|
39
|
+
end
|
40
|
+
|
41
|
+
def test_model
|
42
|
+
# Cambridge University Press
|
43
|
+
id = '46065866-5e59-4761-a982-55b382579fdf'
|
44
|
+
x = xml_extractor_from_id id
|
45
|
+
|
46
|
+
assert_instance_of Puree::Model::Publisher, x.model
|
47
|
+
end
|
48
|
+
|
49
|
+
end
|
@@ -0,0 +1,214 @@
|
|
1
|
+
require 'test_xml_extractor_helper'
|
2
|
+
|
3
|
+
# Tests Resource methods, via a JournalArticle
|
4
|
+
# Unless otherwise stated, tests ResearchOutput methods via a JournalArticle
|
5
|
+
class TestXMLExtractorResearchOutput < Minitest::Test
|
6
|
+
|
7
|
+
def xml_extractor_from_id(id)
|
8
|
+
client = Puree::REST::Client.new config
|
9
|
+
response = client.research_outputs.find id: id
|
10
|
+
Puree::XMLExtractor::JournalArticle.new response.to_s
|
11
|
+
end
|
12
|
+
|
13
|
+
def test_initialize
|
14
|
+
xml = '<foo/>'
|
15
|
+
xml_extractor = Puree::XMLExtractor::ResearchOutput.new xml
|
16
|
+
|
17
|
+
assert_instance_of Puree::XMLExtractor::ResearchOutput, xml_extractor
|
18
|
+
end
|
19
|
+
|
20
|
+
def test_core
|
21
|
+
# A theoretical framework for estimation of AUCs in complete and incomplete sampling designs
|
22
|
+
id = 'a7c104d0-e243-463e-a2a4-b4e07bcfde3f'
|
23
|
+
x = xml_extractor_from_id id
|
24
|
+
|
25
|
+
asserts_resource x
|
26
|
+
|
27
|
+
assert_instance_of String, x.category
|
28
|
+
refute_empty x.category
|
29
|
+
|
30
|
+
assert_instance_of String, x.description
|
31
|
+
refute_empty x.description
|
32
|
+
|
33
|
+
assert_instance_of String, x.doi
|
34
|
+
refute_empty x.doi
|
35
|
+
|
36
|
+
assert_instance_of Array, x.files
|
37
|
+
assert_instance_of Puree::Model::File, x.files.first
|
38
|
+
assert_equal true, x.files.first.data?
|
39
|
+
|
40
|
+
assert_instance_of String, x.language
|
41
|
+
refute_empty x.language
|
42
|
+
|
43
|
+
assert_instance_of Array, x.links
|
44
|
+
assert_instance_of String, x.links.first
|
45
|
+
refute_empty x.links.first
|
46
|
+
|
47
|
+
assert_instance_of String, x.open_access_permission
|
48
|
+
refute_empty x.open_access_permission
|
49
|
+
|
50
|
+
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?
|
53
|
+
|
54
|
+
assert_instance_of Puree::Model::OrganisationalUnitHeader, x.owner
|
55
|
+
assert_equal true, x.owner.data?
|
56
|
+
|
57
|
+
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?
|
60
|
+
|
61
|
+
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?
|
64
|
+
|
65
|
+
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?
|
68
|
+
|
69
|
+
# persons_other, see Dataset test
|
70
|
+
|
71
|
+
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?
|
74
|
+
|
75
|
+
assert_instance_of String, x.type
|
76
|
+
refute_empty x.type
|
77
|
+
|
78
|
+
assert_instance_of String, x.workflow
|
79
|
+
refute_empty x.workflow
|
80
|
+
end
|
81
|
+
|
82
|
+
def test_bibliographical_note
|
83
|
+
# The effect of humic substances on barite precipitation-dissolution behaviour in natural and synthetic lake waters
|
84
|
+
id = 'ce76dbda-8b22-422b-9bb6-8143820171b8'
|
85
|
+
x = xml_extractor_from_id id
|
86
|
+
|
87
|
+
assert_instance_of String, x.bibliographical_note
|
88
|
+
refute_empty x.bibliographical_note
|
89
|
+
end
|
90
|
+
|
91
|
+
def test_keywords
|
92
|
+
# The effect of humic substances on barite precipitation-dissolution behaviour in natural and synthetic lake waters
|
93
|
+
id = 'ce76dbda-8b22-422b-9bb6-8143820171b8'
|
94
|
+
x = xml_extractor_from_id id
|
95
|
+
|
96
|
+
assert_instance_of Array, x.keywords
|
97
|
+
assert_instance_of String, x.keywords.first
|
98
|
+
refute_empty x.keywords.first
|
99
|
+
end
|
100
|
+
|
101
|
+
def test_scopus_citations_count
|
102
|
+
# The effect of humic substances on barite precipitation-dissolution behaviour in natural and synthetic lake waters
|
103
|
+
id = 'ce76dbda-8b22-422b-9bb6-8143820171b8'
|
104
|
+
x = xml_extractor_from_id id
|
105
|
+
|
106
|
+
assert_instance_of Fixnum, x.scopus_citations_count
|
107
|
+
end
|
108
|
+
|
109
|
+
def test_scopus_metrics
|
110
|
+
# The effect of humic substances on barite precipitation-dissolution behaviour in natural and synthetic lake waters
|
111
|
+
id = 'ce76dbda-8b22-422b-9bb6-8143820171b8'
|
112
|
+
x = xml_extractor_from_id id
|
113
|
+
|
114
|
+
assert_instance_of Array, x.scopus_metrics
|
115
|
+
assert_instance_of Puree::Model::ResearchOutputScopusMetric, x.scopus_metrics.first
|
116
|
+
assert_equal true, x.scopus_metrics.first.data?
|
117
|
+
end
|
118
|
+
|
119
|
+
def test_subtitle
|
120
|
+
# Language testing and assessment (Part 1)
|
121
|
+
id = 'b5195a1f-15f0-4b94-9378-d6a19dc0c4a4'
|
122
|
+
x = xml_extractor_from_id id
|
123
|
+
|
124
|
+
assert_instance_of String, x.subtitle
|
125
|
+
refute_empty x.subtitle
|
126
|
+
end
|
127
|
+
|
128
|
+
def test_translated_titles
|
129
|
+
# Multimodalita e 'city branding'
|
130
|
+
id = '376173c0-fd7a-4d63-93d3-3f2e58e8dc01'
|
131
|
+
client = Puree::REST::Client.new config
|
132
|
+
response = client.research_outputs.find id: id
|
133
|
+
x = Puree::XMLExtractor::Thesis.new response.to_s
|
134
|
+
|
135
|
+
# assert_instance_of String, x.subtitle # also has sub
|
136
|
+
|
137
|
+
assert_instance_of String, x.translated_subtitle
|
138
|
+
refute_empty x.translated_subtitle
|
139
|
+
|
140
|
+
assert_instance_of String, x.translated_title
|
141
|
+
refute_empty x.translated_title
|
142
|
+
end
|
143
|
+
|
144
|
+
def test_absence
|
145
|
+
xml = '<foo/>'
|
146
|
+
x = Puree::XMLExtractor::JournalArticle.new xml
|
147
|
+
|
148
|
+
assert_nil x.bibliographical_note
|
149
|
+
|
150
|
+
assert_nil x.category
|
151
|
+
|
152
|
+
assert_nil x.description
|
153
|
+
|
154
|
+
assert_nil x.doi
|
155
|
+
|
156
|
+
assert_instance_of Array, x.files
|
157
|
+
assert_empty x.files
|
158
|
+
|
159
|
+
assert_instance_of Array, x.keywords
|
160
|
+
assert_empty x.keywords
|
161
|
+
|
162
|
+
assert_nil x.language
|
163
|
+
|
164
|
+
assert_instance_of Array, x.links
|
165
|
+
assert_empty x.links
|
166
|
+
|
167
|
+
assert_nil x.open_access_permission
|
168
|
+
|
169
|
+
assert_instance_of Array, x.organisational_units
|
170
|
+
assert_empty x.organisational_units
|
171
|
+
|
172
|
+
assert_nil x.owner
|
173
|
+
|
174
|
+
assert_instance_of Array, x.persons_internal
|
175
|
+
assert_empty x.persons_internal
|
176
|
+
|
177
|
+
assert_instance_of Array, x.persons_external
|
178
|
+
assert_empty x.persons_external
|
179
|
+
|
180
|
+
assert_instance_of Array, x.persons_other
|
181
|
+
assert_empty x.persons_other
|
182
|
+
|
183
|
+
assert_instance_of Array, x.publication_statuses
|
184
|
+
assert_empty x.publication_statuses
|
185
|
+
|
186
|
+
assert_instance_of Array, x.research_outputs
|
187
|
+
assert_empty x.research_outputs
|
188
|
+
|
189
|
+
assert_nil x.scopus_citations_count
|
190
|
+
|
191
|
+
assert_instance_of Array, x.scopus_metrics
|
192
|
+
assert_empty x.scopus_metrics
|
193
|
+
|
194
|
+
assert_nil x.subtitle
|
195
|
+
|
196
|
+
assert_nil x.type
|
197
|
+
|
198
|
+
assert_nil x.translated_subtitle
|
199
|
+
|
200
|
+
assert_nil x.translated_title
|
201
|
+
|
202
|
+
assert_nil x.workflow
|
203
|
+
end
|
204
|
+
|
205
|
+
def test_model
|
206
|
+
# A theoretical framework for estimation of AUCs in complete and incomplete sampling designs
|
207
|
+
id = 'a7c104d0-e243-463e-a2a4-b4e07bcfde3f'
|
208
|
+
client = Puree::REST::Client.new config
|
209
|
+
response = client.research_outputs.find id: id
|
210
|
+
x = Puree::XMLExtractor::ResearchOutput.new response.to_s
|
211
|
+
|
212
|
+
assert_instance_of Puree::Model::ResearchOutput, x.model
|
213
|
+
end
|
214
|
+
end
|