support subscriber name field
diff --git a/xos/api/examples/add_subscriber.sh b/xos/api/examples/add_subscriber.sh
index be5331d..498a7c6 100755
--- a/xos/api/examples/add_subscriber.sh
+++ b/xos/api/examples/add_subscriber.sh
@@ -5,7 +5,7 @@
ACCOUNT_NUM=1238
DATA=$(cat <<EOF
-{"identity": {"account_num": "$ACCOUNT_NUM"},
+{"identity": {"account_num": "$ACCOUNT_NUM", "name": "test-subscriber"},
"features": {"uplink_speed": 2000000000}}
EOF
)
diff --git a/xos/api/tenant/cord/subscriber.py b/xos/api/tenant/cord/subscriber.py
index 90ccbcb..89f42b9 100644
--- a/xos/api/tenant/cord/subscriber.py
+++ b/xos/api/tenant/cord/subscriber.py
@@ -54,11 +54,13 @@
@property
def identity(self):
- return {"account_num": self.service_specific_id}
+ return {"account_num": self.service_specific_id,
+ "name": self.name}
@identity.setter
def identity(self, value):
- self.service_specific_id = value.get("account_num", "")
+ self.service_specific_id = value.get("account_num", self.service_specific_id)
+ self.name = value.get("name", self.name)
def update_identity(self, value):
d=self.identity
@@ -85,6 +87,9 @@
def save(self, *args, **kwargs):
super(CordSubscriberNew, self).save(*args, **kwargs)
+# Add some structure to the REST API by subdividing the object into
+# features, identity, and related.
+
class FeatureSerializer(serializers.Serializer):
cdn = serializers.BooleanField(required=False)
uplink_speed = serializers.IntegerField(required=False)
@@ -94,6 +99,7 @@
class IdentitySerializer(serializers.Serializer):
account_num = serializers.CharField(required=False)
+ name = serializers.CharField(required=False)
class CordSubscriberSerializer(PlusModelSerializer):
id = ReadOnlyField()