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 +4 -4
- data/Gemfile.lock +1 -1
- data/README.md +2 -2
- data/lib/ref2bibtex/version.rb +1 -1
- data/lib/ref2bibtex.rb +3 -1
- data/ref2bibtex.gemspec +1 -1
- data/spec/ref2bibtex_spec.rb +8 -0
- metadata +4 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: d7757e8fcfbfeccc415e91c00e4f2302b0ce37c4
|
4
|
+
data.tar.gz: 1bf31207bbc840f4ac1cd0617eb06713d47b1340
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 09316afcae92969335e4c421860aa5a2ac56f816039b58e581ba1afd34169b4f1b57cfc317db1e178ea2be35446955b6c46e35d59717bf02dbc5eecef1c82258
|
7
|
+
data.tar.gz: 4dcafb5dca149065d4c9e71921fff3f26dc0a8f004609fd25ca31ae4e11f9464b926a78bcf5e84c60f0edbff7974e19b0d3c3e2878c07030b2553faf7fd495b7
|
data/Gemfile.lock
CHANGED
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
|
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
|
52
|
+
NCSA, UI flavor. [http://opensource.org/licenses/NCSA]
|
53
53
|
|
data/lib/ref2bibtex/version.rb
CHANGED
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
|
-
|
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
|
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
|
|
data/spec/ref2bibtex_spec.rb
CHANGED
@@ -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.
|
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-
|
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
|
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: []
|