bolognese 0.8.4 → 0.8.5
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile.lock +1 -1
- data/lib/bolognese/codemeta.rb +1 -1
- data/lib/bolognese/doi_utils.rb +2 -2
- data/lib/bolognese/schema_org.rb +1 -1
- data/lib/bolognese/utils.rb +3 -3
- data/lib/bolognese/version.rb +1 -1
- data/spec/doi_utils_spec.rb +6 -0
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: e7ecdd8495d5c59b4745c4e474f00fdfb43bc689
|
4
|
+
data.tar.gz: c067a911205b6ca30f82ceee7579a3b7e2cfa45f
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 08628597e24777b6116c7cd6106206e528211444daab260c609fa3f8beb08fd56fc0eba55db6f2d262686601fc9fa190f34cf4f6a0baa8f0607367f22fed7ea3
|
7
|
+
data.tar.gz: 62470519d4523414df33e4b546db7d41057af0f68c62e4b8af537d97c281f972b549a88b02d81660688b0f7418c523a2666d0e8014cdcdf15b43af5908a68443
|
data/Gemfile.lock
CHANGED
data/lib/bolognese/codemeta.rb
CHANGED
data/lib/bolognese/doi_utils.rb
CHANGED
@@ -1,11 +1,11 @@
|
|
1
1
|
module Bolognese
|
2
2
|
module DoiUtils
|
3
3
|
def validate_doi(doi)
|
4
|
-
Array(/\A(?:(http|https)
|
4
|
+
Array(/\A(?:(http|https):\/(\/)?(dx\.)?doi.org\/)?(doi:)?(10\.\d{4,5}\/.+)\z/.match(doi)).last
|
5
5
|
end
|
6
6
|
|
7
7
|
def validate_prefix(doi)
|
8
|
-
Array(/\A(?:(http|https)
|
8
|
+
Array(/\A(?:(http|https):\/(\/)?(dx\.)?doi.org\/)?(doi:)?(10\.\d{4,5})\/.+\z/.match(doi)).last
|
9
9
|
end
|
10
10
|
|
11
11
|
def normalize_doi(doi)
|
data/lib/bolognese/schema_org.rb
CHANGED
data/lib/bolognese/utils.rb
CHANGED
@@ -20,12 +20,12 @@ module Bolognese
|
|
20
20
|
def find_from_format_by_id(id)
|
21
21
|
id = normalize_id(id)
|
22
22
|
|
23
|
-
if /\A(?:(http|https)
|
23
|
+
if /\A(?:(http|https):\/(\/)?(dx\.)?doi.org\/)?(doi:)?(10\.\d{4,5}\/.+)\z/.match(id)
|
24
24
|
ra = get_doi_ra(id)
|
25
25
|
ra.present? ? ra.downcase : nil
|
26
|
-
elsif /\A(?:(http|https)
|
26
|
+
elsif /\A(?:(http|https):\/(\/)?orcid\.org\/)?(\d{4}-\d{4}-\d{4}-\d{3}[0-9X]+)\z/.match(id)
|
27
27
|
"orcid"
|
28
|
-
elsif /\A(http|https)
|
28
|
+
elsif /\A(http|https):\/(\/)?github\.com\/(.+)\z/.match(id)
|
29
29
|
"codemeta"
|
30
30
|
else
|
31
31
|
"schema_org"
|
data/lib/bolognese/version.rb
CHANGED
data/spec/doi_utils_spec.rb
CHANGED
@@ -58,6 +58,12 @@ describe Bolognese::Metadata, vcr: true do
|
|
58
58
|
response = subject.normalize_doi(doi)
|
59
59
|
expect(response).to be_nil
|
60
60
|
end
|
61
|
+
|
62
|
+
it "url with one slash" do
|
63
|
+
doi = "https:/doi.org/10.5061/dryad.8515"
|
64
|
+
response = subject.normalize_doi(doi)
|
65
|
+
expect(response).to eq("https://doi.org/10.5061/dryad.8515")
|
66
|
+
end
|
61
67
|
end
|
62
68
|
|
63
69
|
context "doi registration agency" do
|