rubyMorphbank 0.2.3 → 0.2.5

Sign up to get free protection for your applications and to get access to all the features.
data/README.rdoc CHANGED
@@ -1,17 +1,36 @@
1
1
  = rubyMorphbank
2
2
 
3
- A request/response library for the Morphbank (http://morphbank.net) API.
3
+ == Description
4
4
 
5
- == Note on Patches/Pull Requests
5
+ rubyMorphbank is a request/response Ruby gem library for the Morphbank (http://morphbank.net) API.
6
+
7
+ == Installation
8
+
9
+ gem install rubyMorphbank
10
+
11
+ == Usage
12
+
13
+ See the tests (test/test_rubyMorphbank.rb) for usage.
14
+
15
+ === Basic pattern
16
+
17
+ request = Rmb.new.request
18
+ response = request.get_response
19
+
20
+ === Return the request URL
6
21
 
7
- * Fork the project.
8
- * Make your feature addition or bug fix.
9
- * Add tests for it. This is important so I don't break it in a
10
- future version unintentionally.
11
- * Commit, do not mess with rakefile, version, or history.
12
- (if you want to have your own version, that is fine but bump version in a commit by itself I can ignore when I pull)
13
- * Send me a pull request. Bonus points for topic branches.
22
+ request = Rmb.new.request
23
+ request.request_url # => "http://services.morphbank.net/mb3/request?method=search&depth=1&firstResult=0&format=id&keywords=&limit=10&objecttype=Image"
24
+
25
+ === Return a link to a thumbnail in a call for a single image
26
+
27
+ foo = Rmb.new.request(:format => 'svc', :id => 195815, :method => 'id')
28
+ uri = foo.get_response.get_text('thumbUrl')
14
29
 
15
30
  == Copyright
16
31
 
17
32
  Copyright (c) 2010 mjy. See LICENSE for details.
33
+
34
+ == More information
35
+
36
+ * The Morphbank Services page is at http://services.morphbank.net/mb3/.
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.2.3
1
+ 0.2.5
data/lib/request.rb CHANGED
@@ -33,6 +33,10 @@ class Request
33
33
  end
34
34
 
35
35
 
36
+ # TODO: add some proper sanitation?!
37
+ opt[:keywords].gsub!(/\s+/, '+') if opt[:keywords].length > 0
38
+
39
+
36
40
  # create the request
37
41
  @request_url = SERVICES_URI + "method=#{opt[:method]}" +
38
42
  opt.keys.sort{|a,b| a.to_s <=> b.to_s}.collect{
@@ -24,7 +24,7 @@ class TestRequest < Test::Unit::TestCase
24
24
  should "return a properly formatted request url with no options" do
25
25
  @rmb = Rmb.new
26
26
  assert @request = @rmb.request
27
- assert_equal "http://services.morphbank.net/mb3/request?method=search&depth=1&first_result=0&format=id&keywords=&limit=10&objecttype=Image", @request.request_url
27
+ assert_equal "http://services.morphbank.net/mb3/request?method=search&depth=1&firstResult=0&format=id&keywords=&limit=10&objecttype=Image", @request.request_url
28
28
  end
29
29
 
30
30
  end
@@ -77,7 +77,7 @@ class TestResponse < Test::Unit::TestCase
77
77
  assert_equal 'Image', @request.get_response.get_text('objecttypes')
78
78
  end
79
79
 
80
- # return a link to a numbnail in a call for a single image
80
+ # return a link to a thumbnail in a call for a single image
81
81
  should "return a URI to a thumb for a single object query" do
82
82
  foo = Rmb.new.request(:format => 'svc', :id => 195815, :method => 'id')
83
83
  assert_equal 'http://images.morphbank.net/?id=195815&imgType=thumb', foo.get_response.get_text('thumbUrl')
metadata CHANGED
@@ -5,8 +5,8 @@ version: !ruby/object:Gem::Version
5
5
  segments:
6
6
  - 0
7
7
  - 2
8
- - 3
9
- version: 0.2.3
8
+ - 5
9
+ version: 0.2.5
10
10
  platform: ruby
11
11
  authors:
12
12
  - mjy
@@ -14,7 +14,7 @@ autorequire:
14
14
  bindir: bin
15
15
  cert_chain: []
16
16
 
17
- date: 2010-09-10 00:00:00 -04:00
17
+ date: 2011-02-01 00:00:00 -05:00
18
18
  default_executable:
19
19
  dependencies:
20
20
  - !ruby/object:Gem::Dependency