R/batch.R

Defines functions lds_get_batches lds_get_combined_batches lds_post_batches lds_put_batches lds_delete_batches

Documented in lds_delete_batches lds_get_batches lds_get_combined_batches lds_post_batches lds_put_batches

#' Get information about areas
#' @export
lds_get_batches <- function(...) {
  
  lds_call("batches", "GET", query = ...)
  
}

#' Get combined batches
lds_get_combined_batches <- function(...) {
  
  lds_call("combined_batches", "GET", query = ...)
  
}

#' Create areas
#' @export
lds_post_batches <- function(type, global_area_id, global_strain_id, origin = NA, num_plants = NA, plant_stage = NA, 
                             harvested_at = NA, harvested_end_at = NA, harvest_stage = NA, qty_cure = NA, flower_dry_weight = NA,
                             waste = NA, other_dry_weight = NA, flower_wet_weight = NA, other_wet_weight = NA) {
  
  lds_call("batches", "POST", body = list(
    batch = data.frame(type, global_area_id, global_strain_id, origin, num_plants, plant_stage, 
                       harvested_at, harvested_end_at, harvest_stage, qty_cure, flower_dry_weight,
                       waste, other_dry_weight, flower_wet_weight, other_wet_weight)
  ))
  
}

#' Update area
#' @export
lds_put_batches <- function(global_id, ...) {
  
  lds_call("batches", "PUT", body = list(
    batch = list(batch = data.frame(global_id, ...))
  ))
  
}

#' Delete area
#' @export
lds_delete_batches <- function(global_id) {
  
  lds_call("batches", "DELETE", global_id = global_id)
  
}
CannaData/CannaLeafDataSystems documentation built on May 17, 2019, 8:03 a.m.