Skip to content

Commit

Permalink
Merge pull request #7 from Jordan-Prescott
Browse files Browse the repository at this point in the history
added alias to UA and fixed error
  • Loading branch information
Jordan-Prescott authored Jan 31, 2024
2 parents a33cc94 + 245a255 commit 17cbf5f
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 21 deletions.
30 changes: 15 additions & 15 deletions odins_spear/methods/put.py
Original file line number Diff line number Diff line change
Expand Up @@ -159,7 +159,7 @@ def group_call_center_agents(self, call_center_user_id: str, agent_user_ids: lis
agent_user_ids (list): List of user IDs to be added to call center.
Returns:
Dict: Dictionary
Dict: Dictionary of the new state of the CC.
"""

endpoint = f"/groups/call-centers/agents"
Expand Down Expand Up @@ -303,13 +303,13 @@ def group_call_center_stranded_calls_unavailable(self, call_center_user_id: str,
return self.requester.put(endpoint, data=updates)


def user_call_center_supervised_agents(self, call_center_user_id: str, supervisor_user_id: str, supervisor_ids: list):
def user_call_center_supervised_agents(self, call_center_user_id: str, supervisor_user_id: str, agent_ids: list):
"""Update the list of agents a supervisor has in a single Call Center (CC).
Args:
call_center_user_id (str): Service user ID of the target CC.
supervisor_user_id (str): User ID of the supervisor.
supervisor_ids (list): List of user IDs of agents to apply to supervisor.
agent_ids (list): List of user IDs of agents to apply to supervisor.
Returns:
Dict: Superivor ID and list of agents they supervise.
Expand All @@ -320,7 +320,7 @@ def user_call_center_supervised_agents(self, call_center_user_id: str, superviso
data = {
"serviceUserId": call_center_user_id,
"supervisorUserId": supervisor_user_id,
"supervisors": [{"userId": supervisor_id} for supervisor_id in supervisor_ids]
"supervisors": [{"userId": agent_id} for agent_id in agent_ids]
}

return self.requester.put(endpoint, data=data)
Expand Down Expand Up @@ -446,7 +446,7 @@ def user_call_center_agent_sign_out(self, user_id: str):
#HOTELING HOST
#HUNT GROUPS

def group_hunt_groups_status(self, service_user_ids: list, status: bool =True):
def group_hunt_groups_status(self, hunt_group_user_ids: list, status: bool =True):
"""Updates a list of Hunt Groups (HG) status to either active or inactive.
Args:
Expand All @@ -460,18 +460,18 @@ def group_hunt_groups_status(self, service_user_ids: list, status: bool =True):
endpoint = f"/groups/hunt-groups/status"

data = {
"instances": [{'serviceUserId': service_user_id, 'isActive': status}
for service_user_id in service_user_ids]
"instances": [{'serviceUserId': hunt_group_user_id, 'isActive': status}
for hunt_group_user_id in hunt_group_user_ids]
}

return self.requester.put(endpoint, data=data)


def group_hunt_group(self, service_provider_id: str, group_id, service_user_id: str, updates: dict):
def group_hunt_group(self, service_provider_id: str, group_id: str, hunt_group_user_id: str, updates: dict):
"""Update a Hunt Groups (HG) settings.
Args:
service_provider_id (str): Service provider ID of where the group that hosts the HG is located.
hunt_group_user_id (str): Service provider ID of where the group that hosts the HG is located.
group_id (_type_): Group ID of where the HG is located.
service_user_id (str): Target service user ID of the HG.
updates (dict): Updates to be applied to HG.
Expand All @@ -484,20 +484,20 @@ def group_hunt_group(self, service_provider_id: str, group_id, service_user_id:

updates["serviceProviderId"] = [service_provider_id]
updates["groupId"] = [group_id]
updates["serviceUserId"] = [service_user_id]
updates["serviceUserId"] = [hunt_group_user_id]

return self.requester.put(endpoint, data=updates)


def group_hunt_group_weighted_call_distribution(self, service_provider_id: str, group_id, service_user_id: str,
agents: dict):
def group_hunt_group_weighted_call_distribution(self, service_provider_id: str, group_id, hunt_group_user_id: str,
agents: list):
"""Update the Weighted Call Distribution (WCD) between users in a Hunt Group (HG).
Args:
service_provider_id (str): Service provider ID where the group is located.
group_id (_type_): Group ID where the HG is located.
service_user_id (str): Service user ID of the target HG.
agents (dict): Updates of WCD to be applied to HG.
hunt_group_user_id (str): Service user ID of the target HG.
agents (list): Updates of WCD to be applied to HG.
Raises:
AOInvalidWeighting: The WCD must equal 100 if it does not this error will be returned.
Expand All @@ -511,7 +511,7 @@ def group_hunt_group_weighted_call_distribution(self, service_provider_id: str,
data = {
"serviceProviderId": service_provider_id,
"groupId": group_id,
"serviceUserId": service_user_id,
"serviceUserId": hunt_group_user_id,
"agents": agents
}

Expand Down
19 changes: 13 additions & 6 deletions odins_spear/scripts/user_association.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ def main(api, service_provider_id: str, group_id: str, user_id: str):
"last_name": None,
"extension": None,
"phone_number": None,
"aliases": None,
"services": None,
"feature_packs": None,
"hunt_groups": [],
Expand All @@ -36,6 +37,7 @@ def main(api, service_provider_id: str, group_id: str, user_id: str):
USER_DATA["phone_number"] = user["phoneNumber"]
USER_DATA["services"] = user["userServices"]
USER_DATA["feature_packs"] = user["servicePacks"]
USER_DATA["aliases"] = user["aliases"]


pick_up_group = api.get.call_pickup_group_user(service_provider_id, group_id, user_id)
Expand All @@ -45,14 +47,19 @@ def main(api, service_provider_id: str, group_id: str, user_id: str):
for hg in hunt_groups:
USER_DATA["hunt_groups"].append(hg["serviceUserId"])

call_centers = api.get.user_call_center(user_id)
for cc in call_centers["callCenters"]:
USER_DATA["call_centers"].append(cc["serviceUserId"])

print(f"{user_id} Details:\n")
# if the user does not have a license for CC this call errors
try:
call_centers = api.get.user_call_center(user_id)
for cc in call_centers["callCenters"]:
USER_DATA["call_centers"].append(cc["serviceUserId"])
except Exception:
USER_DATA["call_centers"] = None


print(f"\n{user_id} Details:\n")
for key, value in USER_DATA.items():
if isinstance(value, list):
value = ', '.join(map(str, value))
elif value is None:
value = "N/A"
print(f"{key.replace('_', ' ').title()}: {value}")
print(f"{key.replace('_', ' ').title()}: {value}")

0 comments on commit 17cbf5f

Please sign in to comment.