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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 063f676946258c78127e1d88782896a0b897e8a5
4
- data.tar.gz: 3b9f829af641f7aa53394eb79e588a838bc88abb
3
+ metadata.gz: e7ecdd8495d5c59b4745c4e474f00fdfb43bc689
4
+ data.tar.gz: c067a911205b6ca30f82ceee7579a3b7e2cfa45f
5
5
  SHA512:
6
- metadata.gz: 0583e3e9ec72227314e388c395b2d03c9e61421e6b5307b2bfa8254c988dca539cad1ffa3f94f1775d8f3f0ca2848d6fb6e6be808e2089b19657ac30eb17020a
7
- data.tar.gz: dd8d205fa555873683f496c5e49572bcc3a953fbb7d128baba3ca062e7ea206e86dc1592080edbea5e982d8fdccdfb042a29f0ad52d009ea7ba85d9c7a70c768
6
+ metadata.gz: 08628597e24777b6116c7cd6106206e528211444daab260c609fa3f8beb08fd56fc0eba55db6f2d262686601fc9fa190f34cf4f6a0baa8f0607367f22fed7ea3
7
+ data.tar.gz: 62470519d4523414df33e4b546db7d41057af0f68c62e4b8af537d97c281f972b549a88b02d81660688b0f7418c523a2666d0e8014cdcdf15b43af5908a68443
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- bolognese (0.8.4)
4
+ bolognese (0.8.5)
5
5
  activesupport (~> 4.2, >= 4.2.5)
6
6
  bibtex-ruby (~> 4.1)
7
7
  builder (~> 3.2, >= 3.2.2)
@@ -25,7 +25,7 @@ module Bolognese
25
25
  end
26
26
 
27
27
  def doi
28
- doi_from_url(id)
28
+ validate_doi(id)
29
29
  end
30
30
 
31
31
  def id
@@ -1,11 +1,11 @@
1
1
  module Bolognese
2
2
  module DoiUtils
3
3
  def validate_doi(doi)
4
- Array(/\A(?:(http|https):\/\/(dx\.)?doi.org\/)?(doi:)?(10\.\d{4,5}\/.+)\z/.match(doi)).last
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):\/\/(dx\.)?doi.org\/)?(doi:)?(10\.\d{4,5})\/.+\z/.match(doi)).last
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)
@@ -35,7 +35,7 @@ module Bolognese
35
35
  end
36
36
 
37
37
  def doi
38
- doi_from_url(id)
38
+ validate_doi(id)
39
39
  end
40
40
 
41
41
  def id
@@ -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):\/\/(dx\.)?doi.org\/)?(doi:)?(10\.\d{4,5}\/.+)\z/.match(id)
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):\/\/orcid\.org\/)?(\d{4}-\d{4}-\d{4}-\d{3}[0-9X]+)\z/.match(id)
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):\/\/github\.com\/(.+)\z/.match(id)
28
+ elsif /\A(http|https):\/(\/)?github\.com\/(.+)\z/.match(id)
29
29
  "codemeta"
30
30
  else
31
31
  "schema_org"
@@ -1,3 +1,3 @@
1
1
  module Bolognese
2
- VERSION = "0.8.4"
2
+ VERSION = "0.8.5"
3
3
  end
@@ -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
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: bolognese
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.8.4
4
+ version: 0.8.5
5
5
  platform: ruby
6
6
  authors:
7
7
  - Martin Fenner