dimus-biodiversity 0.0.8 → 0.0.9

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,2 @@
1
+ #Constants
2
+ LSID_RESOLVER_URL = "http://lsid.tdwg.org/"
@@ -0,0 +1,2 @@
1
+ dir = File.dirname(__FILE__)
2
+ require File.join(dir, *%w[guid lsid])
@@ -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.8
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