Skip to content

Commit

Permalink
refactor: name of the adapter class
Browse files Browse the repository at this point in the history
  • Loading branch information
devraj committed May 28, 2024
1 parent d96f9c8 commit 0dcc5e7
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 96 deletions.
16 changes: 8 additions & 8 deletions gallagher/ext/shillelagh/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@

# TODO: get rid of this
from gallagher.cc.cardholders import Cardholder
class GallagherCommandCentreAPI(Adapter):
class CCAPIAdapter(Adapter):

# Use this to log messages to assist with shillelagh debugging
_logger = logging.getLogger(__name__)
Expand Down Expand Up @@ -83,7 +83,7 @@ def get_endpoint_urls() -> list[str]:
#NOTE: this is a method because we need bootstrap to run first
return [
f"{table.__config__.endpoint.href}" for table \
in GallagherCommandCentreAPI._all_tables
in CCAPIAdapter._all_tables
]


Expand All @@ -104,7 +104,7 @@ def bootstrap_api_client():
api_key = os.environ.get('GACC_API_KEY')
cc.api_key = api_key

for table in GallagherCommandCentreAPI._all_tables:
for table in CCAPIAdapter._all_tables:
# This should get us the url, and if not then we are in an invalid state
# Discover should only ever run for the first endpoint and all
# others should then deffer to the cached property
Expand All @@ -124,11 +124,11 @@ def supports(uri: str, fast: bool = True, **kwargs: Any) -> Optional[bool]:
Because we share the cc object across multiple methods, it available
outside the scope of this method
"""
GallagherCommandCentreAPI.bootstrap_api_client()
if not uri in GallagherCommandCentreAPI.get_endpoint_urls():
GallagherCommandCentreAPI._logger.debug(
f"{uri} not found in {GallagherCommandCentreAPI.get_endpoint_urls()}"
CCAPIAdapter.bootstrap_api_client()

if not uri in CCAPIAdapter.get_endpoint_urls():
CCAPIAdapter._logger.debug(
f"{uri} not found in {CCAPIAdapter.get_endpoint_urls()}"
)
return False

Expand Down
87 changes: 0 additions & 87 deletions gallagher/ext/shillelagh/vtables.py

This file was deleted.

2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -95,4 +95,4 @@ build-backend = "poetry.core.masonry.api"


[tool.poetry.plugins."shillelagh.adapter"]
gacc = "gallagher.ext.shillelagh:GallagherCommandCentreAPI"
gacc = "gallagher.ext.shillelagh:CCAPIAdapter"

0 comments on commit 0dcc5e7

Please sign in to comment.