diff --git a/bin/ngcp-api-ping b/bin/ngcp-api-ping index 7bbed9c..0fb5d1a 100755 --- a/bin/ngcp-api-ping +++ b/bin/ngcp-api-ping @@ -14,8 +14,8 @@ my $opts = { }; GetOptions( $opts, - "help|h" => sub { usage() }, - "verbose", + 'help|h' => sub { usage() }, + 'verbose', ) or usage(); sub check_params { @@ -42,7 +42,7 @@ sub main { my $client = NGCP::API::Client->new(verbose => $opts->{verbose}); my $uri = '/api/domains/'; - my $res = $client->request("GET", $uri); + my $res = $client->request('GET', $uri); if (defined $res->as_hash->{total_count}) { print "API is up\n"; diff --git a/bin/ngcp-create-customer b/bin/ngcp-create-customer index 4d78883..d1f73c9 100755 --- a/bin/ngcp-create-customer +++ b/bin/ngcp-create-customer @@ -16,11 +16,11 @@ my $opts = { }; GetOptions( $opts, - "help|h" => sub { usage() }, - "billing_profile_id=i", - "contact_id=i", - "type=s", - "verbose", + 'help|h' => sub { usage() }, + 'billing_profile_id=i', + 'contact_id=i', + 'type=s', + 'verbose', ) or usage(); sub check_params { @@ -50,7 +50,7 @@ sub main { my $uri = '/api/customers/'; my %data = map { $_ => $opts->{$_} } qw(billing_profile_id contact_id type status); - my $res = $client->request("POST", $uri, \%data); + my $res = $client->request('POST', $uri, \%data); print $res->result."\n"; return !$res->is_success; diff --git a/bin/ngcp-create-domain b/bin/ngcp-create-domain index 61ffbf0..2bbf381 100755 --- a/bin/ngcp-create-domain +++ b/bin/ngcp-create-domain @@ -17,12 +17,12 @@ my $opts = { }; GetOptions( $opts, - "help|h" => sub { usage() }, - "domain=s", - "reseller_id=i", - "skip_xmpp", - "skip_sip", - "verbose", + 'help|h' => sub { usage() }, + 'domain=s', + 'reseller_id=i', + 'skip_xmpp', + 'skip_sip', + 'verbose', ) or usage(); sub check_params { @@ -58,9 +58,9 @@ sub main { my $uri = '/api/domains/'; my %data = map { $_ => $opts->{$_} } qw(reseller_id domain); foreach my $elem (qw(skip_xmpp skip_sip)) { - $data{"_" . $elem . "_reload"} = $opts->{$elem}; + $data{'_' . $elem . '_reload'} = $opts->{$elem}; } - my $res = $client->request("POST", $uri, \%data); + my $res = $client->request('POST', $uri, \%data); print $res->result."\n"; return !$res->is_success; diff --git a/bin/ngcp-create-subscriber b/bin/ngcp-create-subscriber index 051c99f..cc9a8c9 100755 --- a/bin/ngcp-create-subscriber +++ b/bin/ngcp-create-subscriber @@ -15,17 +15,17 @@ my $opts = { }; GetOptions( $opts, - "help|h" => sub { usage() }, - "customer_id=i", - "username|u=s", - "password|p=s", - "domain|d=s", - "admin|s=i", - "cc|c=i", - "ac|a=i", - "sn|n=i", - "webpassword|w=s", - "verbose", + 'help|h' => sub { usage() }, + 'customer_id=i', + 'username|u=s', + 'password|p=s', + 'domain|d=s', + 'admin|s=i', + 'cc|c=i', + 'ac|a=i', + 'sn|n=i', + 'webpassword|w=s', + 'verbose', ) or usage(); sub check_params { @@ -69,7 +69,7 @@ sub main { } else { $data{domain_id} = $tmp->{id}; } - my $res = $client->request("POST", $uri, \%data); + my $res = $client->request('POST', $uri, \%data); print $res->result."\n"; return !$res->is_success; diff --git a/bin/ngcp-credit-warning b/bin/ngcp-credit-warning index 49093f1..d907071 100755 --- a/bin/ngcp-credit-warning +++ b/bin/ngcp-credit-warning @@ -25,8 +25,8 @@ my $opts = { my $config; GetOptions( $opts, - "help|h" => sub { usage() }, - "verbose", + 'help|h' => sub { usage() }, + 'verbose', ) or usage(); sub check_params { diff --git a/bin/ngcp-delete-domain b/bin/ngcp-delete-domain index 379d25f..5af67fc 100755 --- a/bin/ngcp-delete-domain +++ b/bin/ngcp-delete-domain @@ -17,11 +17,11 @@ my $opts = { }; GetOptions( $opts, - "help|h" => sub { usage() }, - "domain=s", - "skip_xmpp", - "skip_sip", - "verbose", + 'help|h' => sub { usage() }, + 'domain=s', + 'skip_xmpp', + 'skip_sip', + 'verbose', ) or usage(); sub check_params { @@ -49,13 +49,13 @@ sub main { my $client = NGCP::API::Client->new(verbose => $opts->{verbose}); # domain_id - my $dom = $client->request("GET", "/api/domains/?domain=".$opts->{domain}); + my $dom = $client->request('GET', '/api/domains/?domain='.$opts->{domain}); if ($dom->as_hash->{total_count} != 1) { die "Domain $opts->{domain} not found\n"; } my $uri = '/api/domains/'; - my %data = map { "_".$_."_reload" => $opts->{$_} } qw(skip_xmpp skip_sip); + my %data = map { '_'.$_.'_reload' => $opts->{$_} } qw(skip_xmpp skip_sip); my $dom_id; my $tmp = $dom->as_hash->{_embedded}->{'ngcp:domains'}; if (ref $tmp eq 'ARRAY') { @@ -65,7 +65,7 @@ sub main { } die "Domain $opts->{domain} not found\n" unless $dom_id; $uri .= $dom_id; - my $res = $client->request("DELETE", $uri, \%data); + my $res = $client->request('DELETE', $uri, \%data); print $res->result."\n"; return !$res->is_success; diff --git a/bin/ngcp-fraud-notifier b/bin/ngcp-fraud-notifier index de33e7e..cdb2a9d 100755 --- a/bin/ngcp-fraud-notifier +++ b/bin/ngcp-fraud-notifier @@ -18,9 +18,9 @@ use File::Pid; Readonly my @required => qw(); Readonly my $config_file => '/etc/ngcp-panel/provisioning.conf'; -my $PROGRAM_BASE = "ngcp-fraud-notifier"; +my $PROGRAM_BASE = 'ngcp-fraud-notifier'; my $retcode = 0; -my $piddir = "/run/ngcp-fraud-notifier"; +my $piddir = '/run/ngcp-fraud-notifier'; my $pidfile = "$piddir/ngcp-fraud-notifier.pid"; my $pf = File::Pid->new({ file => $pidfile }); @@ -38,8 +38,8 @@ my $opts = { my $config; GetOptions( $opts, - "help|h" => sub { usage() }, - "verbose", + 'help|h' => sub { usage() }, + 'verbose', ) or usage(); sub DESTROY { @@ -190,7 +190,7 @@ sub update_notify_status { { op => 'replace', path => '/notified_at', value => $now } ]; - my $res = $client->request("PATCH", $uri, $data); + my $res = $client->request('PATCH', $uri, $data); return; } diff --git a/bin/ngcp-get-customer b/bin/ngcp-get-customer index df1ba88..6f6f546 100755 --- a/bin/ngcp-get-customer +++ b/bin/ngcp-get-customer @@ -14,9 +14,9 @@ my $opts = { }; GetOptions( $opts, - "help|h" => sub { usage() }, - "customer_id=i", - "verbose", + 'help|h' => sub { usage() }, + 'customer_id=i', + 'verbose', ) or usage(); sub check_params { @@ -45,7 +45,7 @@ sub main { my $uri = '/api/customers/'; $uri .= $opts->{customer_id} ? $opts->{customer_id} : ''; - my $res = $client->request("GET", $uri); + my $res = $client->request('GET', $uri); $res->is_success ? print $res->decoded_content."\n" : print $res->result."\n"; diff --git a/bin/ngcp-sound-set b/bin/ngcp-sound-set index b242a77..9b0b643 100755 --- a/bin/ngcp-sound-set +++ b/bin/ngcp-sound-set @@ -14,9 +14,9 @@ my $opts = { }; GetOptions( $opts, - "help|h" => sub { usage() }, - "id=i", - "verbose", + 'help|h' => sub { usage() }, + 'id=i', + 'verbose', ) or usage(); sub check_params { @@ -45,7 +45,7 @@ sub main { my $uri = '/api/soundsets/'; $uri .= $opts->{id} ? $opts->{id} : ''; - my $res = $client->request("GET", $uri); + my $res = $client->request('GET', $uri); $res->is_success ? print $res->content."\n" : print $res->result."\n"; diff --git a/bin/ngcp-terminate-customer b/bin/ngcp-terminate-customer index 9118c3a..fc1d1c5 100755 --- a/bin/ngcp-terminate-customer +++ b/bin/ngcp-terminate-customer @@ -14,9 +14,9 @@ my $opts = { }; GetOptions( $opts, - "help|h" => sub { usage() }, - "customer_id=i", - "verbose", + 'help|h' => sub { usage() }, + 'customer_id=i', + 'verbose', ) or usage(); sub check_params { @@ -47,7 +47,7 @@ sub main { my $data = [ { op => 'replace', path => '/status', value => 'terminated' } ]; - my $res = $client->request("PATCH", $uri, $data); + my $res = $client->request('PATCH', $uri, $data); print $res->result."\n"; return !$res->is_success; diff --git a/bin/ngcp-terminate-subscriber b/bin/ngcp-terminate-subscriber index 20c122e..e0d59d1 100755 --- a/bin/ngcp-terminate-subscriber +++ b/bin/ngcp-terminate-subscriber @@ -14,10 +14,10 @@ my $opts = { }; GetOptions( $opts, - "help|h" => sub { usage() }, - "username=s", - "domain=s", - "verbose", + 'help|h' => sub { usage() }, + 'username=s', + 'domain=s', + 'verbose', ) or usage(); sub check_params { @@ -46,7 +46,8 @@ sub main { my $uri = sprintf '/api/subscribers/?username=%s&domain=%s', @{$opts}{qw(username domain)}; - my $sub = $client->request("GET", $uri); + my $sub = $client->request('GET', $uri); + my $sub_id; if ($sub->as_hash->{total_count} == 1) { my $tmp = $sub->as_hash->{_embedded}->{'ngcp:subscribers'}; @@ -63,7 +64,7 @@ sub main { my $data = [ { op => 'replace', path => '/status', value => 'terminated' } ]; - my $res = $client->request("PATCH", $uri, $data); + my $res = $client->request('PATCH', $uri, $data); print $res->result."\n"; return !$res->is_success; diff --git a/lib/NGCP/API/Client.pm b/lib/NGCP/API/Client.pm index ba7ccfe..9fe3a8d 100644 --- a/lib/NGCP/API/Client.pm +++ b/lib/NGCP/API/Client.pm @@ -237,7 +237,7 @@ sub result { $content = $self->content; } - return sprintf "%s %s", $self->status_line, $content; + return sprintf '%s %s', $self->status_line, $content; } 1; @@ -305,7 +305,7 @@ The version is compatible with NGCP platforms version >= mr4.3.x value => 5, }, ]; - my $res = $client->request("PATCH", $uri, $data); + my $res = $client->request('PATCH', $uri, $data); # DELETE (remove)