From 89d5b0d3350340cd76a3fe043106eab1cd00053f Mon Sep 17 00:00:00 2001 From: Doug Applegate Date: Wed, 22 May 2024 12:30:15 -0600 Subject: [PATCH] add set_router_fields method --- ncm/ncm/ncm.py | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) diff --git a/ncm/ncm/ncm.py b/ncm/ncm/ncm.py index 457a9c7..b977114 100644 --- a/ncm/ncm/ncm.py +++ b/ncm/ncm/ncm.py @@ -2093,6 +2093,30 @@ def add_custom_apn(self, router_id: int, new_carrier: str, new_apn: str): result = self._return_handler(ncm.status_code, ncm.text, call_type) return result + def set_router_fields(self, router_id: int, name: str = None, description: str = None, asset_id: str = None, custom1: str = None, custom2: str = None): + """ + This method sets multiple fields for a router. + :param router_id: ID of router to update + :param name: Name/System ID to set + :param description: Description string to set + :param asset_id: Asset ID string to set + :param custom1: Custom1 field to set + :param custom2: Custom2 field to set + :return: + """ + call_type = 'Router Fields' + + put_url = '{0}/routers/{1}/'.format(self.base_url, str(router_id)) + + put_data = {} + for k,v in (('name', name), ('description', description), ('asset_id', asset_id), ('custom1', custom1), ('custom2', custom2)): + if v is not None: + put_data[k] = v + + ncm = self.session.put(put_url, data=json.dumps(put_data)) + result = self._return_handler(ncm.status_code, ncm.json(), call_type) + return result + class NcmClientv3(BaseNcmClient): """ This NCM Client class provides functions for interacting with =