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: 2fcf10674f5f9e20c6ea4147a6b9aec719cc98c3
4
- data.tar.gz: 327fc545d8bd8578916d3af5d6626a3275c644c3
3
+ metadata.gz: 4125473c39c8033862e28720835d14d0c8baebae
4
+ data.tar.gz: 27620bdaca103694e3b6439b359ad2794668704f
5
5
  SHA512:
6
- metadata.gz: 0593100d48e273621c9a25f121f752538ca86aec27c58549225958b665db77e395f4d09c29373505029f5e162569a31bba9d993becdad1c0da425e318abe0eb1
7
- data.tar.gz: 768422a4cced4fc06c85a204fd32a910bb0a85fd862e60f3c8f1ac46050db44a6376bb29e3ca25e7a7421e6e0108f6a0968e79014bd832dab82e484a1192f24e
6
+ metadata.gz: b1efd34aabe1c1cc5eb4863aa1130e57c292aa813cc067bf551396cf41370265b737a131094e3c579f4190d6220d07638b494964a7cc51d6534c423735181264
7
+ data.tar.gz: e077fcde38e2d162b04857357805cc9821676b2d8abc82184902b8f80bc8198e5aa45aea0829c2ca1de0d4cbca27cfb65e4f2e1f4a9b8a06b6cd59e3ee1e75d6
@@ -23,5 +23,5 @@ Gem::Specification.new do |spec|
23
23
 
24
24
  spec.add_development_dependency "bundler", "~> 1.3"
25
25
  spec.add_development_dependency "rake"
26
- spec.add_development_dependency 'rspec', "~>2.99"
26
+ spec.add_development_dependency 'rspec', "~>2.14"
27
27
  end
@@ -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
@@ -1,5 +1,5 @@
1
1
  module Hydra
2
2
  module RemoteIdentifier
3
- VERSION = "0.6.6"
3
+ VERSION = "0.6.7"
4
4
  end
5
5
  end
@@ -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.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-06-23 00:00:00.000000000 Z
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.99'
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.99'
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: