hydra-remote_identifier 0.6.6 → 0.6.7
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:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 4125473c39c8033862e28720835d14d0c8baebae
|
4
|
+
data.tar.gz: 27620bdaca103694e3b6439b359ad2794668704f
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: b1efd34aabe1c1cc5eb4863aa1130e57c292aa813cc067bf551396cf41370265b737a131094e3c579f4190d6220d07638b494964a7cc51d6534c423735181264
|
7
|
+
data.tar.gz: e077fcde38e2d162b04857357805cc9821676b2d8abc82184902b8f80bc8198e5aa45aea0829c2ca1de0d4cbca27cfb65e4f2e1f4a9b8a06b6cd59e3ee1e75d6
|
@@ -1,6 +1,7 @@
|
|
1
1
|
require 'uri'
|
2
2
|
require 'rest_client'
|
3
3
|
require 'hydra/remote_identifier/remote_service'
|
4
|
+
require 'hydra/remote_identifier/exceptions'
|
4
5
|
require 'active_support/core_ext/hash/indifferent_access'
|
5
6
|
|
6
7
|
module Hydra::RemoteIdentifier
|
@@ -25,8 +26,15 @@ module Hydra::RemoteIdentifier
|
|
25
26
|
@resolver_url = configuration.fetch(:resolver_url) { default_resolver_url }
|
26
27
|
end
|
27
28
|
|
29
|
+
def normalize_identifier(value)
|
30
|
+
value.to_s.strip.
|
31
|
+
sub(/\A#{resolver_url}/, '').
|
32
|
+
sub(/\A\s*doi:\s+/, 'doi:').
|
33
|
+
sub(/\A(\d)/, 'doi:\1')
|
34
|
+
end
|
35
|
+
|
28
36
|
def remote_uri_for(identifier)
|
29
|
-
URI.parse(File.join(resolver_url, identifier))
|
37
|
+
URI.parse(File.join(resolver_url, normalize_identifier(identifier)))
|
30
38
|
end
|
31
39
|
|
32
40
|
REQUIRED_ATTRIBUTES = ['target', 'creator', 'title', 'publisher', 'publicationyear' ].freeze
|
@@ -21,6 +21,18 @@ module Hydra::RemoteIdentifier
|
|
21
21
|
}
|
22
22
|
subject { RemoteServices::Doi.new(configuration) }
|
23
23
|
|
24
|
+
context '#normalize_identifier' do
|
25
|
+
[
|
26
|
+
['doi: 10.6017/ital.v28i2.3177', 'doi:10.6017/ital.v28i2.3177'],
|
27
|
+
['10.6017/ital.v28i2.3177', 'doi:10.6017/ital.v28i2.3177'],
|
28
|
+
[ RemoteServices::Doi::TEST_CONFIGURATION.fetch(:resolver_url) + '10.6017/ital.v28i2.3177', 'doi:10.6017/ital.v28i2.3177']
|
29
|
+
].each_with_index do |(input, expected), index|
|
30
|
+
it "scenario ##{index}" do
|
31
|
+
expect(subject.normalize_identifier(input)).to eq(expected)
|
32
|
+
end
|
33
|
+
end
|
34
|
+
end
|
35
|
+
|
24
36
|
context '.call' do
|
25
37
|
it 'should post to remote service', VCR::SpecSupport(cassette_name: 'doi-create') do
|
26
38
|
expect(subject.call(payload)).to eq(expected_doi)
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: hydra-remote_identifier
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.6.
|
4
|
+
version: 0.6.7
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Jeremy Friesen
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2014-
|
11
|
+
date: 2014-08-05 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: activesupport
|
@@ -78,14 +78,14 @@ dependencies:
|
|
78
78
|
requirements:
|
79
79
|
- - ~>
|
80
80
|
- !ruby/object:Gem::Version
|
81
|
-
version: '2.
|
81
|
+
version: '2.14'
|
82
82
|
type: :development
|
83
83
|
prerelease: false
|
84
84
|
version_requirements: !ruby/object:Gem::Requirement
|
85
85
|
requirements:
|
86
86
|
- - ~>
|
87
87
|
- !ruby/object:Gem::Version
|
88
|
-
version: '2.
|
88
|
+
version: '2.14'
|
89
89
|
description: Handles the registration and minting of remote identifiers (i.e. DOI,
|
90
90
|
ARK, ORCID)
|
91
91
|
email:
|