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
@@ -1,126 +0,0 @@
1
- require 'spec_helper'
2
-
3
- describe 'Publication' do
4
-
5
- it '#new' do
6
- p = Puree::Extractor::Publication.new config
7
- expect(p).to be_a Puree::Extractor::Publication
8
- end
9
-
10
- before(:all) do
11
- request :publication
12
- end
13
-
14
- describe 'data retrieval' do
15
-
16
- it 'data structure' do
17
- expect(@p).to be_a Puree::Model::Publication
18
- end
19
-
20
- it '#associated' do
21
- expect(@p.associated).to all( be_a Puree::Model::RelatedContentHeader )
22
- end
23
-
24
- it '#bibliographical_note' do
25
- expect(@p.bibliographical_note).to be_a String if @p.bibliographical_note
26
- end
27
-
28
- it '#category' do
29
- expect(@p.category).to be_a String if @p.category
30
- end
31
-
32
- it '#description' do
33
- expect(@p.description).to be_a String if @p.description
34
- end
35
-
36
- it '#doi' do
37
- expect(@p.doi).to be_a String if @p.doi
38
- end
39
-
40
- it '#dois' do
41
- expect(@p.dois).to all( be_a String )
42
- end
43
-
44
- it '#external_organisations' do
45
- expect(@p.external_organisations).to all( be_a Puree::Model::ExternalOrganisationHeader )
46
- end
47
-
48
- it '#files' do
49
- expect(@p.files).to all( be_a Puree::Model::File )
50
- end
51
-
52
- it '#keywords' do
53
- expect(@p.keywords).to all( be_a String )
54
- end
55
-
56
- it '#language' do
57
- expect(@p.language).to be_a String if @p.language
58
- end
59
-
60
- it '#links' do
61
- expect(@p.links).to all( be_a String )
62
- end
63
-
64
- it '#organisations' do
65
- expect(@p.organisations).to all( be_a Puree::Model::OrganisationHeader )
66
- end
67
-
68
- it '#owner' do
69
- expect(@p.owner).to be_a Puree::Model::OrganisationHeader if @p.owner
70
- end
71
-
72
- it '#persons_internal' do
73
- expect(@p.persons_internal).to all( be_a Puree::Model::EndeavourPerson )
74
- end
75
-
76
- it '#persons_external' do
77
- expect(@p.persons_external).to all( be_a Puree::Model::EndeavourPerson )
78
- end
79
-
80
- it '#persons_other' do
81
- expect(@p.persons_other).to all( be_a Puree::Model::EndeavourPerson )
82
- end
83
-
84
- it '#publication_place' do
85
- expect(@p.publication_place).to be_a String if @p.publication_place
86
- end
87
-
88
- it '#publisher' do
89
- expect(@p.publisher).to be_a String if @p.publisher
90
- end
91
-
92
- it '#scopus_id' do
93
- expect(@p.scopus_id).to be_a String if @p.scopus_id
94
- end
95
-
96
- it '#statuses' do
97
- expect(@p.statuses).to all( be_a Puree::Model::PublicationStatus )
98
- end
99
-
100
- it '#subtitle' do
101
- expect(@p.subtitle).to be_a String if @p.subtitle
102
- end
103
-
104
- it '#title' do
105
- expect(@p.title).to be_a String if @p.title
106
- end
107
-
108
- it '#translated_subtitle' do
109
- expect(@p.translated_subtitle).to be_a String if @p.translated_subtitle
110
- end
111
-
112
- it '#translated_title' do
113
- expect(@p.translated_title).to be_a String if @p.translated_title
114
- end
115
-
116
- it '#type' do
117
- expect(@p.type).to be_a String if @p.type
118
- end
119
-
120
- it '#workflow_state' do
121
- expect(@p.workflow_state).to be_a String if @p.workflow_state
122
- end
123
-
124
- end
125
-
126
- end
@@ -1,26 +0,0 @@
1
- require 'spec_helper'
2
-
3
- describe 'Publisher' do
4
-
5
- it '#new' do
6
- p = Puree::Extractor::Publisher.new config
7
- expect(p).to be_a Puree::Extractor::Publisher
8
- end
9
-
10
- before(:all) do
11
- request :publisher
12
- end
13
-
14
- describe 'data retrieval' do
15
-
16
- it 'data structure' do
17
- expect(@p).to be_a Puree::Model::Publisher
18
- end
19
-
20
- it '#name' do
21
- expect(@p.name).to be_a String if @p.name
22
- end
23
-
24
- end
25
-
26
- end
@@ -1,26 +0,0 @@
1
- require 'spec_helper'
2
-
3
- describe 'Server' do
4
-
5
- it '#new' do
6
- extractor = Puree::Extractor::Server.new config
7
- expect(extractor).to be_a Puree::Extractor::Server
8
- end
9
-
10
- describe 'data retrieval' do
11
- before(:all) do
12
- @extractor = Puree::Extractor::Server.new config
13
- @p = @extractor.find
14
- end
15
-
16
- it '#find' do
17
- expect(@p).to be_a Puree::Model::Server
18
- end
19
-
20
- it '#version' do
21
- expect(@p.version).to be_a String if @p.version
22
- end
23
-
24
- end
25
-
26
- end
data/spec/spec_helper.rb DELETED
@@ -1,159 +0,0 @@
1
- require 'http'
2
- require 'nokogiri'
3
-
4
- require 'puree/version'
5
-
6
- require 'puree/util/date'
7
- require 'puree/util/string'
8
-
9
- require 'puree/xml_extractor/mixins/associated_mixin'
10
- require 'puree/xml_extractor/mixins/doi_mixin'
11
- require 'puree/xml_extractor/mixins/event_mixin'
12
- require 'puree/xml_extractor/mixins/external_organisations_mixin'
13
- require 'puree/xml_extractor/mixins/pages_mixin'
14
- require 'puree/xml_extractor/mixins/page_range_mixin'
15
- require 'puree/xml_extractor/mixins/peer_reviewed_mixin'
16
- require 'puree/xml_extractor/mixins/workflow_state_mixin'
17
-
18
- require 'puree/xml_extractor/shared'
19
- require 'puree/xml_extractor/base'
20
- require 'puree/xml_extractor/collection'
21
- require 'puree/xml_extractor/resource'
22
- require 'puree/xml_extractor/dataset'
23
- require 'puree/xml_extractor/download'
24
- require 'puree/xml_extractor/event'
25
- require 'puree/xml_extractor/journal'
26
- require 'puree/xml_extractor/organisation'
27
- require 'puree/xml_extractor/external_organisation'
28
- require 'puree/xml_extractor/person'
29
- require 'puree/xml_extractor/project'
30
-
31
- require 'puree/xml_extractor/publication'
32
- require 'puree/xml_extractor/thesis'
33
- require 'puree/xml_extractor/doctoral_thesis'
34
- require 'puree/xml_extractor/masters_thesis'
35
- require 'puree/xml_extractor/journal_article'
36
- require 'puree/xml_extractor/paper_base'
37
- require 'puree/xml_extractor/conference_paper'
38
- require 'puree/xml_extractor/paper'
39
-
40
- require 'puree/xml_extractor/publisher'
41
- require 'puree/xml_extractor/server'
42
-
43
- require 'puree/api/map'
44
- require 'puree/api/request'
45
- require 'puree/api/person_request'
46
- require 'puree/api/configuration'
47
- require 'puree/api/authentication'
48
-
49
- require 'puree/model/helper/validation'
50
- require 'puree/model/structure'
51
-
52
- require 'puree/model/resource'
53
- require 'puree/model/dataset'
54
- require 'puree/model/download_header'
55
- require 'puree/model/event'
56
- require 'puree/model/event_header'
57
- require 'puree/model/external_organisation'
58
- require 'puree/model/journal'
59
- require 'puree/model/journal_header'
60
- require 'puree/model/link'
61
- require 'puree/model/organisation'
62
- require 'puree/model/person'
63
- require 'puree/model/project'
64
-
65
- require 'puree/model/publication'
66
- require 'puree/model/thesis'
67
- require 'puree/model/doctoral_thesis'
68
- require 'puree/model/masters_thesis'
69
- require 'puree/model/journal_article'
70
- require 'puree/model/paper_base'
71
- require 'puree/model/conference_paper'
72
- require 'puree/model/paper'
73
-
74
- require 'puree/model/publisher'
75
- require 'puree/model/related_content_header'
76
- require 'puree/model/spatial_point'
77
-
78
- require 'puree/model/address'
79
- require 'puree/model/copyright_license'
80
- require 'puree/model/event_header'
81
- require 'puree/model/external_organisation_header'
82
- require 'puree/model/file'
83
- require 'puree/model/legal_condition'
84
- require 'puree/model/organisation_header'
85
- require 'puree/model/endeavour_person'
86
- require 'puree/model/person_name'
87
- require 'puree/model/publication_status'
88
- require 'puree/model/server'
89
- require 'puree/model/temporal_range'
90
-
91
- require 'puree/extractor/resource'
92
- require 'puree/extractor/dataset'
93
- require 'puree/extractor/event'
94
- require 'puree/extractor/external_organisation'
95
- require 'puree/extractor/journal'
96
- require 'puree/extractor/organisation'
97
- require 'puree/extractor/person'
98
- require 'puree/extractor/project'
99
-
100
- require 'puree/extractor/publication'
101
- require 'puree/extractor/thesis'
102
- require 'puree/extractor/doctoral_thesis'
103
- require 'puree/extractor/masters_thesis'
104
- require 'puree/extractor/journal_article'
105
- require 'puree/extractor/paper_base'
106
- require 'puree/extractor/conference_paper'
107
- require 'puree/extractor/paper'
108
-
109
- require 'puree/extractor/publisher'
110
- require 'puree/extractor/collection'
111
- require 'puree/extractor/download'
112
- require 'puree/extractor/server'
113
-
114
- require 'puree/query/funding'
115
- require 'puree/query/person'
116
-
117
- def config
118
- {
119
- url: ENV['PURE_URL'],
120
- username: ENV['PURE_USERNAME'],
121
- password: ENV['PURE_PASSWORD']
122
- }
123
- end
124
-
125
- def config_open
126
- {
127
- url: ENV['PURE_URL_OPEN']
128
- }
129
- end
130
-
131
- def request(resource)
132
- @extractor = Puree::Extractor::Collection.new config: config,
133
- resource: resource
134
- @p = @extractor.random_resource
135
- end
136
-
137
- def request_open(resource)
138
- @extractor = Puree::Extractor::Collection.new resource: resource,
139
- config: config_open
140
- @p = @extractor.random_resource
141
- end
142
-
143
- def resource_header
144
- it '#uuid' do
145
- expect(@p.uuid).to be_a String if @p.uuid
146
- end
147
-
148
- it '#created' do
149
- expect(@p.created).to be_a Time if @p.created
150
- end
151
-
152
- it '#modified' do
153
- expect(@p.modified).to be_a Time if @p.modified
154
- end
155
-
156
- it '#locale' do
157
- expect(@p.locale).to be_a String if @p.locale
158
- end
159
- end