diff options
author | tv <tv@shackspace.de> | 2015-05-20 20:32:56 +0200 |
---|---|---|
committer | tv <tv@shackspace.de> | 2015-05-20 20:32:56 +0200 |
commit | ed3b209130b6f941dcc1ac5142c0ef802255ce60 (patch) | |
tree | 516c2cc209b853cb54e0f2a54855bc183fa8e032 | |
parent | 223db8286233fa8bd77f546c6f3200877ed2512b (diff) |
lib/cac.sh: _cac_{use curl in {get,post}}_api_v1
-rw-r--r-- | lib/cac.sh | 28 |
1 files changed, 12 insertions, 16 deletions
diff --git a/lib/cac.sh b/lib/cac.sh index d2108d360..5e3f4ec70 100644 --- a/lib/cac.sh +++ b/lib/cac.sh @@ -8,26 +8,22 @@ _cac_exec() { fi } +_cac_curl_api_v1() { + _cac_exec curl -fsS "$1" "https://panel.cloudatcost.com/api/v1/$2.php" $( + shift 2 + set -- "$@" login="$cac_login" key="$cac_key" + for arg; do + echo -d $(printf '%s' "$arg" | url_encode) + done + ) +} + _cac_get_api_v1() { - _cac_exec curl -fsS \ - $(shift - set -- "$@" login="$cac_login" key="$cac_key" - for arg; do - echo -d $(printf '%s' "$arg" | url_encode) - done - ) \ - -G "https://panel.cloudatcost.com/api/v1/$1.php" + _cac_curl_api_v1 -G "$@" } _cac_post_api_v1() { - _cac_exec curl -fsS \ - $(shift - set -- "$@" login="$cac_login" key="$cac_key" - for arg; do - echo -d $(printf '%s' "$arg" | url_encode) - done - ) \ - -X POST "https://panel.cloudatcost.com/api/v1/$1.php" + _cac_curl_api_v1 -XPOST "$@" } cac_listservers() { |