From 1f9e4073776259a465fa19fb48b400ec9114ff5f Mon Sep 17 00:00:00 2001
From: Andreas Granig
Date: Thu, 6 Feb 2014 13:24:01 +0100
Subject: [PATCH] MT#3925 API: more doc and description fixes.
---
lib/NGCP/Panel/Controller/API/Root.pm | 5 +-
lib/NGCP/Panel/Form/Subscriber.pm | 2 +-
.../Panel/Form/Subscriber/SubscriberAPI.pm | 2 +-
.../js/api/links/customercontacts-item.json | 7 --
.../js/api/properties/contracts-item.json | 14 ---
.../subscriberpreferences-item.json | 102 ------------------
.../api/properties/systemcontacts-item.json | 18 ----
share/templates/api/root/collection.tt | 4 +-
8 files changed, 8 insertions(+), 146 deletions(-)
delete mode 100644 share/static/js/api/links/customercontacts-item.json
delete mode 100644 share/static/js/api/properties/contracts-item.json
delete mode 100644 share/static/js/api/properties/subscriberpreferences-item.json
delete mode 100644 share/static/js/api/properties/systemcontacts-item.json
diff --git a/lib/NGCP/Panel/Controller/API/Root.pm b/lib/NGCP/Panel/Controller/API/Root.pm
index b7b8b629be..e6079e1b06 100644
--- a/lib/NGCP/Panel/Controller/API/Root.pm
+++ b/lib/NGCP/Panel/Controller/API/Root.pm
@@ -159,6 +159,9 @@ sub field_to_json : Private {
when(/\+NGCP::Panel::Field::EmailList/) {
return "String";
}
+ when(/\+NGCP::Panel::Field::Identifier/) {
+ return "String";
+ }
when(/\+NGCP::Panel::Field::SubscriberStatusSelect/) {
return "String";
}
@@ -200,7 +203,7 @@ sub get_collection_properties {
$name = 'primary_number';
} elsif($f->type =~ /AliasNumber/) {
$name = 'alias_numbers';
- } elsif($f->type !~ /Regex|EmailList|SubscriberStatusSelect|SubscriberLockSelect/) {
+ } elsif($f->type !~ /Regex|EmailList|SubscriberStatusSelect|SubscriberLockSelect|Identifier/) {
$name .= '_id';
}
}
diff --git a/lib/NGCP/Panel/Form/Subscriber.pm b/lib/NGCP/Panel/Form/Subscriber.pm
index 70f26d4073..c562382c9c 100644
--- a/lib/NGCP/Panel/Form/Subscriber.pm
+++ b/lib/NGCP/Panel/Form/Subscriber.pm
@@ -56,7 +56,7 @@ has_field 'e164' => (
do_wrapper => 1,
element_attr => {
rel => ['tooltip'],
- title => ['The main E.164 number used for inbound and outbound calls.']
+ title => ['The main E.164 number (containing a cc, ac and sn attribute) used for inbound and outbound calls.']
},
);
diff --git a/lib/NGCP/Panel/Form/Subscriber/SubscriberAPI.pm b/lib/NGCP/Panel/Form/Subscriber/SubscriberAPI.pm
index 72db4dac4c..888f6667e4 100644
--- a/lib/NGCP/Panel/Form/Subscriber/SubscriberAPI.pm
+++ b/lib/NGCP/Panel/Form/Subscriber/SubscriberAPI.pm
@@ -26,7 +26,7 @@ has_field 'alias_numbers' => (
wrapper_class => [qw/hfh-rep/],
element_attr => {
rel => ['tooltip'],
- title => ['Additional E.164 numbers mapped to this subscriber for inbound calls.']
+ title => ['Additional E.164 numbers (each containing a cc, ac and sn attribute) mapped to this subscriber for inbound calls.']
},
);
diff --git a/share/static/js/api/links/customercontacts-item.json b/share/static/js/api/links/customercontacts-item.json
deleted file mode 100644
index 87c349b539..0000000000
--- a/share/static/js/api/links/customercontacts-item.json
+++ /dev/null
@@ -1,7 +0,0 @@
-{
- "_links" : {
- "ngcp:resellers": {
- "href": "/api/resellers/?id={id}"
- }
- }
-}
diff --git a/share/static/js/api/properties/contracts-item.json b/share/static/js/api/properties/contracts-item.json
deleted file mode 100644
index 741f573cb5..0000000000
--- a/share/static/js/api/properties/contracts-item.json
+++ /dev/null
@@ -1,14 +0,0 @@
-{
- "$schema": "http://json-schema.org/draft-04/schema#",
- "description": "A billing container for a reseller or peering",
- "required": ["external_id", "status", "type", "billing_profile_id", "contact_id"],
- "properties": {
- "status": { "enum": ["active", "locked", "pending", "terminated"], "description": "The operational status of the contract" }
- "type": { "enum": ["reseller", "sippeering"], "description": "The type of the contract" }
- "contact_id": { "type": "number", "description": "The ID of the 'ngcp:systemcontacts' item this contract belongs to" },
- "billing_profile_id": { "type": "number", "description": "The ID of the 'ngcp:billingprofiles' item this contract uses" },
- "external_id": { "type": ["null", "string"], "description": "An external ID e.g. to identify the contract in a 3rd party system" },
- },
- "title": "contract",
- "type": "object"
-}
diff --git a/share/static/js/api/properties/subscriberpreferences-item.json b/share/static/js/api/properties/subscriberpreferences-item.json
deleted file mode 100644
index 76fcfc57bb..0000000000
--- a/share/static/js/api/properties/subscriberpreferences-item.json
+++ /dev/null
@@ -1,102 +0,0 @@
-{
- "$schema": "http://json-schema.org/draft-04/schema#",
- "description": "user preferences for a subscriber",
- "required": [],
- "properties": {
- "attribute": { "type": "string", "description": "The preference name." },
- "value": { "type": "string", "description": "The preference name." },
- },
- "title": "subscriberpreference",
- "type": "object"
-}
-
-[% #
-GET /api/subscriberpreferences/?subscriber_id=10
-
-[
- "cli": "12345",
- "block_in_list": [ "12345", "12346", "12347" ]
-]
-
-POST /api/subscriberpreferences/?subscriber_id=10
-[
- "cli": "12345",
- "block_in_list": [ "12345", "12346", "12347" ]
-]
-
-GET /api/subscribers/?id=77
-
-{
- "username": "foo",
-
- "_links": [
- "callforwards": {
- "href": "/api/callforwards/?subscriber_id=987"
- },
-
- "cf_destinationsets": {
- "href": "/api/destinationsets/?subscriber_id=987"
- }
- ],
-}
-
-GET /api/callforwards/?subscriber_id=77
-
-{
-
- # should be separated by cf types
- "_links": [
- "cfu": {
- "href": "/api/callforwards/?id=555"
- }
- "cfb": {
- "href": "/api/callforwards/?id=556"
- }
- ]
-}
-
-GET /api/callforwards/?id=555
-
-{
- "_links": [
- "destinationset": {
- "href": "/api/cf_destinationsets/?id=555"
- },
- "timeset": {
- "href": "/api/cf_timesets/?id=556"
- },
- ]
-}
-
-
-
-
-GET /api/destinationsets/?subscriber_id=77
-
-PATCH /api/subscribers/?id=77
-
-[
- { "op":
-
-]
-
-
-$res = $ua->get("/api/subscribers/?id=77")->from_json;
-$cf = $res->{_links}->{callforwards}; # "/api/callforwards/?subscriber_id=77
-$dsets = $res->{_links}->{cf_destinationsets}; # "/api/cf_destinationsets/?subscriber_id=77
-$res = $ua->get($cf->{href})->from_json;
-$cfu = $res->{_links}->{cfu}; # /api/callforwards/?id=555
-if($cfu) {
- $res = $ua->get($cfu)->from_json;
- $res = $ua->get($res->{_links}->{collection}->{href})->from_json;
- $dset = $res->{_links}->{destinationsets}->[0];
-
- $ua->put($cfu->{href}, "{ \"_links\": [ \"destinationset\": { \"href\": \"$dset->{href}\" }, \"timeset\": null] }");
-} else {
- $res = $ua->get($dsets->{href})->from_json;
- $dset = $res->{_links}->{destinationsets}->[0];
-
- $ua->put($cf->{href}, "{ \"_links\": [ \"destinationset\": { \"href\": \"$dset->{href}\" }, \"timeset\": null] }");
-}
-
--%]
diff --git a/share/static/js/api/properties/systemcontacts-item.json b/share/static/js/api/properties/systemcontacts-item.json
deleted file mode 100644
index dad7de4272..0000000000
--- a/share/static/js/api/properties/systemcontacts-item.json
+++ /dev/null
@@ -1,18 +0,0 @@
-{
- "$schema": "http://json-schema.org/draft-04/schema#",
- "description": "Contact information for a reseller or peering contract",
- "required": ["city", "company", "country", "email", "firstname", "lastname", "phonenumber", "postcode", "street"],
- "properties": {
- "city": { "type": ["null", "string"], "description": "The contact's city." },
- "company": { "type": ["null", "string"], "description": "The contact's company." },
- "country": { "type": ["null", "string"], "description": "The contact's country (ISO-3166, e.g. \"AT\" for Austria, \"DE\" for Germany)." },
- "email": { "type": "string", "format": "email", "description": "The contact's e-mail address." },
- "firstname": { "type": "string", "description": "The contact's given name." },
- "lastname": { "type": "string", "description": "The contact's family name." },
- "phonenumber": { "type": ["null", "string"], "description": "E.164 number. The contact's officephone number." },
- "postcode": { "type": ["null", "string"], "description": "The contact's postal routing code." },
- "street": { "type": ["null", "string"], "description": "The contact's street address." }
- },
- "title": "systemcontact",
- "type": "object"
-}
diff --git a/share/templates/api/root/collection.tt b/share/templates/api/root/collection.tt
index 360d609e28..becf930dc5 100644
--- a/share/templates/api/root/collection.tt
+++ b/share/templates/api/root/collection.tt
@@ -52,7 +52,7 @@ Accept-Post: application/hal+json; profile="http://purl.org/sipwise/ngcp-api/#re
To define the page number and the rows per page to return, you can pass the parameters page and rows. Default values are page=1 and rows=10, if you do not provide them.
[%
- cmd = 'curl -i -X GET -H \'Connection: close\' --cert NGCP-API-client-certificate.pem --cacert ca-cert.pem \'https://example.org:1443/api/' _ id _ '/?page=1&rows=2\'';
+ cmd = 'curl -i -X GET -H \'Connection: close\' --cert NGCP-API-client-certificate.pem --cacert ca-cert.pem \'https://example.org:1443/api/' _ id _ '/?page=1&rows=1\'';
INCLUDE helpers/api_command.tt cmd=cmd level=level+3;
props = ' "id" : 1';
@@ -311,7 +311,7 @@ Preference-Applied: return=minimal';
-%]
-Update specific fields of an existing systemcontacts item
+Update specific fields of an existing [% id %] item
[%
props = ''; rem = 0; rep = 0;