taxa 0.1.0 → 0.1.1

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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: bc7d986ed381cdb8284eec26e8f84e85d0ef803c00faf6b4f89cd178524b099c
4
- data.tar.gz: e6edb9b337a03a9cb3ecfb16b81022044029dcb753009fe9526dcae10e5ff21a
3
+ metadata.gz: 9326adca4c92b4369f90c78c0407bd7d2b03d01ed090dfa7de9316f433b9c075
4
+ data.tar.gz: 7d9e7ae022d84889381b95bd8176287789cef60144100d8e507f224483919675
5
5
  SHA512:
6
- metadata.gz: c93fe05a6e816d72009f9c8178edb6d7a012fadcf309bdfee2cb37f886a1a0142a1245415eb620fadab6d057c55d3b342c5eddc0ce2e27763cac9ebfce9077fd
7
- data.tar.gz: bf4b4afe570f496caf9b537b198223eb52a3fbc4e7cca4e36723bd019f817879f6ad0e877d647d63eff95f4dcb78acbd9b3222229b3b7e38210696efad95dcb2
6
+ metadata.gz: f4245d41126fbb024c57eddcb53696b4e143725980c0aa08de6b3d8068ef2bd8d393e6835c5494055c40a652c21001a419af145cabc2a2f9b36601988aa098ac
7
+ data.tar.gz: 7276d724cfb346763a9c5a2db940fa75cd1e49a221c506f8bda2f1560f2ba3a34390e047000fd564978a01f44a1ac8a6e3ed3a05544d9aebb2a8e76a352e6bdc
@@ -10,10 +10,9 @@ module Taxa
10
10
  module Mrca
11
11
  def mrca(ott_ids)
12
12
  raise ArgumentError, 'ott_ids required' if ott_ids.nil?
13
- raise ArgumentError, 'ott_ids expected to be an array' unless ott_ids.is_a?(Array)
14
13
 
15
14
  url = 'https://api.opentreeoflife.org/v3/taxonomy/mrca'
16
- response = @http_client.post(url, JSON.generate({ ott_ids: ott_ids }), 'Content-Type' => 'application/json')
15
+ response = @http_client.post(url, JSON.generate({ ott_ids: Array(ott_ids) }), 'Content-Type' => 'application/json')
17
16
  JSON.parse(response.body)
18
17
  end
19
18
  end
@@ -8,20 +8,20 @@ module Taxa
8
8
  class TNRS
9
9
  # tnrs match_names api endpoint
10
10
  module MatchNames
11
- def match_names(**parameters)
12
- names = parameters[:names]
13
- raise ArgumentError if names.nil?
11
+ def match_names(names, **parameters)
12
+ raise ArgumentError, 'names is required' if names.nil?
14
13
 
15
14
  context_name = parameters[:context_name]
16
15
  do_approximate_matching = parameters[:do_approximate_matching] || false
17
16
  include_suppressed = parameters[:include_suppressed]
18
17
 
19
18
  payload = {
20
- names: names,
19
+ names: Array(names),
21
20
  context_name: context_name,
22
21
  do_approximate_matching: do_approximate_matching,
23
22
  include_suppressed: include_suppressed
24
- }
23
+ }.compact
24
+
25
25
  url = 'https://api.opentreeoflife.org/v3/tnrs/match_names'
26
26
  response = @http_client.post(url, JSON.generate(payload), 'Content-Type' => 'application/json')
27
27
  JSON.parse(response.body)
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Taxa
4
- VERSION = '0.1.0'
4
+ VERSION = '0.1.1'
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: taxa
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0
4
+ version: 0.1.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Shane Sherman
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2020-12-27 00:00:00.000000000 Z
11
+ date: 2020-12-28 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rubocop