ref2bibtex 0.0.2 → 0.0.3

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: c7a6d2f188260ac456c771d9ec65929e9ab7ec5c
4
- data.tar.gz: d6f2310879d26fd8624abb4249d995180b25b7dc
3
+ metadata.gz: d7757e8fcfbfeccc415e91c00e4f2302b0ce37c4
4
+ data.tar.gz: 1bf31207bbc840f4ac1cd0617eb06713d47b1340
5
5
  SHA512:
6
- metadata.gz: 46c5683d946d88659da4f14178f53e1bd276887a4701d84e4541b40321f3d0d1faf3d3bf4b83aaba11c9ff01821a1f3ed0b8cc0b59102b3e84bd6f3adbf4113f
7
- data.tar.gz: 899c78be357a1b5e85bdc462a7ccda12f94d9a3050f1c0758cecd36db8a16f34b62a5d77443572205da531382304674a97a94d556128b70ee2cfc914e04f9b3b
6
+ metadata.gz: 09316afcae92969335e4c421860aa5a2ac56f816039b58e581ba1afd34169b4f1b57cfc317db1e178ea2be35446955b6c46e35d59717bf02dbc5eecef1c82258
7
+ data.tar.gz: 4dcafb5dca149065d4c9e71921fff3f26dc0a8f004609fd25ca31ae4e11f9464b926a78bcf5e84c60f0edbff7974e19b0d3c3e2878c07030b2553faf7fd495b7
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- ref2bibtex (0.0.1)
4
+ ref2bibtex (0.0.3)
5
5
 
6
6
  GEM
7
7
  remote: https://rubygems.org/
data/README.md CHANGED
@@ -44,10 +44,10 @@ The code is dumb, it takes the first.
44
44
  acknowledgements
45
45
  ================
46
46
 
47
- The Crossref API, and John Hill for his Python version.
47
+ The Crossref API, and Jon Hill, University of York, for his Python version and bringing up the approach.
48
48
 
49
49
  license
50
50
  =======
51
51
 
52
- NCSA, UI flavour.
52
+ NCSA, UI flavor. [http://opensource.org/licenses/NCSA]
53
53
 
@@ -1,3 +1,3 @@
1
1
  module Ref2bibtex
2
- VERSION = "0.0.2"
2
+ VERSION = "0.0.3"
3
3
  end
data/lib/ref2bibtex.rb CHANGED
@@ -22,7 +22,9 @@ module Ref2bibtex
22
22
  # Pass a String doi get a bibtex formatted string back
23
23
  def self.get_bibtex(doi)
24
24
  return false if !doi
25
- response = Ref2bibtex.request(URI(doi), headers: {'Accept' => 'application/x-bibtex' }, protocol: 'GET', process_response_as: 'text')
25
+ uri = URI(doi)
26
+ return false if uri.class == URI::Generic
27
+ response = Ref2bibtex.request(uri, headers: {'Accept' => 'application/x-bibtex' }, protocol: 'GET', process_response_as: 'text')
26
28
  end
27
29
 
28
30
  # Pass a String citation, get a doi back
data/ref2bibtex.gemspec CHANGED
@@ -9,7 +9,7 @@ Gem::Specification.new do |spec|
9
9
  spec.authors = ["Matt Yoder"]
10
10
  spec.email = ["diapriid@gmail.com"]
11
11
  spec.summary = %q{Pass a full citation, get the bibtex back, that's all.}
12
- spec.description = %q{Ok, maybe a bit more, you can have the DOI too.}
12
+ spec.description = %q{Ok, maybe a bit more, you can pass a DOI and get the bibtex string back too.}
13
13
  spec.homepage = "http://github.com/SpeciesFileGroup/ref2bibtex"
14
14
  spec.license = "MIT"
15
15
 
@@ -34,6 +34,10 @@ describe Ref2bibtex do
34
34
  specify 'a citation that can not be resolved returns false' do
35
35
  expect(Ref2bibtex.get_doi(CITATIONS[:fifth])).to eq(false)
36
36
  end
37
+
38
+ specify 'a badly formed DOI returns false' do
39
+ expect(Ref2bibtex.get_doi('asfas')).to eq(false)
40
+ end
37
41
  end
38
42
 
39
43
  context '#get_bibtex' do
@@ -43,6 +47,10 @@ describe Ref2bibtex do
43
47
  expect(response).to match(/title\s=/)
44
48
  expect(response).to match(/year\s=\s2009/)
45
49
  end
50
+
51
+ specify 'a bad doi returns false' do
52
+ expect(Ref2bibtex.get_bibtex('asfasf')).to eq(false)
53
+ end
46
54
  end
47
55
 
48
56
  specify "a citation that can not be resolved returns false" do
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: ref2bibtex
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.2
4
+ version: 0.0.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Matt Yoder
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-09-30 00:00:00.000000000 Z
11
+ date: 2014-11-06 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -66,7 +66,8 @@ dependencies:
66
66
  - - ">="
67
67
  - !ruby/object:Gem::Version
68
68
  version: '0'
69
- description: Ok, maybe a bit more, you can have the DOI too.
69
+ description: Ok, maybe a bit more, you can pass a DOI and get the bibtex string back
70
+ too.
70
71
  email:
71
72
  - diapriid@gmail.com
72
73
  executables: []