Skip to content

Commit

Permalink
minor cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
tdstein committed Oct 28, 2024
1 parent f57340d commit 72b62ac
Showing 1 changed file with 6 additions and 7 deletions.
13 changes: 6 additions & 7 deletions src/posit/connect/vanities.py
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,6 @@ def __init__(
super().__init__(params, **kwargs)
self._after_destroy = after_destroy
self._content_guid = kwargs["content_guid"]
self.__endpoint = self.params.url + f"v1/content/{self._content_guid}/vanity"

def destroy(self) -> None:
"""Destroy the vanity.
Expand All @@ -88,7 +87,8 @@ def destroy(self) -> None:
----
This action requires administrator privileges.
"""
self.params.session.delete(self.__endpoint)
endpoint = self.params.url + f"v1/content/{self._content_guid}/vanity"
self.params.session.delete(endpoint)

if self._after_destroy:
self._after_destroy()
Expand Down Expand Up @@ -125,7 +125,6 @@ class HasGuid(TypedDict):
def __init__(self, params: ResourceParameters, **kwargs: Unpack[HasGuid]):
super().__init__(params, **kwargs)
self._content_guid = kwargs["guid"]
self.__endpoint = self.params.url + f"v1/content/{self._content_guid}/vanity"
self._vanity: Optional[Vanity] = None

@property
Expand Down Expand Up @@ -214,8 +213,8 @@ def create_vanity(self, **kwargs: Unpack[CreateVanityRequest]) -> Vanity:
--------
If setting force=True, the destroy operation performed on the other vanity is irreversible.
"""
print(self.__endpoint)
response = self.params.session.put(self.__endpoint, json=kwargs)
endpoint = self.params.url + f"v1/content/{self._content_guid}/vanity"
response = self.params.session.put(endpoint, json=kwargs)
result = response.json()
return Vanity(self.params, **result)

Expand All @@ -226,7 +225,7 @@ def find_vanity(self) -> Vanity:
-------
Vanity
"""
print(self.__endpoint)
response = self.params.session.get(self.__endpoint)
endpoint = self.params.url + f"v1/content/{self._content_guid}/vanity"
response = self.params.session.get(endpoint)
result = response.json()
return Vanity(self.params, **result)

0 comments on commit 72b62ac

Please sign in to comment.