R/rate_task.R

Defines functions approve_task reject_task

Documented in approve_task reject_task

approve_task <- function(campaign, task, comment, type = "basic", key = getOption("microworkers_key")) {
    if(inherits(campaign, "mw_campaign"))
        campaign <- campaign$campaign_id
    if(inherits(task, "mw_task"))
        task <- task$task_id
    a <- paste0("?id_task=", task, "&rating=OK")
    mwPUT(path = paste0("/campaign_", .ctype(type), "/rate_task/", campaign, a), key = key)
}

reject_task <- function(campaign, task, comment, type = "basic", key = getOption("microworkers_key")) {
    if(inherits(campaign, "mw_campaign"))
        campaign <- campaign$campaign_id
    if(inherits(task, "mw_task"))
        task <- task$task_id
    if(missing(comment))
        stop("'comment' is required for task rejection")
    a <- paste0("?id_task=", task, "&rating=NOK")
    mwPUT(path = paste0("/campaign_", .ctype(type), "/rate_task/", campaign, a), key = key)
}
cloudyr/microworkers documentation built on May 13, 2019, 8:21 p.m.