BiodbRequest: Class Request.

BiodbRequestR Documentation

Class Request.

Description

Class Request.

Class Request.

Details

This class represents a Request object that can be used with the Request Scheduler.

Methods

Public methods


Method new()

Initializer.

Usage
BiodbRequest$new(
  url,
  method = c("get", "post"),
  header = character(),
  body = character(),
  encoding = integer(),
  conn = NULL
)
Arguments
url

A BiodbUrl object.

method

HTTP method. Either "get" or "post".

header

The header.

body

The body.

encoding

The encoding to use.

conn

A valid BiodbConn instance for which this request is built.

Returns

Nothing.


Method setConn()

Sets the associated connector (usually the connector that created this request).

Usage
BiodbRequest$setConn(conn)
Arguments
conn

A valid BiodbConn object.

Returns

Nothing.


Method getConn()

gets the associated connector (usually the connector that created this request).

Usage
BiodbRequest$getConn()
Returns

The associated connector as a BiodbConn object.


Method getUrl()

Gets the URL.

Usage
BiodbRequest$getUrl()
Returns

The URL as a BiodbUrl object.


Method getMethod()

Gets the method.

Usage
BiodbRequest$getMethod()
Returns

The method as a character value.


Method getEncoding()

Gets the encoding.

Usage
BiodbRequest$getEncoding()
Returns

The encoding.


Method getCurlOptions()

Gets the options object to pass to cURL library.

Usage
BiodbRequest$getCurlOptions(useragent)
Arguments
useragent

The user agent as a character value.

Returns

An RCurl options object.


Method getUniqueKey()

Gets a unique key to identify this request. The key is an MD5 sum computed from the string representation of this request.

Usage
BiodbRequest$getUniqueKey()
Returns

A unique key as an MD5 sum.


Method getHeaderAsSingleString()

Gets the HTTP header as a string, concatenating all its information into a single string.

Usage
BiodbRequest$getHeaderAsSingleString()
Returns

The header as a single character value.


Method getBody()

Gets the body.

Usage
BiodbRequest$getBody()
Returns

The body as a character value.


Method print()

Displays information about this instance.

Usage
BiodbRequest$print()
Returns

self as invisible.


Method toString()

Gets a string representation of this instance.

Usage
BiodbRequest$toString()
Returns

A single string giving a representation of this instance.


Method clone()

The objects of this class are cloneable with this method.

Usage
BiodbRequest$clone(deep = FALSE)
Arguments
deep

Whether to make a deep clone.

See Also

BiodbRequestScheduler, BiodbUrl.

Examples

# Create an instance with default settings:
mybiodb <- biodb::newInst()

# Create a request object
u <- 'https://www.ebi.ac.uk/webservices/chebi/2.0/test/getCompleteEntity'
url <- BiodbUrl$new(url=u)
url$setParam('chebiId', 15440)
request <- BiodbRequest$new(method='get', url=url)

# Send request
mybiodb$getRequestScheduler()$sendRequest(request)

# Terminate instance.
mybiodb$terminate()


pkrog/biodb documentation built on Nov. 29, 2022, 4:24 a.m.