dimus-biodiversity 0.0.8 → 0.0.9
Sign up to get free protection for your applications and to get access to all the features.
- data/conf/environment.rb +2 -0
- data/lib/biodiversity/guid.rb +2 -0
- data/lib/biodiversity/guid/lsid.rb +18 -0
- data/spec/guid/lsid.spec.rb +12 -0
- metadata +8 -1
data/conf/environment.rb
ADDED
@@ -0,0 +1,18 @@
|
|
1
|
+
require 'open-uri'
|
2
|
+
|
3
|
+
class LsidResolver
|
4
|
+
def self.resolve(lsid)
|
5
|
+
http_get_rdf(lsid)
|
6
|
+
end
|
7
|
+
|
8
|
+
protected
|
9
|
+
def self.http_get_rdf(lsid)
|
10
|
+
rdf = ''
|
11
|
+
open(LSID_RESOLVER_URL + lsid) do |f|
|
12
|
+
f.each do |line|
|
13
|
+
rdf += line if !line.strip.blank?
|
14
|
+
end
|
15
|
+
end
|
16
|
+
rdf
|
17
|
+
end
|
18
|
+
end
|
@@ -0,0 +1,12 @@
|
|
1
|
+
dir = File.dirname("__FILE__")
|
2
|
+
require 'rubygems'
|
3
|
+
require 'spec'
|
4
|
+
require File.expand_path(dir + "../../conf/environment")
|
5
|
+
require File.expand_path(dir + "../../lib/biodiversity/guid")
|
6
|
+
|
7
|
+
describe LsidResolver do
|
8
|
+
it "should return RFD document from lsid" do
|
9
|
+
lsid = "urn:lsid:ubio.org:classificationbank:2232671"
|
10
|
+
LsidResolver.resolve(lsid).class.should == "".class
|
11
|
+
end
|
12
|
+
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: dimus-biodiversity
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.9
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Dmitry Mozzherin
|
@@ -42,10 +42,17 @@ files:
|
|
42
42
|
- LICENSE
|
43
43
|
- README.rdoc
|
44
44
|
- Rakefile
|
45
|
+
- conf
|
46
|
+
- conf/environment.rb
|
45
47
|
- spec/parser
|
46
48
|
- spec/parser/scientific_name.spec.rb
|
49
|
+
- spec/guid
|
50
|
+
- spec/guid/lsid.spec.rb
|
47
51
|
- lib/biodiversity
|
48
52
|
- lib/biodiversity/parser
|
53
|
+
- lib/biodiversity/guid.rb
|
54
|
+
- lib/biodiversity/guid
|
55
|
+
- lib/biodiversity/guid/lsid.rb
|
49
56
|
- lib/biodiversity/parser/scientific_name.rb
|
50
57
|
- lib/biodiversity/parser/scientific_name.treetop
|
51
58
|
- lib/biodiversity/parser.rb
|