makeFunctions | R Documentation |
The makeFunctions
function takes methods
described in a WADL and generates the R code to define
R functions that can be used to invoke these REST methods.
makeFunctions(wadl, methods = wadlMethods(wadl), eval = FALSE,
rewriteURL = function(x) x,
makeFun = makeFunction, ...)
wadl |
the WADL defining the the methods and resources.
This can be the name of a file/URL, a parsed XML document or an
object of class |
methods |
the methods that are to be converted to R functions |
eval |
a logical or environment controlling whether the R
functions that are constructed as text are to be defined as regular
R functions. If this is a logical and |
rewriteURL |
a function that takes a vector of URLs and rewrites
them if necessary. This can be specified as a character vector of
length 2 and this is interpreted as being the first 2 arguments to
|
makeFun |
a function that is called to create the code for each REST method. This allows the caller to customize the code creation process. |
... |
additional arguments that are passed on to
|
gw = wadl(system.file("sampleWADLs", "GenesByMolecularWeight.wadl", package = "WADL"))
invisible(makeFunctions(gw, eval = TRUE,
rewriteURL = function(x)
gsub("(/webservice/)", "/eupathdb/webservices/", x)))
tmp = GenesByMolecularWeight.json("Cryptosporidium parvum,Leishmania major,Toxoplasma gondii",
`o-fields` = "gene_type,organism")
if(require(RJSONIO)) {
# convert the answer
val = fromJSON(I(tmp))
}
tmp = GenesByMolecularWeight.xml("Cryptosporidium parvum,Leishmania major,Toxoplasma gondii",
`o-fields`="gene_type,organism")
if(require(XML))
val = xmlParse(tmp, asText = TRUE)
makeFunctions(gw, eval = TRUE, rewriteURL = c("(/webservice/)", "/eupathdb/webservices/"))
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.