puree 1.9.1 → 2.0.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (176) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +5 -12
  3. data/Gemfile +1 -1
  4. data/README.md +106 -75
  5. data/lib/puree/extractor/conference_paper.rb +6 -14
  6. data/lib/puree/extractor/dataset.rb +5 -41
  7. data/lib/puree/extractor/doctoral_thesis.rb +5 -6
  8. data/lib/puree/extractor/event.rb +6 -14
  9. data/lib/puree/extractor/external_organisation.rb +5 -8
  10. data/lib/puree/extractor/extractor.rb +19 -0
  11. data/lib/puree/extractor/journal.rb +5 -9
  12. data/lib/puree/extractor/journal_article.rb +6 -15
  13. data/lib/puree/extractor/masters_thesis.rb +5 -6
  14. data/lib/puree/extractor/organisational_unit.rb +25 -0
  15. data/lib/puree/extractor/paper.rb +6 -11
  16. data/lib/puree/extractor/person.rb +4 -53
  17. data/lib/puree/extractor/project.rb +5 -28
  18. data/lib/puree/extractor/publisher.rb +5 -12
  19. data/lib/puree/extractor/research_output.rb +20 -0
  20. data/lib/puree/extractor/resource.rb +22 -58
  21. data/lib/puree/extractor/thesis.rb +6 -17
  22. data/lib/puree/model/conference_paper.rb +1 -1
  23. data/lib/puree/model/dataset.rb +8 -25
  24. data/lib/puree/model/event.rb +0 -9
  25. data/lib/puree/model/external_organisation.rb +1 -1
  26. data/lib/puree/model/external_organisation_header.rb +2 -19
  27. data/lib/puree/model/identifier.rb +26 -0
  28. data/lib/puree/model/journal.rb +1 -1
  29. data/lib/puree/model/journal_article.rb +1 -4
  30. data/lib/puree/model/model.rb +43 -0
  31. data/lib/puree/model/{organisation_header.rb → organisation_header_base.rb} +2 -2
  32. data/lib/puree/model/{organisation.rb → organisational_unit.rb} +3 -6
  33. data/lib/puree/model/organisational_unit_header.rb +9 -0
  34. data/lib/puree/model/paper.rb +10 -1
  35. data/lib/puree/model/person.rb +3 -9
  36. data/lib/puree/model/project.rb +7 -14
  37. data/lib/puree/model/publication_status.rb +1 -1
  38. data/lib/puree/model/publisher.rb +3 -0
  39. data/lib/puree/model/publisher_header.rb +9 -0
  40. data/lib/puree/model/{publication.rb → research_output.rb} +18 -20
  41. data/lib/puree/model/research_output_scopus_metric.rb +26 -0
  42. data/lib/puree/model/resource.rb +19 -11
  43. data/lib/puree/model/thesis.rb +6 -3
  44. data/lib/puree/rest/activity.rb +24 -0
  45. data/lib/puree/rest/application.rb +24 -0
  46. data/lib/puree/rest/base.rb +131 -0
  47. data/lib/puree/rest/classification_scheme.rb +24 -0
  48. data/lib/puree/rest/client.rb +105 -0
  49. data/lib/puree/rest/curricula_vitae.rb +24 -0
  50. data/lib/puree/rest/dataset.rb +24 -0
  51. data/lib/puree/rest/equipment.rb +24 -0
  52. data/lib/puree/rest/event.rb +24 -0
  53. data/lib/puree/rest/external_organisation.rb +24 -0
  54. data/lib/puree/rest/external_person.rb +24 -0
  55. data/lib/puree/rest/impact.rb +24 -0
  56. data/lib/puree/rest/journal.rb +24 -0
  57. data/lib/puree/rest/mixins/active_mixin.rb +14 -0
  58. data/lib/puree/rest/mixins/activity_mixin.rb +14 -0
  59. data/lib/puree/rest/mixins/application_mixin.rb +15 -0
  60. data/lib/puree/rest/mixins/award_mixin.rb +15 -0
  61. data/lib/puree/rest/mixins/dataset_mixin.rb +15 -0
  62. data/lib/puree/rest/mixins/former_mixin.rb +14 -0
  63. data/lib/puree/rest/mixins/impact_mixin.rb +15 -0
  64. data/lib/puree/rest/mixins/person_mixin.rb +15 -0
  65. data/lib/puree/rest/mixins/press_media_mixin.rb +15 -0
  66. data/lib/puree/rest/mixins/prize_mixin.rb +15 -0
  67. data/lib/puree/rest/mixins/project_mixin.rb +15 -0
  68. data/lib/puree/rest/mixins/research_output_mixin.rb +15 -0
  69. data/lib/puree/rest/mixins/student_thesis_mixin.rb +15 -0
  70. data/lib/puree/rest/organisational_unit.rb +51 -0
  71. data/lib/puree/rest/person.rb +58 -0
  72. data/lib/puree/rest/press_media.rb +24 -0
  73. data/lib/puree/rest/prize.rb +24 -0
  74. data/lib/puree/rest/project.rb +27 -0
  75. data/lib/puree/rest/publisher.rb +31 -0
  76. data/lib/puree/rest/research_output.rb +24 -0
  77. data/lib/puree/rest/rest.rb +30 -0
  78. data/lib/puree/util/util.rb +3 -0
  79. data/lib/puree/version.rb +1 -1
  80. data/lib/puree/xml_extractor/base.rb +6 -6
  81. data/lib/puree/xml_extractor/collection.rb +112 -19
  82. data/lib/puree/xml_extractor/conference_paper.rb +9 -2
  83. data/lib/puree/xml_extractor/dataset.rb +56 -166
  84. data/lib/puree/xml_extractor/doctoral_thesis.rb +1 -1
  85. data/lib/puree/xml_extractor/event.rb +16 -19
  86. data/lib/puree/xml_extractor/external_organisation.rb +14 -5
  87. data/lib/puree/xml_extractor/journal.rb +18 -8
  88. data/lib/puree/xml_extractor/journal_article.rb +24 -11
  89. data/lib/puree/xml_extractor/masters_thesis.rb +1 -1
  90. data/lib/puree/xml_extractor/mixins/abstract_mixin.rb +17 -0
  91. data/lib/puree/xml_extractor/mixins/description_mixin.rb +17 -0
  92. data/lib/puree/xml_extractor/mixins/{external_organisations_mixin.rb → external_organisation_mixin.rb} +2 -2
  93. data/lib/puree/xml_extractor/mixins/identifier_mixin.rb +25 -0
  94. data/lib/puree/xml_extractor/mixins/keyword_mixin.rb +21 -0
  95. data/lib/puree/xml_extractor/mixins/organisational_unit_mixin.rb +18 -0
  96. data/lib/puree/xml_extractor/mixins/owner_mixin.rb +18 -0
  97. data/lib/puree/xml_extractor/mixins/peer_reviewed_mixin.rb +1 -1
  98. data/lib/puree/xml_extractor/mixins/person_mixin.rb +45 -0
  99. data/lib/puree/xml_extractor/mixins/publisher_mixin.rb +22 -0
  100. data/lib/puree/xml_extractor/mixins/{associated_mixin.rb → research_output_mixin.rb} +7 -7
  101. data/lib/puree/xml_extractor/mixins/title_mixin.rb +17 -0
  102. data/lib/puree/xml_extractor/mixins/type_mixin.rb +17 -0
  103. data/lib/puree/xml_extractor/mixins/workflow_mixin.rb +17 -0
  104. data/lib/puree/xml_extractor/organisational_unit.rb +82 -0
  105. data/lib/puree/xml_extractor/paper.rb +17 -3
  106. data/lib/puree/xml_extractor/person.rb +30 -35
  107. data/lib/puree/xml_extractor/project.rb +39 -75
  108. data/lib/puree/xml_extractor/publisher.rb +15 -6
  109. data/lib/puree/xml_extractor/research_output.rb +189 -0
  110. data/lib/puree/xml_extractor/resource.rb +28 -36
  111. data/lib/puree/xml_extractor/shared.rb +12 -9
  112. data/lib/puree/xml_extractor/thesis.rb +29 -15
  113. data/lib/puree/xml_extractor/xml_extractor.rb +43 -0
  114. data/lib/puree.rb +5 -114
  115. data/puree.gemspec +1 -1
  116. data/test/extractor/resource_test.rb +103 -0
  117. data/test/rest/base_test.rb +45 -0
  118. data/test/rest/common_test.rb +44 -0
  119. data/test/test_extractor_helper.rb +1 -0
  120. data/test/test_helper.rb +17 -0
  121. data/test/test_rest_helper.rb +82 -0
  122. data/test/test_xml_extractor_helper.rb +17 -0
  123. data/test/xml_extractor/xml_extractor_collection_test.rb +120 -0
  124. data/test/xml_extractor/xml_extractor_conference_paper_test.rb +69 -0
  125. data/test/xml_extractor/xml_extractor_dataset_test.rb +156 -0
  126. data/test/xml_extractor/xml_extractor_event_test.rb +58 -0
  127. data/test/xml_extractor/xml_extractor_external_organisation_test.rb +49 -0
  128. data/test/xml_extractor/xml_extractor_journal_article_test.rb +66 -0
  129. data/test/xml_extractor/xml_extractor_journal_test.rb +53 -0
  130. data/test/xml_extractor/xml_extractor_organisation_test.rb +80 -0
  131. data/test/xml_extractor/xml_extractor_person_test.rb +88 -0
  132. data/test/xml_extractor/xml_extractor_project_test.rb +136 -0
  133. data/test/xml_extractor/xml_extractor_publisher_test.rb +49 -0
  134. data/test/xml_extractor/xml_extractor_research_output_test.rb +214 -0
  135. data/test/xml_extractor/xml_extractor_thesis_test.rb +80 -0
  136. metadata +105 -68
  137. data/lib/puree/api/api.rb +0 -9
  138. data/lib/puree/api/authentication.rb +0 -33
  139. data/lib/puree/api/configuration.rb +0 -43
  140. data/lib/puree/api/map.rb +0 -80
  141. data/lib/puree/api/person_request.rb +0 -64
  142. data/lib/puree/api/request.rb +0 -119
  143. data/lib/puree/extractor/collection.rb +0 -131
  144. data/lib/puree/extractor/download.rb +0 -71
  145. data/lib/puree/extractor/organisation.rb +0 -34
  146. data/lib/puree/extractor/paper_base.rb +0 -28
  147. data/lib/puree/extractor/publication.rb +0 -53
  148. data/lib/puree/extractor/server.rb +0 -56
  149. data/lib/puree/model/download_header.rb +0 -21
  150. data/lib/puree/model/paper_base.rb +0 -19
  151. data/lib/puree/model/server.rb +0 -13
  152. data/lib/puree/query/funding.rb +0 -54
  153. data/lib/puree/query/person.rb +0 -121
  154. data/lib/puree/query/query.rb +0 -6
  155. data/lib/puree/xml_extractor/download.rb +0 -42
  156. data/lib/puree/xml_extractor/mixins/workflow_state_mixin.rb +0 -18
  157. data/lib/puree/xml_extractor/organisation.rb +0 -75
  158. data/lib/puree/xml_extractor/paper_base.rb +0 -17
  159. data/lib/puree/xml_extractor/publication.rb +0 -257
  160. data/lib/puree/xml_extractor/server.rb +0 -32
  161. data/spec/download_http_spec.rb +0 -31
  162. data/spec/open_api_dataset_http_spec.rb +0 -15
  163. data/spec/query/funding_http_spec.rb +0 -29
  164. data/spec/query/person_http_spec.rb +0 -52
  165. data/spec/resource/collection_all_http_spec.rb +0 -77
  166. data/spec/resource/collection_http_spec.rb +0 -65
  167. data/spec/resource/dataset_http_spec.rb +0 -112
  168. data/spec/resource/event_http_spec.rb +0 -52
  169. data/spec/resource/journal_http_spec.rb +0 -36
  170. data/spec/resource/organisation_http_spec.rb +0 -52
  171. data/spec/resource/person_http_spec.rb +0 -60
  172. data/spec/resource/project_http_spec.rb +0 -89
  173. data/spec/resource/publication_http_spec.rb +0 -126
  174. data/spec/resource/publisher_http_spec.rb +0 -26
  175. data/spec/server_http_spec.rb +0 -26
  176. data/spec/spec_helper.rb +0 -159
@@ -0,0 +1,80 @@
1
+ require 'test_xml_extractor_helper'
2
+
3
+ class TestXMLExtractorThesis < 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::Thesis.new response.to_s
9
+ end
10
+
11
+ def test_initialize
12
+ xml = '<foo/>'
13
+ xml_extractor = Puree::XMLExtractor::Thesis.new xml
14
+
15
+ assert_instance_of Puree::XMLExtractor::Thesis, xml_extractor
16
+ end
17
+
18
+ def test_core
19
+ # Multimodalita e 'city branding'
20
+ id = '376173c0-fd7a-4d63-93d3-3f2e58e8dc01'
21
+ x = xml_extractor_from_id id
22
+
23
+ asserts_resource x
24
+
25
+ assert_instance_of Time, x.award_date
26
+
27
+ assert_instance_of Puree::Model::ExternalOrganisationHeader, x.awarding_institution
28
+ assert_equal true, x.awarding_institution.data?
29
+
30
+ assert_instance_of Puree::Model::PublisherHeader, x.publisher
31
+ assert_equal true, x.publisher.data?
32
+
33
+ assert_instance_of String, x.type
34
+ refute_empty x.type
35
+ end
36
+
37
+ def test_sponsors
38
+ # A comparative study of the fundamental juridical nature, classification and private law enforcement of jurisdiction and choice of law agreements in the English Common Law of Conflict of Laws, the European Union Private International Law Regime and the Hague Convention on Choice of Court Agreements
39
+ id = 'c5b50358-4c42-48fb-ae53-8f360edcb51d'
40
+ x = xml_extractor_from_id id
41
+
42
+ assert_instance_of Array, x.sponsors
43
+ assert_instance_of Puree::Model::ExternalOrganisationHeader, x.sponsors.first
44
+ assert_equal true, x.sponsors.first.data?
45
+ end
46
+
47
+ def test_qualification
48
+ # A comparative study of the fundamental juridical nature, classification and private law enforcement of jurisdiction and choice of law agreements in the English Common Law of Conflict of Laws, the European Union Private International Law Regime and the Hague Convention on Choice of Court Agreements
49
+ id = 'c5b50358-4c42-48fb-ae53-8f360edcb51d'
50
+ x = xml_extractor_from_id id
51
+
52
+ assert_instance_of String, x.qualification
53
+ refute_empty x.qualification
54
+ end
55
+
56
+ def test_absence
57
+ xml = '<foo/>'
58
+ x = Puree::XMLExtractor::Thesis.new xml
59
+
60
+ assert_nil x.awarding_institution
61
+
62
+ assert_nil x.publisher
63
+
64
+ assert_instance_of Array, x.sponsors
65
+ assert_empty x.sponsors
66
+
67
+ assert_nil x.qualification
68
+
69
+ assert_nil x.type
70
+ end
71
+
72
+ def test_model
73
+ # Multimodalita e 'city branding'
74
+ id = '376173c0-fd7a-4d63-93d3-3f2e58e8dc01'
75
+ x = xml_extractor_from_id id
76
+
77
+ assert_instance_of Puree::Model::Thesis, x.model
78
+ end
79
+
80
+ end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: puree
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.9.1
4
+ version: 2.0.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Adrian Albin-Clark
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2018-04-18 00:00:00.000000000 Z
11
+ date: 2017-12-19 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: http
@@ -39,19 +39,19 @@ dependencies:
39
39
  - !ruby/object:Gem::Version
40
40
  version: '1.6'
41
41
  - !ruby/object:Gem::Dependency
42
- name: rspec
42
+ name: minitest-reporters
43
43
  requirement: !ruby/object:Gem::Requirement
44
44
  requirements:
45
- - - ">="
45
+ - - "~>"
46
46
  - !ruby/object:Gem::Version
47
- version: '0'
47
+ version: '1.1'
48
48
  type: :development
49
49
  prerelease: false
50
50
  version_requirements: !ruby/object:Gem::Requirement
51
51
  requirements:
52
- - - ">="
52
+ - - "~>"
53
53
  - !ruby/object:Gem::Version
54
- version: '0'
54
+ version: '1.1'
55
55
  description:
56
56
  email: a.albin-clark@lancaster.ac.uk
57
57
  executables: []
@@ -66,39 +66,28 @@ files:
66
66
  - README.md
67
67
  - Rakefile
68
68
  - lib/puree.rb
69
- - lib/puree/api/api.rb
70
- - lib/puree/api/authentication.rb
71
- - lib/puree/api/configuration.rb
72
- - lib/puree/api/map.rb
73
- - lib/puree/api/person_request.rb
74
- - lib/puree/api/request.rb
75
- - lib/puree/extractor/collection.rb
76
69
  - lib/puree/extractor/conference_paper.rb
77
70
  - lib/puree/extractor/dataset.rb
78
71
  - lib/puree/extractor/doctoral_thesis.rb
79
- - lib/puree/extractor/download.rb
80
72
  - lib/puree/extractor/event.rb
81
73
  - lib/puree/extractor/external_organisation.rb
82
74
  - lib/puree/extractor/extractor.rb
83
75
  - lib/puree/extractor/journal.rb
84
76
  - lib/puree/extractor/journal_article.rb
85
77
  - lib/puree/extractor/masters_thesis.rb
86
- - lib/puree/extractor/organisation.rb
78
+ - lib/puree/extractor/organisational_unit.rb
87
79
  - lib/puree/extractor/paper.rb
88
- - lib/puree/extractor/paper_base.rb
89
80
  - lib/puree/extractor/person.rb
90
81
  - lib/puree/extractor/project.rb
91
- - lib/puree/extractor/publication.rb
92
82
  - lib/puree/extractor/publisher.rb
83
+ - lib/puree/extractor/research_output.rb
93
84
  - lib/puree/extractor/resource.rb
94
- - lib/puree/extractor/server.rb
95
85
  - lib/puree/extractor/thesis.rb
96
86
  - lib/puree/model/address.rb
97
87
  - lib/puree/model/conference_paper.rb
98
88
  - lib/puree/model/copyright_license.rb
99
89
  - lib/puree/model/dataset.rb
100
90
  - lib/puree/model/doctoral_thesis.rb
101
- - lib/puree/model/download_header.rb
102
91
  - lib/puree/model/endeavour_person.rb
103
92
  - lib/puree/model/event.rb
104
93
  - lib/puree/model/event_header.rb
@@ -106,6 +95,7 @@ files:
106
95
  - lib/puree/model/external_organisation_header.rb
107
96
  - lib/puree/model/file.rb
108
97
  - lib/puree/model/helper/validation.rb
98
+ - lib/puree/model/identifier.rb
109
99
  - lib/puree/model/journal.rb
110
100
  - lib/puree/model/journal_article.rb
111
101
  - lib/puree/model/journal_header.rb
@@ -113,26 +103,58 @@ files:
113
103
  - lib/puree/model/link.rb
114
104
  - lib/puree/model/masters_thesis.rb
115
105
  - lib/puree/model/model.rb
116
- - lib/puree/model/organisation.rb
117
- - lib/puree/model/organisation_header.rb
106
+ - lib/puree/model/organisation_header_base.rb
107
+ - lib/puree/model/organisational_unit.rb
108
+ - lib/puree/model/organisational_unit_header.rb
118
109
  - lib/puree/model/paper.rb
119
- - lib/puree/model/paper_base.rb
120
110
  - lib/puree/model/person.rb
121
111
  - lib/puree/model/person_name.rb
122
112
  - lib/puree/model/project.rb
123
- - lib/puree/model/publication.rb
124
113
  - lib/puree/model/publication_status.rb
125
114
  - lib/puree/model/publisher.rb
115
+ - lib/puree/model/publisher_header.rb
126
116
  - lib/puree/model/related_content_header.rb
117
+ - lib/puree/model/research_output.rb
118
+ - lib/puree/model/research_output_scopus_metric.rb
127
119
  - lib/puree/model/resource.rb
128
- - lib/puree/model/server.rb
129
120
  - lib/puree/model/spatial_point.rb
130
121
  - lib/puree/model/structure.rb
131
122
  - lib/puree/model/temporal_range.rb
132
123
  - lib/puree/model/thesis.rb
133
- - lib/puree/query/funding.rb
134
- - lib/puree/query/person.rb
135
- - lib/puree/query/query.rb
124
+ - lib/puree/rest/activity.rb
125
+ - lib/puree/rest/application.rb
126
+ - lib/puree/rest/base.rb
127
+ - lib/puree/rest/classification_scheme.rb
128
+ - lib/puree/rest/client.rb
129
+ - lib/puree/rest/curricula_vitae.rb
130
+ - lib/puree/rest/dataset.rb
131
+ - lib/puree/rest/equipment.rb
132
+ - lib/puree/rest/event.rb
133
+ - lib/puree/rest/external_organisation.rb
134
+ - lib/puree/rest/external_person.rb
135
+ - lib/puree/rest/impact.rb
136
+ - lib/puree/rest/journal.rb
137
+ - lib/puree/rest/mixins/active_mixin.rb
138
+ - lib/puree/rest/mixins/activity_mixin.rb
139
+ - lib/puree/rest/mixins/application_mixin.rb
140
+ - lib/puree/rest/mixins/award_mixin.rb
141
+ - lib/puree/rest/mixins/dataset_mixin.rb
142
+ - lib/puree/rest/mixins/former_mixin.rb
143
+ - lib/puree/rest/mixins/impact_mixin.rb
144
+ - lib/puree/rest/mixins/person_mixin.rb
145
+ - lib/puree/rest/mixins/press_media_mixin.rb
146
+ - lib/puree/rest/mixins/prize_mixin.rb
147
+ - lib/puree/rest/mixins/project_mixin.rb
148
+ - lib/puree/rest/mixins/research_output_mixin.rb
149
+ - lib/puree/rest/mixins/student_thesis_mixin.rb
150
+ - lib/puree/rest/organisational_unit.rb
151
+ - lib/puree/rest/person.rb
152
+ - lib/puree/rest/press_media.rb
153
+ - lib/puree/rest/prize.rb
154
+ - lib/puree/rest/project.rb
155
+ - lib/puree/rest/publisher.rb
156
+ - lib/puree/rest/research_output.rb
157
+ - lib/puree/rest/rest.rb
136
158
  - lib/puree/util/date.rb
137
159
  - lib/puree/util/string.rb
138
160
  - lib/puree/util/util.rb
@@ -142,49 +164,60 @@ files:
142
164
  - lib/puree/xml_extractor/conference_paper.rb
143
165
  - lib/puree/xml_extractor/dataset.rb
144
166
  - lib/puree/xml_extractor/doctoral_thesis.rb
145
- - lib/puree/xml_extractor/download.rb
146
167
  - lib/puree/xml_extractor/event.rb
147
168
  - lib/puree/xml_extractor/external_organisation.rb
148
169
  - lib/puree/xml_extractor/journal.rb
149
170
  - lib/puree/xml_extractor/journal_article.rb
150
171
  - lib/puree/xml_extractor/masters_thesis.rb
151
- - lib/puree/xml_extractor/mixins/associated_mixin.rb
172
+ - lib/puree/xml_extractor/mixins/abstract_mixin.rb
173
+ - lib/puree/xml_extractor/mixins/description_mixin.rb
152
174
  - lib/puree/xml_extractor/mixins/doi_mixin.rb
153
175
  - lib/puree/xml_extractor/mixins/event_mixin.rb
154
- - lib/puree/xml_extractor/mixins/external_organisations_mixin.rb
176
+ - lib/puree/xml_extractor/mixins/external_organisation_mixin.rb
177
+ - lib/puree/xml_extractor/mixins/identifier_mixin.rb
178
+ - lib/puree/xml_extractor/mixins/keyword_mixin.rb
179
+ - lib/puree/xml_extractor/mixins/organisational_unit_mixin.rb
180
+ - lib/puree/xml_extractor/mixins/owner_mixin.rb
155
181
  - lib/puree/xml_extractor/mixins/page_range_mixin.rb
156
182
  - lib/puree/xml_extractor/mixins/pages_mixin.rb
157
183
  - lib/puree/xml_extractor/mixins/peer_reviewed_mixin.rb
158
- - lib/puree/xml_extractor/mixins/workflow_state_mixin.rb
159
- - lib/puree/xml_extractor/organisation.rb
184
+ - lib/puree/xml_extractor/mixins/person_mixin.rb
185
+ - lib/puree/xml_extractor/mixins/publisher_mixin.rb
186
+ - lib/puree/xml_extractor/mixins/research_output_mixin.rb
187
+ - lib/puree/xml_extractor/mixins/title_mixin.rb
188
+ - lib/puree/xml_extractor/mixins/type_mixin.rb
189
+ - lib/puree/xml_extractor/mixins/workflow_mixin.rb
190
+ - lib/puree/xml_extractor/organisational_unit.rb
160
191
  - lib/puree/xml_extractor/paper.rb
161
- - lib/puree/xml_extractor/paper_base.rb
162
192
  - lib/puree/xml_extractor/person.rb
163
193
  - lib/puree/xml_extractor/project.rb
164
- - lib/puree/xml_extractor/publication.rb
165
194
  - lib/puree/xml_extractor/publisher.rb
195
+ - lib/puree/xml_extractor/research_output.rb
166
196
  - lib/puree/xml_extractor/resource.rb
167
- - lib/puree/xml_extractor/server.rb
168
197
  - lib/puree/xml_extractor/shared.rb
169
198
  - lib/puree/xml_extractor/thesis.rb
170
199
  - lib/puree/xml_extractor/xml_extractor.rb
171
200
  - puree.gemspec
172
- - spec/download_http_spec.rb
173
- - spec/open_api_dataset_http_spec.rb
174
- - spec/query/funding_http_spec.rb
175
- - spec/query/person_http_spec.rb
176
- - spec/resource/collection_all_http_spec.rb
177
- - spec/resource/collection_http_spec.rb
178
- - spec/resource/dataset_http_spec.rb
179
- - spec/resource/event_http_spec.rb
180
- - spec/resource/journal_http_spec.rb
181
- - spec/resource/organisation_http_spec.rb
182
- - spec/resource/person_http_spec.rb
183
- - spec/resource/project_http_spec.rb
184
- - spec/resource/publication_http_spec.rb
185
- - spec/resource/publisher_http_spec.rb
186
- - spec/server_http_spec.rb
187
- - spec/spec_helper.rb
201
+ - test/extractor/resource_test.rb
202
+ - test/rest/base_test.rb
203
+ - test/rest/common_test.rb
204
+ - test/test_extractor_helper.rb
205
+ - test/test_helper.rb
206
+ - test/test_rest_helper.rb
207
+ - test/test_xml_extractor_helper.rb
208
+ - test/xml_extractor/xml_extractor_collection_test.rb
209
+ - test/xml_extractor/xml_extractor_conference_paper_test.rb
210
+ - test/xml_extractor/xml_extractor_dataset_test.rb
211
+ - test/xml_extractor/xml_extractor_event_test.rb
212
+ - test/xml_extractor/xml_extractor_external_organisation_test.rb
213
+ - test/xml_extractor/xml_extractor_journal_article_test.rb
214
+ - test/xml_extractor/xml_extractor_journal_test.rb
215
+ - test/xml_extractor/xml_extractor_organisation_test.rb
216
+ - test/xml_extractor/xml_extractor_person_test.rb
217
+ - test/xml_extractor/xml_extractor_project_test.rb
218
+ - test/xml_extractor/xml_extractor_publisher_test.rb
219
+ - test/xml_extractor/xml_extractor_research_output_test.rb
220
+ - test/xml_extractor/xml_extractor_thesis_test.rb
188
221
  homepage: https://github.com/lulibrary/puree
189
222
  licenses:
190
223
  - MIT
@@ -210,19 +243,23 @@ signing_key:
210
243
  specification_version: 4
211
244
  summary: Metadata extraction from the Pure Research Information System.
212
245
  test_files:
213
- - spec/download_http_spec.rb
214
- - spec/open_api_dataset_http_spec.rb
215
- - spec/query/funding_http_spec.rb
216
- - spec/query/person_http_spec.rb
217
- - spec/resource/collection_all_http_spec.rb
218
- - spec/resource/collection_http_spec.rb
219
- - spec/resource/dataset_http_spec.rb
220
- - spec/resource/event_http_spec.rb
221
- - spec/resource/journal_http_spec.rb
222
- - spec/resource/organisation_http_spec.rb
223
- - spec/resource/person_http_spec.rb
224
- - spec/resource/project_http_spec.rb
225
- - spec/resource/publication_http_spec.rb
226
- - spec/resource/publisher_http_spec.rb
227
- - spec/server_http_spec.rb
228
- - spec/spec_helper.rb
246
+ - test/extractor/resource_test.rb
247
+ - test/rest/base_test.rb
248
+ - test/rest/common_test.rb
249
+ - test/test_extractor_helper.rb
250
+ - test/test_helper.rb
251
+ - test/test_rest_helper.rb
252
+ - test/test_xml_extractor_helper.rb
253
+ - test/xml_extractor/xml_extractor_collection_test.rb
254
+ - test/xml_extractor/xml_extractor_conference_paper_test.rb
255
+ - test/xml_extractor/xml_extractor_dataset_test.rb
256
+ - test/xml_extractor/xml_extractor_event_test.rb
257
+ - test/xml_extractor/xml_extractor_external_organisation_test.rb
258
+ - test/xml_extractor/xml_extractor_journal_article_test.rb
259
+ - test/xml_extractor/xml_extractor_journal_test.rb
260
+ - test/xml_extractor/xml_extractor_organisation_test.rb
261
+ - test/xml_extractor/xml_extractor_person_test.rb
262
+ - test/xml_extractor/xml_extractor_project_test.rb
263
+ - test/xml_extractor/xml_extractor_publisher_test.rb
264
+ - test/xml_extractor/xml_extractor_research_output_test.rb
265
+ - test/xml_extractor/xml_extractor_thesis_test.rb
data/lib/puree/api/api.rb DELETED
@@ -1,9 +0,0 @@
1
- module Puree
2
-
3
- # Pure-specific details concerning requests and responses.
4
- #
5
- module API
6
-
7
- end
8
-
9
- end
@@ -1,33 +0,0 @@
1
- module Puree
2
-
3
- module API
4
-
5
- # Mixin to configure authentication.
6
- #
7
- module Authentication
8
-
9
- private
10
-
11
- # Configure a Pure host for API access.
12
- #
13
- # @param config [Hash]
14
- # @option config [String] :url The URL of the Pure host.
15
- # @option config [String] :username The username of the Pure host account.
16
- # @option config [String] :password The password of the Pure host account.
17
- def configure_api(config)
18
- @config = Puree::API::Configuration.new url: config[:url]
19
- @config.basic_auth username: config[:username],
20
- password: config[:password]
21
-
22
- @request = Puree::API::Request.new url: @config.url
23
- if @config.basic_auth?
24
- @request.basic_auth username: @config.username,
25
- password: @config.password
26
- end
27
- end
28
-
29
- end
30
-
31
- end
32
-
33
- end
@@ -1,43 +0,0 @@
1
- module Puree
2
-
3
- module API
4
-
5
- # Configuration for Pure host and credentials.
6
- #
7
- class Configuration
8
-
9
- # @return [String]
10
- attr_reader :url
11
-
12
- # @return [String, nil]
13
- attr_reader :username
14
-
15
- # @return [String, nil]
16
- attr_reader :password
17
-
18
- def initialize(url:)
19
- raise 'Missing URL in configuration' if !url
20
- @url = url
21
- end
22
-
23
- # Provide Basic Authentication credentials if required
24
- #
25
- # @param username [String]
26
- # @param password [String]
27
- def basic_auth(username:, password:)
28
- @username = username
29
- @password = password
30
- msg = 'Credentials incomplete in configuration'
31
- raise msg if username && !password
32
- raise msg if password && !username
33
- end
34
-
35
- def basic_auth?
36
- @username && @password
37
- end
38
-
39
- end
40
-
41
- end
42
-
43
- end
data/lib/puree/api/map.rb DELETED
@@ -1,80 +0,0 @@
1
- module Puree
2
-
3
- module API
4
-
5
- # Pure endpoints and corresponding XML root element in response.
6
- #
7
- class Map
8
-
9
- def initialize
10
- @convention = %w(
11
- event
12
- journal
13
- organisation
14
- person
15
- project
16
- publication
17
- publisher
18
- )
19
-
20
- @api_map = {
21
- resource_type: {
22
- dataset: {
23
- service: 'datasets',
24
- response: 'GetDataSetsResponse',
25
- family: 'dk.atira.pure.modules.datasets.external.model.dataset.DataSet'
26
- },
27
- download: {
28
- service: 'downloadcount',
29
- response: 'GetDownloadCountResponse'
30
- },
31
- server: {
32
- service: 'servermeta',
33
- response: 'GetServerMetaResponse'
34
- },
35
- external_organisation: {
36
- service: 'externalOrganisation',
37
- response: 'GetExternalOrganisationResponse'
38
- }
39
- }
40
- }
41
-
42
- add_convention
43
- # add_family
44
- end
45
-
46
- # Gets endpoints with their corresponding XML response names.
47
- #
48
- # @return [Hash]
49
- def get
50
- @api_map
51
- end
52
-
53
- # Endpoint for resource type.
54
- #
55
- # @param resource_type [Symbol]
56
- # @return [String, nil]
57
- def service_name(resource_type)
58
- @api_map[:resource_type][resource_type][:service]
59
- end
60
-
61
- private
62
-
63
- def add_convention
64
- @convention.each do |c|
65
- resource_type = {}
66
- resource_type[:service] = c
67
- resource_type[:response] = 'Get' + c.capitalize + 'Response'
68
- @api_map[:resource_type][c.to_sym] = resource_type
69
- end
70
- end
71
-
72
- # def add_family
73
- # @api_map[:resource_type][:event][:family] = 'dk.atira.pure.api.shared.model.event.Event'
74
- # end
75
-
76
- end
77
-
78
- end
79
-
80
- end
@@ -1,64 +0,0 @@
1
- module Puree
2
-
3
- module API
4
-
5
- # Handles requests to Pure.
6
- #
7
- class PersonRequest < Puree::API::Request
8
-
9
- def initialize(url:)
10
- super
11
- end
12
-
13
- # Perform a GET request to Pure
14
- #
15
- # @param uuid [String]
16
- # @param id [String]
17
- # @param employee_id [String]
18
- # @param rendering [String]
19
- # @param latest_api [Boolean]
20
- # @param resource_type [String]
21
- # @return [HTTP::Response]
22
- def get(uuid: nil,
23
- id: nil,
24
- employee_id: nil,
25
- rendering: :xml_long,
26
- latest_api: true,
27
- resource_type:)
28
- @latest_api = latest_api
29
- @resource_type = resource_type.to_sym
30
- @rendering = rendering
31
- @uuid = uuid
32
- @id = id
33
- @employee_id = employee_id
34
-
35
- # strip any trailing slash
36
- @url = @url.sub(/(\/)+$/, '')
37
- @headers['Accept'] = 'application/xml'
38
- @req = HTTP.headers accept: @headers['Accept']
39
- if @headers['Authorization']
40
- @req = @req.auth @headers['Authorization']
41
- end
42
- @req.get(build_url, params: parameters)
43
- end
44
-
45
- private
46
-
47
- def parameters
48
- query = {}
49
- if @uuid
50
- query['uuids.uuid'] = @uuid
51
- elsif @id
52
- query['pureInternalIds.id'] = @id
53
- elsif @employee_id
54
- query['personEmployeeIds.value'] = @employee_id
55
- end
56
- query['rendering'] = @rendering
57
- query
58
- end
59
-
60
- end
61
-
62
- end
63
-
64
- end