Module: Taxa::OpenTreeOfLife::Taxonomy::Mrca

Included in:
Taxa::OpenTreeOfLife::Taxonomy
Defined in:
lib/taxa/open_tree_of_life/taxonomy/mrca.rb

Overview

wrapper around the node_info tree of life endpoint for Open Tree of Life

Instance Method Summary collapse

Instance Method Details

#mrca(ott_ids) ⇒ Object

Raises:

  • (ArgumentError)


10
11
12
13
14
15
16
17
# File 'lib/taxa/open_tree_of_life/taxonomy/mrca.rb', line 10

def mrca(ott_ids)
  raise ArgumentError, 'ott_ids required' if ott_ids.nil?

  url = 'https://api.opentreeoflife.org/v3/taxonomy/mrca'
  response = @http_client.post(url, JSON.generate({ ott_ids: Array(ott_ids) }),
                               'Content-Type' => 'application/json')
  JSON.parse(response.body)
end