pachadotdev / analogsea

Digital Ocean R client
https://pacha.dev/analogsea/
Apache License 2.0
154 stars 24 forks source link

Have droplets take in and emit droplet objects - facilitate chaining #10

Closed sckott closed 10 years ago

sckott commented 10 years ago

Hadley said:

I'd make them start with droplet_ and take a droplet as first argument. e.g. do_droplets_power_on would become:

droplet_power_on <- function(droplet, ...) {
  path <- sprintf('droplets/%s/power_on', droplet$id)
  do_GET(path, ...)
}

and

To make the droplets functions even more useful, they should always return a droplet object. Then you could use %>% to pipe multiple operations together.

  • [x] Take in and emit droplet objects. Perhaps make new droplet S3 class. Also, some fxns may not fit this model, like droplet_new() may not make sense to take in a droplet, since one needs to be created.
  • [x] Make sure piping with %>% is possible with droplet functions and objects