Refactor code structure for improved readability and maintainability
This commit is contained in:
@@ -1,2 +1,71 @@
|
||||
def hello() -> str:
|
||||
return "Hello from bibapi!"
|
||||
from .sru import Api as _Api
|
||||
from .sru import DNBSchema, HBZSchema, HebisSchema, KOBVSchema, OEVKSchema, SWBSchema
|
||||
|
||||
__all__ = [
|
||||
"SWB",
|
||||
"DNB",
|
||||
"KOBV",
|
||||
"HEBIS",
|
||||
"OEVK",
|
||||
"HBZ",
|
||||
]
|
||||
|
||||
|
||||
class SWB(_Api):
|
||||
def __init__(self):
|
||||
self.site = SWBSchema.NAME.value
|
||||
self.url = SWBSchema.URL.value
|
||||
self.prefix = SWBSchema.ARGSCHEMA.value
|
||||
super().__init__(self.site, self.url, self.prefix)
|
||||
|
||||
|
||||
class DNB(_Api):
|
||||
def __init__(self):
|
||||
self.site = DNBSchema.NAME.value
|
||||
self.url = DNBSchema.URL.value
|
||||
self.prefix = DNBSchema.ARGSCHEMA.value
|
||||
super().__init__(self.site, self.url, self.prefix)
|
||||
|
||||
|
||||
class KOBV(_Api):
|
||||
def __init__(self):
|
||||
self.site = KOBVSchema.NAME.value
|
||||
self.url = KOBVSchema.URL.value
|
||||
self.prefix = KOBVSchema.ARGSCHEMA.value
|
||||
super().__init__(self.site, self.url, self.prefix)
|
||||
|
||||
|
||||
class HEBIS(_Api):
|
||||
def __init__(self):
|
||||
self.site = HebisSchema.NAME.value
|
||||
self.url = HebisSchema.URL.value
|
||||
self.prefix = HebisSchema.ARGSCHEMA.value
|
||||
self.replace = HebisSchema.REPLACE.value
|
||||
super().__init__(self.site, self.url, self.prefix, self.replace)
|
||||
|
||||
|
||||
class OEVK(_Api):
|
||||
def __init__(self):
|
||||
self.site = OEVKSchema.NAME.value
|
||||
self.url = OEVKSchema.URL.value
|
||||
self.prefix = OEVKSchema.ARGSCHEMA.value
|
||||
super().__init__(self.site, self.url, self.prefix)
|
||||
|
||||
|
||||
class HBZ(_Api):
|
||||
"""
|
||||
Small wrapper of the SRU API used to retrieve data from the HBZ libraries
|
||||
|
||||
All fields are available [here](https://eu04.alma.exlibrisgroup.com/view/sru/49HBZ_NETWORK?version=1.2)
|
||||
|
||||
Schema
|
||||
------
|
||||
HBZSchema: <HBZSchema>
|
||||
query prefix: alma.
|
||||
"""
|
||||
|
||||
def __init__(self):
|
||||
self.site = HBZSchema.NAME.value
|
||||
self.url = HBZSchema.URL.value
|
||||
self.prefix = HBZSchema.ARGSCHEMA.value
|
||||
super().__init__(self.site, self.url, self.prefix)
|
||||
|
||||
Reference in New Issue
Block a user