Skip to content

Commit

Permalink
add set_router_fields method
Browse files Browse the repository at this point in the history
  • Loading branch information
dapplegatecp committed May 22, 2024
1 parent ba30f8c commit 89d5b0d
Showing 1 changed file with 24 additions and 0 deletions.
24 changes: 24 additions & 0 deletions ncm/ncm/ncm.py
Original file line number Diff line number Diff line change
Expand Up @@ -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 =
Expand Down

0 comments on commit 89d5b0d

Please sign in to comment.