puree 2.8.1 → 2.9.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 7042cad4f264724c8db5e78ee7e044517884965bb601095b8cd11ebd8883cef9
4
- data.tar.gz: 50405daa56c748f5b4157a44035b9f009b59a05c889a2c3634e65ea3de9fda84
3
+ metadata.gz: a88708a008306a99ad43c36f4fb1692fd5b59159b70c839b2b1fee47527076fe
4
+ data.tar.gz: 1de184b1546eeb9712474426ef927c0f15d6c148c44e3614770bb26a0e093355
5
5
  SHA512:
6
- metadata.gz: '09027f7e53686f27acd1ae068237931897502c6c6848d523a7a641a049b1fd4c411e5b25507c1ce693f62cb7a95e6bc439fefbdc8ba4bcfe8012896ffc17e65b'
7
- data.tar.gz: 38a92a6b89047597c4dd207cfa4d4997297952342bd2628864d765d50a104fde1fa1597f99c407e8312c8f8a8d6d9fa5226e18ec53d3a9026e5d01dec2531560
6
+ metadata.gz: 5e18a7383b6547cd0929b8259eac4cbbfeec3e049b5574e36433b525f1dc4d2d939e3f3d81099df8d38943cb36758108cda032baac864499aa0c159c51dbc857
7
+ data.tar.gz: 780d8bc2d9703342529ea151d84e4a697ccf96345ff34606c267883ce8b6fdd82e9b72b13726877c5585e7b4e700bb8e3247ff74c1900c55818f0498b9088165
@@ -2,6 +2,10 @@
2
2
  All notable changes to this project will be documented in this file.
3
3
  This project adheres to [Semantic Versioning](http://semver.org/).
4
4
 
5
+ ## 2.9.0 2020-02-14
6
+ ### Changed
7
+ - For Pure API 515, 516.
8
+
5
9
  ## 2.8.1 2019-10-02
6
10
  ### Fixed
7
11
  - Research output - title.
@@ -17,7 +21,7 @@ This project adheres to [Semantic Versioning](http://semver.org/).
17
21
  ## 2.7.0 2019-06-06
18
22
  ### Changed
19
23
  - For Pure API 513.
20
- - Dataset, person, research output - keywords.
24
+ - Dataset, person, research output - keywords.
21
25
 
22
26
  ### Added
23
27
  - Resource subclasses - id.
data/README.md CHANGED
@@ -41,6 +41,7 @@ Purée version | Pure API version
41
41
  &gt;= 2.5, < 2.7 | 511, 512
42
42
  2.7 | 513
43
43
  2.8 | 514
44
+ 2.9 | 515, 516
44
45
 
45
46
  ## Extractor module
46
47
  ```ruby
@@ -1,5 +1,5 @@
1
1
  module Puree
2
2
  # Semantic version number
3
3
  #
4
- VERSION = "2.8.1"
4
+ VERSION = "2.9.0"
5
5
  end
@@ -86,7 +86,7 @@ module Puree
86
86
  other: []
87
87
  }
88
88
  xpath_result.each do |research_output|
89
- xpath_result_type = research_output.xpath('types/type')
89
+ xpath_result_type = research_output.xpath('type/term/text')
90
90
  type = xpath_result_type.first.text.strip unless xpath_result_type.empty?
91
91
  if type
92
92
  case type
@@ -46,10 +46,10 @@ module Puree
46
46
  # doc['createdDate'] = d.xpath('createdDate').text.strip
47
47
  # doc['visibleOnPortalDate'] = d.xpath('visibleOnPortalDate').text.strip
48
48
  # doc['limitedVisibility'] = d.xpath('limitedVisibility').text.strip
49
- document_license = d.xpath('documentLicenses/documentLicense').first
49
+ document_license = d.xpath('documentLicense').first
50
50
  if document_license
51
51
  license = Puree::Model::CopyrightLicense.new
52
- license.name = document_license.text.strip
52
+ license.name = document_license.xpath('term/text').text.strip
53
53
  # license.name = document_license.xpath('term/localizedString').text.strip
54
54
  # license.url = document_license.xpath('description/localizedString').text.strip
55
55
  doc.license = license if license.data?
@@ -88,7 +88,7 @@ module Puree
88
88
  # @return [Array<String>]
89
89
  def spatial_places
90
90
  # Data from free-form text box
91
- xpath_result = xpath_query '/geographicalCoverages/geographicalCoverage'
91
+ xpath_result = xpath_query '/geographicalCoverage'
92
92
  data = []
93
93
  xpath_result.each do |i|
94
94
  data << i.text.strip
@@ -14,7 +14,7 @@ module Puree
14
14
 
15
15
  # @return [String, nil]
16
16
  def name
17
- xpath_query_for_single_value '/names/name'
17
+ xpath_query_for_single_value '/name/text'
18
18
  end
19
19
 
20
20
  private
@@ -26,7 +26,7 @@ module Puree
26
26
  header = Puree::Model::JournalHeader.new
27
27
  header.title = xpath_result.xpath('title').text.strip
28
28
  journal = xpath_result.xpath('journal')
29
- xpath_result_type = journal.xpath('types/type')
29
+ xpath_result_type = journal.xpath('type/term/text')
30
30
  header.type = xpath_result_type.first.text.strip unless xpath_result_type.empty?
31
31
  header.uuid = journal.attr('uuid').text.strip
32
32
  header
@@ -8,7 +8,7 @@ module Puree
8
8
 
9
9
  # @return [String, nil]
10
10
  def description
11
- xpath_query_for_single_value '/abstracts/abstract'
11
+ xpath_query_for_single_value '/abstract/text'
12
12
  end
13
13
 
14
14
  end
@@ -12,7 +12,7 @@ module Puree
12
12
  if !xpath_result.empty?
13
13
  header = Puree::Model::EventHeader.new
14
14
  header.uuid = xpath_result.xpath('@uuid').text.strip
15
- xpath_result_name = xpath_result.xpath('names/name')
15
+ xpath_result_name = xpath_result.xpath('name/text')
16
16
  header.title = xpath_result_name.first.text.strip unless xpath_result_name.empty?
17
17
  return header if header.data?
18
18
  end
@@ -12,8 +12,8 @@ module Puree
12
12
  data = []
13
13
  xpath_result.each do |d|
14
14
  identifier = Puree::Model::Identifier.new
15
- identifier.id = d.text.strip
16
- identifier.type = d.attr('type').strip
15
+ identifier.id = d.xpath('value').text.strip
16
+ identifier.type = d.xpath('type/term/text').text.strip
17
17
  data << identifier
18
18
  end
19
19
  data.uniq { |d| d.id }
@@ -32,7 +32,7 @@ module Puree
32
32
  name.first = i.xpath('name/firstName').text.strip
33
33
  name.last = i.xpath('name/lastName').text.strip
34
34
  person.name = name if name.data?
35
- xpath_result_role = i.xpath('personRoles/personRole')
35
+ xpath_result_role = i.xpath('personRole/term/text')
36
36
  person.role = xpath_result_role.first.text.strip unless xpath_result_role.empty?
37
37
  arr << person if person.data?
38
38
  end
@@ -14,9 +14,9 @@ module Puree
14
14
  xpath_result.each { |i|
15
15
  related = Puree::Model::RelatedContentHeader.new
16
16
  related.uuid = i.attr('uuid').strip
17
- xpath_result_name = i.xpath('names/name')
17
+ xpath_result_name = i.xpath('name/text')
18
18
  related.title = xpath_result_name.first.text.strip unless xpath_result_name.empty?
19
- xpath_result_type = i.xpath('types/type')
19
+ xpath_result_type = i.xpath('type/term/text')
20
20
  related.type = xpath_result_type.first.text.strip unless xpath_result_type.empty?
21
21
  data_arr << related
22
22
  }
@@ -11,9 +11,9 @@ module Puree
11
11
  xpath_result = xpath_query '/publisher'
12
12
  h = Puree::Model::PublisherHeader.new
13
13
  h.uuid = xpath_result.xpath('@uuid').text.strip
14
- xpath_result_name = xpath_result.xpath('names/name')
14
+ xpath_result_name = xpath_result.xpath('name/text')
15
15
  h.name = xpath_result_name.first.text.strip unless xpath_result_name.empty?
16
- xpath_result_type = xpath_result.xpath('types/type')
16
+ xpath_result_type = xpath_result.xpath('type/term/text')
17
17
  h.type = xpath_result_type.first.text.strip unless xpath_result_type.empty?
18
18
  h.data? ? h : nil
19
19
  end
@@ -14,9 +14,9 @@ module Puree
14
14
  xpath_result.each { |i|
15
15
  related = Puree::Model::RelatedContentHeader.new
16
16
  related.uuid = i.attr('uuid').strip
17
- xpath_result_name = i.xpath('names/name')
17
+ xpath_result_name = i.xpath('name/text')
18
18
  related.title = xpath_result_name.first.text.strip unless xpath_result_name.empty?
19
- xpath_result_type = i.xpath('types/type')
19
+ xpath_result_type = i.xpath('type/term/text')
20
20
  related.type = xpath_result_type.first.text.strip unless xpath_result_type.empty?
21
21
  data_arr << related
22
22
  }
@@ -8,7 +8,7 @@ module Puree
8
8
 
9
9
  # @return [String, nil]
10
10
  def title
11
- xpath_query_for_single_value '/titles/title'
11
+ xpath_query_for_single_value '/title/text'
12
12
  end
13
13
 
14
14
  end
@@ -8,7 +8,7 @@ module Puree
8
8
 
9
9
  # @return [String, nil]
10
10
  def type
11
- xpath_query_for_single_value '/types/type'
11
+ xpath_query_for_single_value '/type/term/text'
12
12
  end
13
13
 
14
14
  end
@@ -8,7 +8,7 @@ module Puree
8
8
 
9
9
  # @return [String, nil]
10
10
  def workflow
11
- xpath_query_for_single_value '/workflows/workflow'
11
+ xpath_query_for_single_value '/workflow/value/text'
12
12
  end
13
13
 
14
14
  end
@@ -25,8 +25,8 @@ module Puree
25
25
  a.postcode = postcode unless building.empty?
26
26
  city = xpath_result.xpath('city').text.strip
27
27
  a.city = city unless city.empty?
28
- country = xpath_result.xpath('countries/country')
29
- a.country = country.first.text.strip unless country.empty?
28
+ country = xpath_result.xpath('country/term/text')
29
+ a.country = country.text.strip unless country.empty?
30
30
  a
31
31
  end
32
32
  end
@@ -38,7 +38,7 @@ module Puree
38
38
 
39
39
  # @return [String, nil]
40
40
  def name
41
- xpath_query_for_single_value '/names/name'
41
+ xpath_query_for_single_value '/name/text'
42
42
  end
43
43
 
44
44
  # First parent
@@ -29,7 +29,7 @@ module Puree
29
29
  xpath_result = xpath_query '/profilePhotos/profilePhoto'
30
30
  arr = []
31
31
  xpath_result.each do |i|
32
- arr << i.attr('url').strip
32
+ arr << i.xpath('url').text.strip
33
33
  end
34
34
  arr.uniq
35
35
  end
@@ -50,7 +50,7 @@ module Puree
50
50
 
51
51
  # @return [String, nil]
52
52
  def status
53
- xpath_query_for_single_value '/statuses/status'
53
+ xpath_query_for_single_value '/status/value/text'
54
54
  end
55
55
 
56
56
  # @return [Puree::Model::TemporalRange, nil]
@@ -22,12 +22,12 @@ module Puree
22
22
 
23
23
  # @return [String, nil]
24
24
  def bibliographical_note
25
- xpath_query_for_single_value '/bibliographicalNotes/bibliographicalNote'
25
+ xpath_query_for_single_value '/bibliographicalNote/text'
26
26
  end
27
27
 
28
28
  # @return [String, nil]
29
29
  def category
30
- xpath_query_for_single_value '/categories/category'
30
+ xpath_query_for_single_value '/category/term/text'
31
31
  end
32
32
 
33
33
  # Digital Object Identifier (first one, if many)
@@ -72,7 +72,7 @@ module Puree
72
72
 
73
73
  # @return [String, nil]
74
74
  def language
75
- xpath_query_for_single_value '/languages/language'
75
+ xpath_query_for_single_value '/language/term/text'
76
76
  end
77
77
 
78
78
  # @return [Array<String>, nil]
@@ -82,7 +82,7 @@ module Puree
82
82
 
83
83
  # @return [String, nil]
84
84
  def open_access_permission
85
- xpath_query_for_single_value '/openAccessPermissions/openAccessPermission'
85
+ xpath_query_for_single_value '/openAccessPermission/term/text'
86
86
  end
87
87
 
88
88
  # @return [Array<Puree::Model::EndeavourPerson>]
@@ -106,7 +106,7 @@ module Puree
106
106
  data = []
107
107
  xpath_result.each do |i|
108
108
  s = Puree::Model::PublicationStatus.new
109
- s.stage = i.xpath('publicationStatuses/publicationStatus').text.strip
109
+ s.stage = i.xpath('publicationStatus/term/text').text.strip
110
110
 
111
111
  ymd = {}
112
112
  ymd['year'] = i.xpath('publicationDate/year').text.strip
@@ -160,12 +160,12 @@ module Puree
160
160
 
161
161
  # @return [String, nil]
162
162
  def translated_subtitle
163
- xpath_query_for_single_value '/translatedSubTitles/translatedSubTitle'
163
+ xpath_query_for_single_value '/translatedSubTitle/text'
164
164
  end
165
165
 
166
166
  # @return [String, nil]
167
167
  def translated_title
168
- xpath_query_for_single_value '/translatedTitles/translatedTitle'
168
+ xpath_query_for_single_value '/translatedTitle/text'
169
169
  end
170
170
 
171
171
  private
@@ -10,9 +10,9 @@ module Puree
10
10
  def self.external_organisation_header(nokogiri_xml_element)
11
11
  h = Puree::Model::ExternalOrganisationHeader.new
12
12
  h.uuid = nokogiri_xml_element.xpath('@uuid').text.strip
13
- xpath_result_name = nokogiri_xml_element.xpath('names/name')
13
+ xpath_result_name = nokogiri_xml_element.xpath('name/text')
14
14
  h.name = xpath_result_name.first.text.strip unless xpath_result_name.empty?
15
- xpath_result_type = nokogiri_xml_element.xpath('types/type')
15
+ xpath_result_type = nokogiri_xml_element.xpath('type/term/text')
16
16
  h.type = xpath_result_type.first.text.strip unless xpath_result_type.empty?
17
17
  h.data? ? h : nil
18
18
  end
@@ -31,9 +31,9 @@ module Puree
31
31
  def self.organisation_header(nokogiri_xml_element)
32
32
  h = Puree::Model::OrganisationalUnitHeader.new
33
33
  h.uuid = nokogiri_xml_element.xpath('@uuid').text.strip
34
- xpath_result_name = nokogiri_xml_element.xpath('names/name')
34
+ xpath_result_name = nokogiri_xml_element.xpath('name/text')
35
35
  h.name = xpath_result_name.first.text.strip unless xpath_result_name.empty?
36
- xpath_result_type = nokogiri_xml_element.xpath('types/type')
36
+ xpath_result_type = nokogiri_xml_element.xpath('type/term/text')
37
37
  h.type = xpath_result_type.first.text.strip unless xpath_result_type.empty?
38
38
  h.data? ? h : nil
39
39
  end
@@ -27,7 +27,7 @@ module Puree
27
27
 
28
28
  # @return [String, nil]
29
29
  def qualification
30
- xpath_query_for_single_value('/qualifications/qualification')
30
+ xpath_query_for_single_value('/qualification/term/text')
31
31
  end
32
32
 
33
33
  # @return [Array<Puree::Model::ExternalOrganisationHeader>]
@@ -21,7 +21,7 @@ Gem::Specification.new do |spec|
21
21
 
22
22
  spec.required_ruby_version = '~> 2.1'
23
23
 
24
- spec.add_runtime_dependency 'http', '~> 2.0'
24
+ spec.add_runtime_dependency 'http', '~> 4.0'
25
25
  spec.add_runtime_dependency 'nokogiri', '~> 1.6'
26
26
 
27
27
  spec.add_development_dependency 'minitest-reporters', '~> 1.1'
@@ -20,6 +20,7 @@ class TestXMLExtractorPerson < Minitest::Test
20
20
  def test_core
21
21
  # Peter Diggle
22
22
  id = '811d7fc3-047a-40d2-89e6-c85d14a97fb8'
23
+
23
24
  x = xml_extractor_from_id id
24
25
 
25
26
  asserts_resource x
@@ -92,6 +93,7 @@ class TestXMLExtractorPerson < Minitest::Test
92
93
  def test_model
93
94
  # Peter Diggle
94
95
  id = '811d7fc3-047a-40d2-89e6-c85d14a97fb8'
96
+
95
97
  x = xml_extractor_from_id id
96
98
 
97
99
  assert_instance_of Puree::Model::Person, x.model
@@ -293,14 +293,17 @@ class TestXMLExtractorResearchOutput < Minitest::Test
293
293
  xml =
294
294
  '<contributionToJournal>
295
295
  <relatedProjects>
296
- <relatedProject uuid="fe8aebdf-a926-4e7b-adf1-082425e50330">
297
- <names>
298
- <name>The Language Bases of Reading Comprehension</name>
299
- </names>
300
- <types>
301
- <type uri="/dk/atira/pure/upmproject/upmprojecttypes/upmproject/research">Research</type>
302
- </types>
303
- </relatedProject>
296
+ <relatedProject uuid="f74685fd-f1a9-4de9-b9d7-288f690755c6">
297
+ <link ref="content" href="https://pure.lancs.ac.uk/ws/api/515/projects/f74685fd-f1a9-4de9-b9d7-288f690755c6"/>
298
+ <name formatted="false">
299
+ <text locale="en_GB">The Language Bases of Reading Comprehension</text>
300
+ </name>
301
+ <type pureId="236382102" uri="/dk/atira/pure/upmproject/upmprojecttypes/upmproject/research">
302
+ <term formatted="false">
303
+ <text locale="en_GB">Research</text>
304
+ </term>
305
+ </type>
306
+ </relatedProject>
304
307
  </relatedProjects>
305
308
  </contributionToJournal>'
306
309
 
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: puree
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.8.1
4
+ version: 2.9.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: 2019-10-02 00:00:00.000000000 Z
11
+ date: 2020-02-14 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: http
@@ -16,14 +16,14 @@ dependencies:
16
16
  requirements:
17
17
  - - "~>"
18
18
  - !ruby/object:Gem::Version
19
- version: '2.0'
19
+ version: '4.0'
20
20
  type: :runtime
21
21
  prerelease: false
22
22
  version_requirements: !ruby/object:Gem::Requirement
23
23
  requirements:
24
24
  - - "~>"
25
25
  - !ruby/object:Gem::Version
26
- version: '2.0'
26
+ version: '4.0'
27
27
  - !ruby/object:Gem::Dependency
28
28
  name: nokogiri
29
29
  requirement: !ruby/object:Gem::Requirement
@@ -236,7 +236,7 @@ licenses:
236
236
  - MIT
237
237
  metadata:
238
238
  source_code_uri: https://github.com/lulibrary/puree
239
- documentation_uri: https://www.rubydoc.info/gems/puree/2.8.1
239
+ documentation_uri: https://www.rubydoc.info/gems/puree/2.9.0
240
240
  post_install_message:
241
241
  rdoc_options: []
242
242
  require_paths: