puree 1.9.1 → 2.0.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/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
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA1:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 68e9bc6b3031be78761029cf76f9a2d0ca19dc83
|
|
4
|
+
data.tar.gz: c25c6ba1167ee3b477c58bf1e1f1b0774fb9b410
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: e09b12ccea6749fe4904031d366c38eb677f4a4b653f7a5d8f1ac2139cdb56db97cacd183db9b4beb3cfb2c4a49a05a1bd27d337f5f3dd98301a44e9aa6617e9
|
|
7
|
+
data.tar.gz: 23b257d617b8f47802ec213b592b75b15fc9132058c5299761c30291e1739353e149db0e1bf5580beee55a51f5d3bad255e1376d48318480c565c6dd4932ec57
|
data/CHANGELOG.md
CHANGED
|
@@ -2,20 +2,13 @@
|
|
|
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
|
-
##
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
## 1.9.1 - 2018-04-18
|
|
9
|
-
### Fixed
|
|
10
|
-
- Handle missing created and modified.
|
|
11
|
-
|
|
12
|
-
## 1.9.0 - 2018-03-09
|
|
13
|
-
### Added
|
|
14
|
-
- Publication - doi.
|
|
5
|
+
## 2.0.0 - 2017-12-19
|
|
6
|
+
### Changed
|
|
7
|
+
- For Pure API 59.
|
|
15
8
|
|
|
16
|
-
## 1.8.0 - 2018-03-02
|
|
17
9
|
### Added
|
|
18
|
-
-
|
|
10
|
+
- Independent modules: REST, Extractor, XMLExtractor
|
|
11
|
+
- Testing against known live data.
|
|
19
12
|
|
|
20
13
|
## 1.7.0 - 2017-11-03
|
|
21
14
|
### Added
|
data/Gemfile
CHANGED
data/README.md
CHANGED
|
@@ -5,10 +5,7 @@ Metadata extraction from the Pure Research Information System.
|
|
|
5
5
|
## Status
|
|
6
6
|
|
|
7
7
|
[](https://badge.fury.io/rb/puree)
|
|
8
|
-
[](https://codeclimate.com/github/lulibrary/puree)
|
|
10
|
-
[](https://www.versioneye.com/user/projects/5899d253a86053003f389e1f)
|
|
11
|
-
[](https://gitpitch.com/lulibrary/puree)
|
|
8
|
+
[](https://codeclimate.com/github/lulibrary/puree/maintainability)
|
|
12
9
|
|
|
13
10
|
## Installation
|
|
14
11
|
|
|
@@ -24,130 +21,164 @@ Or install it yourself as:
|
|
|
24
21
|
|
|
25
22
|
$ gem install puree
|
|
26
23
|
|
|
27
|
-
|
|
28
|
-
## Usage
|
|
29
|
-
The following examples are for the Dataset resource type.
|
|
30
|
-
|
|
31
|
-
### Configuration
|
|
32
|
-
|
|
33
|
-
Create a hash for passing to an extractor.
|
|
34
|
-
|
|
35
|
-
```ruby
|
|
36
|
-
# Pure host with authentication.
|
|
37
|
-
config = {
|
|
38
|
-
url: ENV['PURE_URL'],
|
|
39
|
-
username: ENV['PURE_USERNAME'],
|
|
40
|
-
password: ENV['PURE_PASSWORD']
|
|
41
|
-
}
|
|
42
|
-
```
|
|
43
|
-
|
|
24
|
+
## Configuration
|
|
44
25
|
```ruby
|
|
45
|
-
#
|
|
26
|
+
# For Extractor and REST modules.
|
|
46
27
|
config = {
|
|
47
|
-
url:
|
|
28
|
+
url: 'https://YOUR_HOST/ws/api/59',
|
|
29
|
+
username: 'YOUR_USERNAME',
|
|
30
|
+
password: 'YOUR_PASSWORD',
|
|
31
|
+
api_key: 'YOUR_API_KEY'
|
|
48
32
|
}
|
|
49
33
|
```
|
|
50
34
|
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
Configure an extractor to retrieve data from a Pure host.
|
|
35
|
+
## Extractor module
|
|
36
|
+
Find a resource by identifier and get Ruby objects.
|
|
54
37
|
|
|
55
38
|
```ruby
|
|
56
|
-
|
|
39
|
+
# Configure an extractor
|
|
40
|
+
extractor = Puree::Extractor::Dataset.new config
|
|
57
41
|
```
|
|
58
42
|
|
|
59
|
-
Fetch the metadata for a resource with a particular identifier.
|
|
60
|
-
|
|
61
43
|
```ruby
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
#<Puree::Model::Dataset:
|
|
44
|
+
# Fetch the metadata for a resource with a particular identifier
|
|
45
|
+
dataset = extractor.find 'xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx'
|
|
46
|
+
#=> #<Puree::Model::Dataset:0x00c0ffee>
|
|
65
47
|
```
|
|
66
48
|
|
|
67
|
-
Access specific metadata e.g. an internal person's name.
|
|
68
|
-
|
|
69
49
|
```ruby
|
|
50
|
+
# Access specific metadata e.g. an internal person's name
|
|
70
51
|
dataset.persons_internal[0].name
|
|
71
|
-
|
|
72
|
-
#<Puree::Model::PersonName:0x9add67c @first="Foo", @last="Bar">
|
|
52
|
+
#=> #<Puree::Model::PersonName:0x00c0ffee @first="Foo", @last="Bar">
|
|
73
53
|
```
|
|
74
54
|
|
|
75
|
-
Select a formatting style for a person's name.
|
|
76
|
-
|
|
77
55
|
```ruby
|
|
56
|
+
# Select a formatting style for a person's name
|
|
78
57
|
dataset.persons_internal[0].name.last_initial
|
|
79
|
-
|
|
80
|
-
# "Bar, F."
|
|
58
|
+
#=> "Bar, F."
|
|
81
59
|
```
|
|
82
60
|
|
|
83
|
-
|
|
61
|
+
## XMLExtractor module
|
|
62
|
+
Get Ruby objects from Pure XML.
|
|
84
63
|
|
|
85
|
-
|
|
64
|
+
### Single resource
|
|
65
|
+
```ruby
|
|
66
|
+
xml = '<project> ... </project>'
|
|
67
|
+
```
|
|
86
68
|
|
|
87
69
|
```ruby
|
|
88
|
-
|
|
89
|
-
|
|
70
|
+
# Configure an XML extractor
|
|
71
|
+
xml_extractor = Puree::XMLExtractor::Project.new xml
|
|
90
72
|
```
|
|
91
73
|
|
|
92
|
-
|
|
74
|
+
```ruby
|
|
75
|
+
# Get a single piece of metadata
|
|
76
|
+
xml_extractor.title
|
|
77
|
+
#=> "An interesting project title"
|
|
78
|
+
```
|
|
93
79
|
|
|
94
80
|
```ruby
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
#<Puree::Model::
|
|
98
|
-
#<Puree::Model::Dataset:0xa5e8c24>
|
|
81
|
+
# Get all the metadata together
|
|
82
|
+
xml_extractor.model
|
|
83
|
+
#=> #<Puree::Model::Project:0x00c0ffee>
|
|
99
84
|
```
|
|
100
85
|
|
|
101
|
-
|
|
86
|
+
### Homogeneous resource collection
|
|
87
|
+
```ruby
|
|
88
|
+
xml = '<result>
|
|
89
|
+
<dataSet> ... </dataSet>
|
|
90
|
+
<dataSet> ... </dataSet>
|
|
91
|
+
...
|
|
92
|
+
</result>'
|
|
93
|
+
```
|
|
102
94
|
|
|
103
95
|
```ruby
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
#<Puree::Model::Dataset:
|
|
96
|
+
# Get an array of datasets
|
|
97
|
+
Puree::XMLExtractor::Collection.datasets xml
|
|
98
|
+
#=> [#<Puree::Model::Dataset:0x00c0ffee>, ...]
|
|
107
99
|
```
|
|
108
100
|
|
|
109
|
-
###
|
|
101
|
+
### Heterogeneous resource collection
|
|
102
|
+
```ruby
|
|
103
|
+
xml = '<result>
|
|
104
|
+
<contributionToJournal> ... </contributionToJournal>
|
|
105
|
+
<contributionToConference> ... </contributionToConference>
|
|
106
|
+
...
|
|
107
|
+
</result>'
|
|
108
|
+
```
|
|
110
109
|
|
|
111
|
-
|
|
110
|
+
```ruby
|
|
111
|
+
# Get a hash of research outputs
|
|
112
|
+
Puree::XMLExtractor::Collection.research_outputs xml
|
|
113
|
+
#=> {
|
|
114
|
+
# journal_articles: [#<Puree::Model::JournalArticle:0x00c0ffee>, ...],
|
|
115
|
+
# conference_papers: [#<Puree::Model::ConferencePaper:0x00c0ffee>, ...],
|
|
116
|
+
# theses: [#<Puree::Model::Thesis:0x00c0ffee>, ...],
|
|
117
|
+
# other: [#<Puree::Model::ResearchOutput:0x00c0ffee>, ...]
|
|
118
|
+
# }
|
|
119
|
+
```
|
|
112
120
|
|
|
113
|
-
|
|
121
|
+
## REST module
|
|
122
|
+
Query the Pure REST API.
|
|
114
123
|
|
|
115
|
-
|
|
124
|
+
### Client
|
|
125
|
+
```ruby
|
|
126
|
+
# Configure a client
|
|
127
|
+
client = Puree::REST::Client.new config
|
|
128
|
+
```
|
|
116
129
|
|
|
117
130
|
```ruby
|
|
118
|
-
|
|
131
|
+
# Find a person
|
|
132
|
+
client.persons.find id: 'xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx'
|
|
133
|
+
#=> #<HTTP::Response:0x00c0ffee>
|
|
119
134
|
```
|
|
120
135
|
|
|
121
|
-
|
|
136
|
+
```ruby
|
|
137
|
+
# Find a person, limit the metadata to ORCID and employee start date
|
|
138
|
+
client.persons.find id: 'xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx',
|
|
139
|
+
params: {fields: ['orcid', 'employeeStartDate']}
|
|
140
|
+
#=> #<HTTP::Response:0x00c0ffee>
|
|
141
|
+
```
|
|
122
142
|
|
|
123
143
|
```ruby
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
#<
|
|
144
|
+
# Find five people, response body as JSON
|
|
145
|
+
client.persons.all params: {size: 5}, accept: :json
|
|
146
|
+
#=> #<HTTP::Response:0x00c0ffee>
|
|
127
147
|
```
|
|
128
148
|
|
|
129
|
-
|
|
149
|
+
```ruby
|
|
150
|
+
# Find research outputs for a person
|
|
151
|
+
client.persons.research_outputs id: 'xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx'
|
|
152
|
+
#=> #<HTTP::Response:0x00c0ffee>
|
|
153
|
+
```
|
|
130
154
|
|
|
155
|
+
### Resource
|
|
131
156
|
```ruby
|
|
132
|
-
|
|
157
|
+
# Configure a resource
|
|
158
|
+
persons = Puree::REST::Person.new config
|
|
133
159
|
```
|
|
134
160
|
|
|
135
|
-
|
|
161
|
+
```ruby
|
|
162
|
+
# Find a person
|
|
163
|
+
persons.find id: 'xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx'
|
|
164
|
+
#=> #<HTTP::Response:0x00c0ffee>
|
|
165
|
+
```
|
|
136
166
|
|
|
137
|
-
|
|
167
|
+
## REST module with XMLExtractor module
|
|
168
|
+
Query the Pure REST API and get Ruby objects from Pure XML.
|
|
138
169
|
|
|
139
170
|
```ruby
|
|
140
|
-
|
|
171
|
+
# Configure a client
|
|
172
|
+
client = Puree::REST::Client.new config
|
|
141
173
|
```
|
|
142
174
|
|
|
143
|
-
|
|
175
|
+
```ruby
|
|
176
|
+
# Find projects for a person
|
|
177
|
+
response = client.persons.projects id: 'xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx'
|
|
178
|
+
```
|
|
144
179
|
|
|
145
180
|
```ruby
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
published_end: '2017-06-30'
|
|
150
|
-
# =>
|
|
151
|
-
#<Puree::Model::Publication:0x9d2c004>
|
|
152
|
-
#<Puree::Model::Publication:0xa285028>
|
|
181
|
+
# Extract metadata from XML
|
|
182
|
+
Puree::XMLExtractor::Collection.projects response.to_s
|
|
183
|
+
#=> [#<Puree::Model::Project:0x00c0ffee>, ...]
|
|
153
184
|
```
|
|
@@ -3,21 +3,13 @@ module Puree
|
|
|
3
3
|
|
|
4
4
|
# Conference paper extractor.
|
|
5
5
|
#
|
|
6
|
-
class ConferencePaper < Puree::Extractor::
|
|
6
|
+
class ConferencePaper < Puree::Extractor::Paper
|
|
7
7
|
|
|
8
|
-
# @
|
|
9
|
-
def
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
private
|
|
15
|
-
|
|
16
|
-
def combine_metadata
|
|
17
|
-
super
|
|
18
|
-
|
|
19
|
-
@model.event = @extractor.event
|
|
20
|
-
@model
|
|
8
|
+
# @param id [String]
|
|
9
|
+
def find(id)
|
|
10
|
+
find_and_extract id: id,
|
|
11
|
+
api_resource_type: :research_output,
|
|
12
|
+
xml_extractor_resource_type: :conference_paper
|
|
21
13
|
end
|
|
22
14
|
|
|
23
15
|
end
|
|
@@ -9,49 +9,13 @@ module Puree
|
|
|
9
9
|
# @option (see Puree::Extractor::Resource#initialize)
|
|
10
10
|
def initialize(config)
|
|
11
11
|
super
|
|
12
|
-
setup :dataset
|
|
13
12
|
end
|
|
14
13
|
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
@model.associated = @extractor.associated
|
|
21
|
-
@model.available = @extractor.available
|
|
22
|
-
@model.description = @extractor.description
|
|
23
|
-
@model.doi = @extractor.doi
|
|
24
|
-
@model.files = @extractor.files
|
|
25
|
-
@model.keywords = @extractor.keywords
|
|
26
|
-
@model.links = @extractor.links
|
|
27
|
-
@model.legal_conditions = @extractor.legal_conditions
|
|
28
|
-
@model.organisations = @extractor.organisations
|
|
29
|
-
@model.owner = @extractor.owner
|
|
30
|
-
@model.persons_internal = @extractor.persons_internal
|
|
31
|
-
@model.persons_external = @extractor.persons_external
|
|
32
|
-
@model.persons_other = @extractor.persons_other
|
|
33
|
-
@model.projects = @extractor.projects
|
|
34
|
-
@model.production = @extractor.production
|
|
35
|
-
@model.publications = @extractor.publications
|
|
36
|
-
@model.publisher = @extractor.publisher
|
|
37
|
-
@model.spatial_places = @extractor.spatial_places
|
|
38
|
-
@model.spatial_point = @extractor.spatial_point
|
|
39
|
-
@model.temporal = @extractor.temporal
|
|
40
|
-
@model.title = @extractor.title
|
|
41
|
-
@model.workflow_state = @extractor.workflow_state
|
|
42
|
-
@model
|
|
43
|
-
end
|
|
44
|
-
|
|
45
|
-
def configure_api(config)
|
|
46
|
-
@config = Puree::API::Configuration.new url: config[:url]
|
|
47
|
-
@config.basic_auth username: config[:username],
|
|
48
|
-
password: config[:password]
|
|
49
|
-
|
|
50
|
-
@request = Puree::API::PersonRequest.new url: @config.url
|
|
51
|
-
if @config.basic_auth?
|
|
52
|
-
@request.basic_auth username: @config.username,
|
|
53
|
-
password: @config.password
|
|
54
|
-
end
|
|
14
|
+
# @param id [String]
|
|
15
|
+
def find(id)
|
|
16
|
+
find_and_extract id: id,
|
|
17
|
+
api_resource_type: :dataset,
|
|
18
|
+
xml_extractor_resource_type: :dataset
|
|
55
19
|
end
|
|
56
20
|
|
|
57
21
|
end
|
|
@@ -7,15 +7,14 @@ module Puree
|
|
|
7
7
|
|
|
8
8
|
# @option (see Puree::Extractor::Resource#initialize)
|
|
9
9
|
def initialize(config)
|
|
10
|
-
set_model_type 'doctoral_thesis'
|
|
11
10
|
super
|
|
12
11
|
end
|
|
13
12
|
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
13
|
+
# @param id [String]
|
|
14
|
+
def find(id)
|
|
15
|
+
find_and_extract id: id,
|
|
16
|
+
api_resource_type: :research_output,
|
|
17
|
+
xml_extractor_resource_type: :doctoral_thesis
|
|
19
18
|
end
|
|
20
19
|
|
|
21
20
|
end
|
|
@@ -9,21 +9,13 @@ module Puree
|
|
|
9
9
|
# @option (see Puree::Extractor::Resource#initialize)
|
|
10
10
|
def initialize(config)
|
|
11
11
|
super
|
|
12
|
-
|
|
13
|
-
end
|
|
14
|
-
|
|
15
|
-
private
|
|
12
|
+
end
|
|
16
13
|
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
@model.description = @extractor.description
|
|
23
|
-
@model.location = @extractor.location
|
|
24
|
-
@model.title = @extractor.title
|
|
25
|
-
@model.type = @extractor.type
|
|
26
|
-
@model
|
|
14
|
+
# @param id [String]
|
|
15
|
+
def find(id)
|
|
16
|
+
find_and_extract id: id,
|
|
17
|
+
api_resource_type: :event,
|
|
18
|
+
xml_extractor_resource_type: :event
|
|
27
19
|
end
|
|
28
20
|
|
|
29
21
|
end
|
|
@@ -9,16 +9,13 @@ module Puree
|
|
|
9
9
|
# @option (see Puree::Extractor::Resource#initialize)
|
|
10
10
|
def initialize(config)
|
|
11
11
|
super
|
|
12
|
-
setup :external_organisation
|
|
13
12
|
end
|
|
14
13
|
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
@model.type = @extractor.type
|
|
21
|
-
@model
|
|
14
|
+
# @param id [String]
|
|
15
|
+
def find(id)
|
|
16
|
+
find_and_extract id: id,
|
|
17
|
+
api_resource_type: :external_organisation,
|
|
18
|
+
xml_extractor_resource_type: :external_organisation
|
|
22
19
|
end
|
|
23
20
|
|
|
24
21
|
end
|
|
@@ -1,3 +1,22 @@
|
|
|
1
|
+
require 'puree/extractor/resource'
|
|
2
|
+
require 'puree/extractor/dataset'
|
|
3
|
+
require 'puree/extractor/event'
|
|
4
|
+
require 'puree/extractor/external_organisation'
|
|
5
|
+
require 'puree/extractor/journal'
|
|
6
|
+
require 'puree/extractor/organisational_unit'
|
|
7
|
+
require 'puree/extractor/person'
|
|
8
|
+
require 'puree/extractor/project'
|
|
9
|
+
|
|
10
|
+
require 'puree/extractor/research_output'
|
|
11
|
+
require 'puree/extractor/thesis'
|
|
12
|
+
require 'puree/extractor/doctoral_thesis'
|
|
13
|
+
require 'puree/extractor/masters_thesis'
|
|
14
|
+
require 'puree/extractor/journal_article'
|
|
15
|
+
require 'puree/extractor/paper'
|
|
16
|
+
require 'puree/extractor/conference_paper'
|
|
17
|
+
|
|
18
|
+
require 'puree/extractor/publisher'
|
|
19
|
+
|
|
1
20
|
module Puree
|
|
2
21
|
|
|
3
22
|
# An Extractor manages HTTP requests to Pure and the subsequent
|
|
@@ -9,17 +9,13 @@ module Puree
|
|
|
9
9
|
# @option (see Puree::Extractor::Resource#initialize)
|
|
10
10
|
def initialize(config)
|
|
11
11
|
super
|
|
12
|
-
setup :journal
|
|
13
12
|
end
|
|
14
13
|
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
@model.publisher = @extractor.publisher
|
|
21
|
-
@model.title = @extractor.title
|
|
22
|
-
@model
|
|
14
|
+
# @param id [String]
|
|
15
|
+
def find(id)
|
|
16
|
+
find_and_extract id: id,
|
|
17
|
+
api_resource_type: :journal,
|
|
18
|
+
xml_extractor_resource_type: :journal
|
|
23
19
|
end
|
|
24
20
|
|
|
25
21
|
end
|
|
@@ -3,27 +3,18 @@ module Puree
|
|
|
3
3
|
|
|
4
4
|
# Journal article extractor.
|
|
5
5
|
#
|
|
6
|
-
class JournalArticle < Puree::Extractor::
|
|
6
|
+
class JournalArticle < Puree::Extractor::ResearchOutput
|
|
7
7
|
|
|
8
8
|
# @option (see Puree::Extractor::Resource#initialize)
|
|
9
9
|
def initialize(config)
|
|
10
|
-
set_model_type 'journal_article'
|
|
11
10
|
super
|
|
12
11
|
end
|
|
13
12
|
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
@model.article_number = @extractor.article_number
|
|
20
|
-
@model.issue = @extractor.issue
|
|
21
|
-
@model.journal = @extractor.journal
|
|
22
|
-
@model.pages = @extractor.pages
|
|
23
|
-
@model.page_range = @extractor.page_range
|
|
24
|
-
@model.peer_reviewed = @extractor.peer_reviewed
|
|
25
|
-
@model.volume = @extractor.volume
|
|
26
|
-
@model
|
|
13
|
+
# @param id [String]
|
|
14
|
+
def find(id)
|
|
15
|
+
find_and_extract id: id,
|
|
16
|
+
api_resource_type: :research_output,
|
|
17
|
+
xml_extractor_resource_type: :journal_article
|
|
27
18
|
end
|
|
28
19
|
|
|
29
20
|
end
|
|
@@ -7,15 +7,14 @@ module Puree
|
|
|
7
7
|
|
|
8
8
|
# @option (see Puree::Extractor::Resource#initialize)
|
|
9
9
|
def initialize(config)
|
|
10
|
-
set_model_type 'masters_thesis'
|
|
11
10
|
super
|
|
12
11
|
end
|
|
13
12
|
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
13
|
+
# @param id [String]
|
|
14
|
+
def find(id)
|
|
15
|
+
find_and_extract id: id,
|
|
16
|
+
api_resource_type: :research_output,
|
|
17
|
+
xml_extractor_resource_type: :masters_thesis
|
|
19
18
|
end
|
|
20
19
|
|
|
21
20
|
end
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
module Puree
|
|
2
|
+
|
|
3
|
+
module Extractor
|
|
4
|
+
|
|
5
|
+
# Organisational unit extractor.
|
|
6
|
+
#
|
|
7
|
+
class OrganisationalUnit < Puree::Extractor::Resource
|
|
8
|
+
|
|
9
|
+
# @option (see Puree::Extractor::Resource#initialize)
|
|
10
|
+
def initialize(config)
|
|
11
|
+
super
|
|
12
|
+
end
|
|
13
|
+
|
|
14
|
+
# @param id [String]
|
|
15
|
+
def find(id)
|
|
16
|
+
find_and_extract id: id,
|
|
17
|
+
api_resource_type: :organisational_unit,
|
|
18
|
+
xml_extractor_resource_type: :organisational_unit
|
|
19
|
+
end
|
|
20
|
+
|
|
21
|
+
end
|
|
22
|
+
|
|
23
|
+
end
|
|
24
|
+
|
|
25
|
+
end
|
|
@@ -3,18 +3,13 @@ module Puree
|
|
|
3
3
|
|
|
4
4
|
# Paper extractor.
|
|
5
5
|
#
|
|
6
|
-
class Paper < Puree::Extractor::
|
|
6
|
+
class Paper < Puree::Extractor::ResearchOutput
|
|
7
7
|
|
|
8
|
-
# @
|
|
9
|
-
def
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
private
|
|
15
|
-
|
|
16
|
-
def combine_metadata
|
|
17
|
-
super
|
|
8
|
+
# @param id [String]
|
|
9
|
+
def find(id)
|
|
10
|
+
find_and_extract id: id,
|
|
11
|
+
api_resource_type: :research_output,
|
|
12
|
+
xml_extractor_resource_type: :paper
|
|
18
13
|
end
|
|
19
14
|
|
|
20
15
|
end
|
|
@@ -6,60 +6,11 @@ module Puree
|
|
|
6
6
|
#
|
|
7
7
|
class Person < Puree::Extractor::Resource
|
|
8
8
|
|
|
9
|
-
# @option (see Puree::Extractor::Resource#initialize)
|
|
10
|
-
def initialize(config)
|
|
11
|
-
super
|
|
12
|
-
setup :person
|
|
13
|
-
end
|
|
14
|
-
|
|
15
|
-
# Find a person by identifier.
|
|
16
|
-
#
|
|
17
|
-
# @param uuid [String]
|
|
18
9
|
# @param id [String]
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
@response = @request.get uuid: uuid,
|
|
24
|
-
id: id,
|
|
25
|
-
employee_id: employee_id,
|
|
26
|
-
latest_api: @latest_api,
|
|
27
|
-
resource_type: @resource_type
|
|
28
|
-
set_content @response.body
|
|
29
|
-
end
|
|
30
|
-
|
|
31
|
-
private
|
|
32
|
-
|
|
33
|
-
def combine_metadata
|
|
34
|
-
super
|
|
35
|
-
@model.affiliations = @extractor.affiliations
|
|
36
|
-
@model.email_addresses = @extractor.email_addresses
|
|
37
|
-
@model.employee_id = @extractor.employee_id
|
|
38
|
-
@model.hesa_id = @extractor.hesa_id
|
|
39
|
-
@model.image_urls = @extractor.image_urls
|
|
40
|
-
@model.keywords = @extractor.keywords
|
|
41
|
-
@model.name = @extractor.name
|
|
42
|
-
@model.orcid = @extractor.orcid
|
|
43
|
-
@model.scopus_id = @extractor.scopus_id
|
|
44
|
-
@model
|
|
45
|
-
end
|
|
46
|
-
|
|
47
|
-
# Configure a Pure host for API access.
|
|
48
|
-
#
|
|
49
|
-
# @param config [Hash]
|
|
50
|
-
# @option config [String] :url The URL of the Pure host.
|
|
51
|
-
# @option config [String] :username The username of the Pure host account.
|
|
52
|
-
# @option config [String] :password The password of the Pure host account.
|
|
53
|
-
def configure_api(config)
|
|
54
|
-
@config = Puree::API::Configuration.new url: config[:url]
|
|
55
|
-
@config.basic_auth username: config[:username],
|
|
56
|
-
password: config[:password]
|
|
57
|
-
|
|
58
|
-
@request = Puree::API::PersonRequest.new url: @config.url
|
|
59
|
-
if @config.basic_auth?
|
|
60
|
-
@request.basic_auth username: @config.username,
|
|
61
|
-
password: @config.password
|
|
62
|
-
end
|
|
10
|
+
def find(id)
|
|
11
|
+
find_and_extract id: id,
|
|
12
|
+
api_resource_type: :person,
|
|
13
|
+
xml_extractor_resource_type: :person
|
|
63
14
|
end
|
|
64
15
|
|
|
65
16
|
end
|