ref2bibtex 0.2.2 → 0.2.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: c4ec3e55b7810701e4f89859a2613a3f914da477
4
- data.tar.gz: 885c66dbbbab034887ec6a47bc6047457189349f
3
+ metadata.gz: c153ef1ea1467b62160f9e8459db3a108d88a3dd
4
+ data.tar.gz: 4a4f80870eb9512f4d2b747f809ea9a6cfdf4486
5
5
  SHA512:
6
- metadata.gz: 11b2d14f8665c82d95f9bc90db84b25a250c0d524b4cd589e46064ce4f48faeb367e97fab510c00d46b67caa6cf8ed694975b75e44246ad1c6f0274ef566e0d3
7
- data.tar.gz: 0b9fedcc76708c2c8204702ffaaf4861645456826f17881d58b6a1f0b04b7b86fd00e4b1629f0f36e4bf784a53ed0d3feb89fdb026339af756599832291508b5
6
+ metadata.gz: c2316279add7c7bbd4b77c43786d7b5c9dc1ada8b0f7d57be9a936b51859512c02958907baf5214f802aeae713450d332c5e0b751367c71f4dfecb5607669d59
7
+ data.tar.gz: c73aacc42c22c4d7c87d1e4450325dffffb31912800551d5aba3cc522f77b440cb73e41c3061acd753e10581d616a4d39708062a2711c5ae241291f9d1791540
data/.gitignore CHANGED
@@ -35,5 +35,5 @@ build/
35
35
 
36
36
  *~
37
37
  *.swp
38
- idea/
38
+ .idea/
39
39
  .DS_Store
data/Gemfile.lock CHANGED
@@ -1,28 +1,32 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- ref2bibtex (0.2.2)
4
+ ref2bibtex (0.2.3)
5
+ addressable (~> 2.5)
5
6
 
6
7
  GEM
7
8
  remote: https://rubygems.org/
8
9
  specs:
10
+ addressable (2.5.2)
11
+ public_suffix (>= 2.0.2, < 4.0)
9
12
  awesome_print (1.8.0)
10
13
  byebug (9.1.0)
11
14
  diff-lcs (1.3)
12
- rake (12.3.0)
13
- rspec (3.7.0)
14
- rspec-core (~> 3.7.0)
15
- rspec-expectations (~> 3.7.0)
16
- rspec-mocks (~> 3.7.0)
17
- rspec-core (3.7.0)
18
- rspec-support (~> 3.7.0)
19
- rspec-expectations (3.7.0)
15
+ public_suffix (3.0.3)
16
+ rake (12.3.2)
17
+ rspec (3.8.0)
18
+ rspec-core (~> 3.8.0)
19
+ rspec-expectations (~> 3.8.0)
20
+ rspec-mocks (~> 3.8.0)
21
+ rspec-core (3.8.0)
22
+ rspec-support (~> 3.8.0)
23
+ rspec-expectations (3.8.2)
20
24
  diff-lcs (>= 1.2.0, < 2.0)
21
- rspec-support (~> 3.7.0)
22
- rspec-mocks (3.7.0)
25
+ rspec-support (~> 3.8.0)
26
+ rspec-mocks (3.8.0)
23
27
  diff-lcs (>= 1.2.0, < 2.0)
24
- rspec-support (~> 3.7.0)
25
- rspec-support (3.7.0)
28
+ rspec-support (~> 3.8.0)
29
+ rspec-support (3.8.0)
26
30
 
27
31
  PLATFORMS
28
32
  ruby
@@ -36,4 +40,4 @@ DEPENDENCIES
36
40
  rspec
37
41
 
38
42
  BUNDLED WITH
39
- 1.16.1
43
+ 1.17.1
data/README.md CHANGED
@@ -1,5 +1,4 @@
1
1
  [![Build Status](https://travis-ci.org/SpeciesFileGroup/ref2bibtex.svg?branch=master)](https://travis-ci.org/SpeciesFileGroup/ref2bibtex)
2
- [![Dependency Status](https://gemnasium.com/badges/github.com/SpeciesFileGroup/ref2bibtex.svg)](https://gemnasium.com/github.com/SpeciesFileGroup/ref2bibtex)
3
2
 
4
3
  # ref2bibtex
5
4
 
data/lib/ref2bibtex.rb CHANGED
@@ -4,6 +4,8 @@ raise "IMPORTANT: gem requires ruby >= 2.1.0" unless recent_ruby
4
4
  require "ref2bibtex/version"
5
5
  require 'json'
6
6
  require 'net/http'
7
+ require 'cgi'
8
+ require "addressable/uri"
7
9
 
8
10
  module Ref2bibtex
9
11
 
@@ -47,8 +49,10 @@ module Ref2bibtex
47
49
  end
48
50
 
49
51
  # Pass a String doi get a bibtex formatted string back
52
+ #
50
53
  def self.get_bibtex(doi)
51
54
  return false if !doi
55
+ doi = Addressable::URI.parse(doi).normalize.to_s
52
56
  uri = URI(doi)
53
57
  return false if uri.class == URI::Generic
54
58
  response = Ref2bibtex.request(uri, headers: {'Accept' => 'application/x-bibtex' }, protocol: 'GET', process_response_as: 'text')
@@ -1,3 +1,3 @@
1
1
  module Ref2bibtex
2
- VERSION = "0.2.2"
2
+ VERSION = "0.2.3"
3
3
  end
data/ref2bibtex.gemspec CHANGED
@@ -18,6 +18,8 @@ Gem::Specification.new do |spec|
18
18
  spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
19
19
  spec.require_paths = ["lib"]
20
20
 
21
+ spec.add_dependency "addressable", "~> 2.5"
22
+
21
23
  spec.add_development_dependency "bundler", "~> 1.16"
22
24
  spec.add_development_dependency "rake", "~> 12.3"
23
25
  spec.add_development_dependency "byebug", "~> 9.1"
@@ -51,6 +51,12 @@ describe Ref2bibtex do
51
51
  specify 'a bad doi returns false' do
52
52
  expect(Ref2bibtex.get_bibtex('asfasf')).to eq(false)
53
53
  end
54
+
55
+ context 'random DOIs from the wild' do
56
+ specify '#1' do
57
+ expect(Ref2bibtex.get_bibtex('https://doi.org/10.1649/0010-065X(2001)055[0363:HHPANS]2.0.CO;2')).to be_truthy
58
+ end
59
+ end
54
60
  end
55
61
 
56
62
  specify "a citation that can not be resolved returns false from .get" do
metadata CHANGED
@@ -1,15 +1,29 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: ref2bibtex
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.2
4
+ version: 0.2.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: 2018-03-08 00:00:00.000000000 Z
11
+ date: 2019-01-11 00:00:00.000000000 Z
12
12
  dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: addressable
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - "~>"
18
+ - !ruby/object:Gem::Version
19
+ version: '2.5'
20
+ type: :runtime
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - "~>"
25
+ - !ruby/object:Gem::Version
26
+ version: '2.5'
13
27
  - !ruby/object:Gem::Dependency
14
28
  name: bundler
15
29
  requirement: !ruby/object:Gem::Requirement
@@ -122,7 +136,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
122
136
  version: '0'
123
137
  requirements: []
124
138
  rubyforge_project:
125
- rubygems_version: 2.6.14
139
+ rubygems_version: 2.6.14.1
126
140
  signing_key:
127
141
  specification_version: 4
128
142
  summary: Pass a full citation, get the bibtex back, that's all.