ropensci/rgbif — pull request #106 by jarioksa (2014-09-15 12:44:36+00:00)
Title: Get all records when a synonym of correct name was used in query

If a synonym of correct name was used in the query, only those
records were returned that were stored in the data base with that
synonym. For instance, query of `"Pulsatilla patens"` did not return
the records that were saved with the accepted name `"Anemone patens"`.
All records are returned if you query `"Anemone patens"`, including
those entered as `"Pulsatilla patens"`. Therefore the synonyms must
be replaced with the accepted name.

The same problem persists in `spocc:::foo_gbif()` where the code
takes `usageKey` entry which is guaranteed be wrong usage with synonym.
Instead there should be something like:
```R
tmp <- name_backbone(name = query)
if (tmp$synonym)
UsageKey <- x[[paste0(tolower(x$rank), "Key")]]
else
UsageKey <- x$usageKey
```