bolognese 0.9.76 → 0.9.77

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: 1a8a54f47ede10f00c05844c5dbc5a20903e0d99282f2c3ae07b6765f2045712
4
- data.tar.gz: 77ab0409df48f9ec9c2af92342e3a04c2630cc3e44cbd0bd3a9e1946461f0491
3
+ metadata.gz: 929243886c6cef57a3d73b0afc690c992552410c1e4d91ee3f2f8bdf9663e7e2
4
+ data.tar.gz: 7aba3fea4c5d343a341509ddb7b17f4d662c6d5b5ffc125f81e59e231c0d0c08
5
5
  SHA512:
6
- metadata.gz: 417ed9db40c5a4e215095e146be816aa6bb3a34bb742dc235eaa0337b456df718c36a36cac5ca43b463b8f45d08af274377fdb500d077d6dc828c346687c68b3
7
- data.tar.gz: d68f9d50ee43a261023039b17e455eee87f1566d3f59447c9640051b9be03cf2648cc8f1beb35c6138a32353d385e0cce3c193ae166f71022da5bbbb23e386fc
6
+ metadata.gz: fbf25d2aca9f3c9d8df6a229b9a87de94fd94b3c76fd19c20163666fbe1f88b98e4cfbd33d3cdb11d5725a68bbfe25ff0e16e9b978b226bfe82d4a72f3a36daa
7
+ data.tar.gz: 75c36cc522a1d23ad22c459b99d54195b717ed2f9106771417a75219f49115b8208c3871d4f8d948e8ed4c153410ca6ca93068db450189b215e81c97e8b80e22
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- bolognese (0.9.76)
4
+ bolognese (0.9.77)
5
5
  activesupport (>= 4.2.5, < 6)
6
6
  benchmark_methods (~> 0.7)
7
7
  bibtex-ruby (~> 4.1)
@@ -32,7 +32,7 @@ GEM
32
32
  addressable (2.5.2)
33
33
  public_suffix (>= 2.0.2, < 4.0)
34
34
  benchmark_methods (0.7)
35
- bibtex-ruby (4.4.5)
35
+ bibtex-ruby (4.4.6)
36
36
  latex-decode (~> 0.0)
37
37
  builder (3.2.3)
38
38
  codeclimate-test-reporter (1.0.8)
@@ -103,7 +103,7 @@ GEM
103
103
  public_suffix (>= 2.0.0, < 2.1)
104
104
  public_suffix (2.0.5)
105
105
  rack (2.0.4)
106
- rack-test (0.8.2)
106
+ rack-test (0.8.3)
107
107
  rack (>= 1.0, < 3)
108
108
  rake (12.3.0)
109
109
  rdf (3.0.1)
@@ -159,9 +159,19 @@ module Bolognese
159
159
 
160
160
  def rel_identifier
161
161
  Array.wrap(related_identifier).map do |r|
162
- { "__content__" => r["id"] || r["issn"],
163
- "related_identifier_type" => r["issn"].present? ? "ISSN" : validate_url(r["id"]),
164
- "relation_type" => r["relationType"] }.compact
162
+ related_identifier_type = r["issn"].present? ? "ISSN" : validate_url(r["id"])
163
+ if related_identifier_type == "ISSN"
164
+ content = r["issn"]
165
+ elsif related_identifier_type == "DOI"
166
+ content = doi_from_url(r["id"])
167
+ else
168
+ content = r["id"]
169
+ end
170
+
171
+ { "__content__" => content,
172
+ "related_identifier_type" => related_identifier_type,
173
+ "relation_type" => r["relationType"],
174
+ "resource_type_general" => r["resourceTypeGeneral"] }.compact
165
175
  end
166
176
  end
167
177
 
@@ -172,7 +182,8 @@ module Bolognese
172
182
  rel_identifier.each do |related_identifier|
173
183
  attributes = {
174
184
  'relatedIdentifierType' => related_identifier["related_identifier_type"],
175
- 'relationType' => related_identifier["relation_type"] }.compact
185
+ 'relationType' => related_identifier["relation_type"],
186
+ 'resourceTypeGeneral' => related_identifier["resource_type_general"] }.compact
176
187
  xml.relatedIdentifier(related_identifier["__content__"], attributes)
177
188
  end
178
189
  end
@@ -1,3 +1,3 @@
1
1
  module Bolognese
2
- VERSION = "0.9.76"
2
+ VERSION = "0.9.77"
3
3
  end
@@ -122,16 +122,16 @@ describe Bolognese::Metadata, vcr: true do
122
122
  response = Maremma.from_xml(xml)
123
123
  expect(response.dig("relatedIdentifiers", "relatedIdentifier")).to eq([{"relatedIdentifierType"=>"DOI",
124
124
  "relationType"=>"HasPart",
125
- "__content__"=>"https://doi.org/10.5061/dryad.8515/1"},
125
+ "__content__"=>"10.5061/dryad.8515/1"},
126
126
  {"relatedIdentifierType"=>"DOI",
127
127
  "relationType"=>"HasPart",
128
- "__content__"=>"https://doi.org/10.5061/dryad.8515/2"},
128
+ "__content__"=>"10.5061/dryad.8515/2"},
129
129
  {"relatedIdentifierType"=>"DOI",
130
130
  "relationType"=>"IsReferencedBy",
131
- "__content__"=>"https://doi.org/10.1371/journal.ppat.1000446"},
131
+ "__content__"=>"10.1371/journal.ppat.1000446"},
132
132
  {"relatedIdentifierType"=>"DOI",
133
133
  "relationType"=>"IsSupplementTo",
134
- "__content__"=>"https://doi.org/10.1371/journal.ppat.1000446"}])
134
+ "__content__"=>"10.1371/journal.ppat.1000446"}])
135
135
  end
136
136
  end
137
137
 
@@ -10,7 +10,7 @@ describe Bolognese::Metadata, vcr: true do
10
10
  expect(datacite.dig("titles", "title")).to eq("Automated quantitative histology reveals vascular morphodynamics during Arabidopsis hypocotyl secondary growth")
11
11
  expect(datacite.dig("relatedIdentifiers", "relatedIdentifier").length).to eq(27)
12
12
  expect(datacite.dig("relatedIdentifiers", "relatedIdentifier").first).to eq("relatedIdentifierType"=>"ISSN", "relationType"=>"IsPartOf", "__content__"=>"2050-084X")
13
- expect(datacite.dig("relatedIdentifiers", "relatedIdentifier")[1]).to eq("relatedIdentifierType"=>"DOI", "relationType"=>"References", "__content__"=>"https://doi.org/10.1038/nature02100")
13
+ expect(datacite.dig("relatedIdentifiers", "relatedIdentifier")[1]).to eq("relatedIdentifierType"=>"DOI", "relationType"=>"References", "__content__"=>"10.1038/nature02100")
14
14
  expect(datacite.dig("rightsList")).to eq("rights"=>{"rightsURI"=>"http://creativecommons.org/licenses/by/3.0"})
15
15
  expect(datacite.dig("fundingReferences", "fundingReference").count).to eq(4)
16
16
  expect(datacite.dig("fundingReferences", "fundingReference").last).to eq("funderName"=>"University of Lausanne", "funderIdentifier" => {"funderIdentifierType"=>"Crossref Funder ID", "__content__"=>"https://doi.org/10.13039/501100006390"})
@@ -157,7 +157,7 @@ describe Bolognese::Metadata, vcr: true do
157
157
  datacite = Maremma.from_xml(subject.datacite).fetch("resource", {})
158
158
  expect(datacite.dig("titles", "title")).to eq("Eating your own Dog Food")
159
159
  expect(datacite.dig("relatedIdentifiers", "relatedIdentifier").count).to eq(3)
160
- expect(datacite.dig("relatedIdentifiers", "relatedIdentifier").first).to eq("relatedIdentifierType"=>"DOI", "relationType"=>"IsPartOf", "__content__"=>"https://doi.org/10.5438/0000-00ss")
160
+ expect(datacite.dig("relatedIdentifiers", "relatedIdentifier").first).to eq("relatedIdentifierType"=>"DOI", "relationType"=>"IsPartOf", "__content__"=>"10.5438/0000-00ss")
161
161
  end
162
162
 
163
163
  it "DOI not found" do
@@ -185,7 +185,7 @@ describe Bolognese::Metadata, vcr: true do
185
185
  expect(datacite.dig("titles", "title")).to eq("Data from: Automated quantitative histology reveals vascular morphodynamics during Arabidopsis hypocotyl secondary growth")
186
186
  expect(datacite.dig("relatedIdentifiers", "relatedIdentifier").length).to eq(27)
187
187
  expect(datacite.dig("relatedIdentifiers", "relatedIdentifier").first).to eq("relatedIdentifierType"=>"ISSN", "relationType"=>"IsPartOf", "__content__"=>"2050-084X")
188
- expect(datacite.dig("relatedIdentifiers", "relatedIdentifier")[1]).to eq("relatedIdentifierType"=>"DOI", "relationType"=>"References", "__content__"=>"https://doi.org/10.1038/nature02100")
188
+ expect(datacite.dig("relatedIdentifiers", "relatedIdentifier")[1]).to eq("relatedIdentifierType"=>"DOI", "relationType"=>"References", "__content__"=>"10.1038/nature02100")
189
189
  expect(datacite.dig("rightsList")).to eq("rights"=>{"rightsURI"=>"http://creativecommons.org/licenses/by/3.0"})
190
190
  expect(datacite.dig("fundingReferences", "fundingReference").count).to eq(4)
191
191
  expect(datacite.dig("fundingReferences", "fundingReference").last).to eq("funderName"=>"University of Lausanne", "funderIdentifier" => {"funderIdentifierType"=>"Crossref Funder ID", "__content__"=>"https://doi.org/10.13039/501100006390"})
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: bolognese
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.9.76
4
+ version: 0.9.77
5
5
  platform: ruby
6
6
  authors:
7
7
  - Martin Fenner
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2018-02-25 00:00:00.000000000 Z
11
+ date: 2018-03-02 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: maremma