]> git.nbdom.net Git - nb.git/commitdiff
ovh-api
authorNicolas Boisselier <nicolas.boisselier@gmail.com>
Wed, 14 Dec 2016 11:39:10 +0000 (12:39 +0100)
committerNicolas Boisselier <nicolas.boisselier@gmail.com>
Wed, 14 Dec 2016 11:39:10 +0000 (12:39 +0100)
bin/ovh-api

index b4c3ff0b92405aad66a96dc9e2a6f17cc2ba9662..22b4f1d6a62526e43845a4152cc81b3559a22a2e 100755 (executable)
@@ -32,7 +32,6 @@ my %Opt = (
   'method' => 'GET',
 );
 get_options(\%Opt);
-$main::_DATA_ = undef;
 # Auth
 if ($_ = $Opt{activate}) {
   exec qq|curl -s -XPOST -H"X-Ovh-Application: $_" -H "Content-type: application/json" https://eu.api.ovh.com/1.0/auth/credential  -d '{"accessRules": [ { "method": "GET", "path": "/*" } ] }'|.'|jq .';
@@ -40,7 +39,7 @@ if ($_ = $Opt{activate}) {
   #exec("curl","-XPOST",'-H',"X-Ovh-Application: $_",'-H','Content-type: application/json','https://eu.api.ovh.com/1.0/auth/credential','-d',qq|'{"accessRules": [ { "method": "GET", "path": "/*" } ],"redirection":"https://www.mywebsite.com/" }'|);
   exit 0;
 }
-help() unless @ARGV;
+$main::_DATA_ = '';
 
 
 #################################################################################
@@ -66,7 +65,7 @@ if (@ARGV and $ARGV[0] =~ /^(\w+):(\w+):(\w+)$/) {
 }
 
 @KEY or help();
-die map{"$_\n"} @KEY;
+help() unless @ARGV;
 my $o = OvhApi->new(type => OvhApi::OVH_API_EU, applicationKey => $KEY[0], applicationSecret => $KEY[1], consumerKey => $KEY[2]);
 
 my $URL = shift @ARGV or help();