Skip to content

Commit

Permalink
chore: refactor numbers endpoint
Browse files Browse the repository at this point in the history
  • Loading branch information
matsk-sinch committed Feb 4, 2025
1 parent c616641 commit 8281d46
Showing 1 changed file with 5 additions and 9 deletions.
14 changes: 5 additions & 9 deletions sinch/domains/numbers/endpoints/numbers_endpoint.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,15 +31,11 @@ def build_url(self, sinch) -> str:
if not self.ENDPOINT_URL:
raise NotImplementedError("ENDPOINT_URL must be defined in the subclass.")

placeholders = {
"origin": sinch.configuration.numbers_origin,
"project_id": self.project_id,
}

if "phone_number" in self.ENDPOINT_URL and hasattr(self.request_data, "phone_number"):
placeholders["phone_number"] = self.request_data.phone_number

return self.ENDPOINT_URL.format(**placeholders)
return self.ENDPOINT_URL.format(
origin=sinch.configuration.numbers_origin,
project_id=self.project_id,
**vars(self.request_data)
)

def request_body(self):
"""
Expand Down

0 comments on commit 8281d46

Please sign in to comment.