fkoh111 / zzlite

Lite wrapper for the Zamzar API :package:
0 stars 0 forks source link

feature/utils #3

Closed fkoh111 closed 4 years ago

fkoh111 commented 4 years ago

Make a proper object with build urls, methods, decent printing etc. for auxiliary object in utils.R

fkoh111 commented 4 years ago

As an s3 object that are the being instatiated in every function body

fkoh111 commented 4 years ago

A proposal is something like this:

.zz_endpoints <- function() {
  prod <- list(
    post <- c("https://api.zamzar.com/v1/jobs"),
    get <- c("https://api.zamzar.com/v1/files/")
  )

  dev <- list (
    post <- c("https://sandbox.zamzar.com/v1/jobs"),
    get <- c("https://sandbox.zamzar.com/v1/files/")
  )

  format <- list(
    format <- c("https://sandbox.zamzar.com/v1/formats")
  )

  conf <- list(prod = prod, dev = dev, format = format)

  invisible(structure(conf, class = "zz_config"))

}

endpoints <- zz_endpoints()
endpoints$prod[[1]]
endpoints$prod[[2]]
endpoints$dev[[1]]
endpoints$dev[[2]]
endpoints$format[[1]]