entrez 0.5.2 → 0.5.3

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.
data/README.rdoc CHANGED
@@ -35,7 +35,7 @@ ESummary takes the same arguments.
35
35
 
36
36
  args:
37
37
  * database
38
- * term hash
38
+ * search terms (hash will be converted to term[field]+AND+another_term[another_field] notation. It can also be a string literal.)
39
39
  * params hash (optional)
40
40
 
41
41
  Entrez.ESearch('genomeprj', {WORD: 'hapmap', SEQS: 'inprogress'}, retmode: :xml)
data/lib/entrez.rb CHANGED
@@ -22,8 +22,9 @@ class Entrez
22
22
 
23
23
  # E.g. Entrez.ESearch('genomeprj', {WORD: 'hapmap', SEQS: 'inprogress'}, retmode: :xml)
24
24
  # returns response. For convenience, response.ids() returns array of ID integers from result set.
25
+ # search_terms can also be string literal.
25
26
  def ESearch(db, search_terms = {}, params = {})
26
- params[:term] = convert_search_term_hash(search_terms)
27
+ params[:term] = search_terms.is_a?(Hash) ? convert_search_term_hash(search_terms) : search_terms
27
28
  response = perform '/esearch.fcgi', db, params
28
29
  parse_ids_and_extend response if response[:retmode].nil? || response[:retmode] == :xml
29
30
  response
@@ -1,3 +1,3 @@
1
1
  module Entrez
2
- VERSION = "0.5.2"
2
+ VERSION = "0.5.3"
3
3
  end
data/spec/entrez_spec.rb CHANGED
@@ -37,6 +37,11 @@ describe Entrez do
37
37
  response.ids.should be_empty
38
38
  end
39
39
 
40
+ it '#ESearch accepts string as search_terms parameter' do
41
+ response = Entrez.ESearch('genomeprj', 'hapmap[WORD]', retmode: :xml)
42
+ response.ids.should include(60153)
43
+ end
44
+
40
45
  it 'should respect query limit' do
41
46
  requests = proc { 4.times { Entrez.EFetch('taxonomy', id: 9606) } }
42
47
  requests.should take_longer_than(1.0)
metadata CHANGED
@@ -2,7 +2,7 @@
2
2
  name: entrez
3
3
  version: !ruby/object:Gem::Version
4
4
  prerelease:
5
- version: 0.5.2
5
+ version: 0.5.3
6
6
  platform: ruby
7
7
  authors:
8
8
  - Jared Ning