Module: Taxa::OpenTreeOfLife::TreeOfLife::Subtree
- Included in:
- Taxa::OpenTreeOfLife::TreeOfLife
- Defined in:
- lib/taxa/open_tree_of_life/tree_of_life/subtree.rb
Overview
wrapper around the node_info tree of life endpoint for Open Tree of Life
Instance Method Summary collapse
Instance Method Details
#subtree(**parameters) ⇒ Object
10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 |
# File 'lib/taxa/open_tree_of_life/tree_of_life/subtree.rb', line 10 def subtree(**parameters) ott_id = parameters[:ott_id] node_id = parameters[:node_id] validate_ott_and_node_id(ott_id, node_id) format = parameters[:format] || 'newick' validate_format(format) label_format = get_label_format(format, **parameters) height_limit = get_height_limit(format, **parameters) payload = { node_id: node_id, ott_id: ott_id, format: format, label_format: label_format, height_limit: height_limit }.compact url = 'https://api.opentreeoflife.org/v3/tree_of_life/subtree' response = @http_client.post(url, JSON.generate(payload), 'Content-Type' => 'application/json') JSON.parse(response.body) end |