Skip to content

Commit

Permalink
Remove old RBDigital integration code. (#16)
Browse files Browse the repository at this point in the history
* Remove old RBDigital integration code.
* Add migration to remove RBD data from database.
  • Loading branch information
jonathangreen authored Jul 30, 2021
1 parent d0076ec commit b0e0706
Show file tree
Hide file tree
Showing 57 changed files with 54 additions and 13,545 deletions.
2 changes: 0 additions & 2 deletions api/admin/controller/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,6 @@
from api.opds_for_distributors import OPDSForDistributorsAPI
from api.overdrive import OverdriveAPI
from api.proquest.importer import ProQuestOPDS2Importer
from api.rbdigital import RBDigitalAPI
from core.app_server import (
load_pagination_from_request,
)
Expand Down Expand Up @@ -1315,7 +1314,6 @@ class SettingsController(AdminCirculationManagerController):
OdiloAPI,
BibliothecaAPI,
Axis360API,
RBDigitalAPI,
EnkiAPI,
ODLAPI,
ODL2API,
Expand Down
4 changes: 1 addition & 3 deletions api/circulation.py
Original file line number Diff line number Diff line change
Expand Up @@ -333,7 +333,7 @@ def __repr__(self):
class HoldInfo(CirculationInfo):
"""A record of a hold.
:param identifier_type: Ex. Identifier.RBDIGITAL_ID.
:param identifier_type: Ex. Identifier.BIBLIOTHECA_ID.
:param identifier: Expected to be the unicode string of the isbn, etc.
:param start_date: When the patron made the reservation.
:param end_date: When reserved book is expected to become available.
Expand Down Expand Up @@ -433,7 +433,6 @@ def default_api_map(self):
from .odilo import OdiloAPI
from .bibliotheca import BibliothecaAPI
from .axis import Axis360API
from .rbdigital import RBDigitalAPI
from .enki import EnkiAPI
from .opds_for_distributors import OPDSForDistributorsAPI
from .odl import ODLAPI, SharedODLAPI
Expand All @@ -446,7 +445,6 @@ def default_api_map(self):
ExternalIntegration.ODILO : OdiloAPI,
ExternalIntegration.BIBLIOTHECA : BibliothecaAPI,
ExternalIntegration.AXIS_360 : Axis360API,
ExternalIntegration.ONE_CLICK : RBDigitalAPI,
EnkiAPI.ENKI_EXTERNAL : EnkiAPI,
OPDSForDistributorsAPI.NAME: OPDSForDistributorsAPI,
ODLAPI.NAME: ODLAPI,
Expand Down
30 changes: 0 additions & 30 deletions api/controller.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,10 +30,6 @@
AnnotationWriter,
AnnotationParser,
)
from api.rbdigital import (
RBDigitalFulfillmentProxy,
RBDProxyException,
)
from api.saml.controller import SAMLController
from .authenticator import (
Authenticator,
Expand Down Expand Up @@ -430,7 +426,6 @@ def setup_one_time_controllers(self):
self.odl_notification_controller = ODLNotificationController(self)
self.shared_collection_controller = SharedCollectionController(self)
self.static_files = StaticFileController(self)
self.rbdproxy = RBDFulfillmentProxyController(self)

from api.lcp.controller import LCPController
self.lcp_controller = LCPController(self)
Expand Down Expand Up @@ -2476,28 +2471,3 @@ def static_file(self, directory, filename):
def image(self, filename):
directory = os.path.join(os.path.abspath(os.path.dirname(__file__)), "..", "resources", "images")
return self.static_file(directory, filename)

class RBDFulfillmentProxyController(CirculationManagerController):

def __init__(self, *args, **kwargs):
super(RBDFulfillmentProxyController, self).__init__(*args, **kwargs)
self.log = logging.getLogger("RBDigital fulfillment proxy")

def proxy(self, bearer, api_class=None):
# This method expects a proxy URL with a "url" query parameter.
# It returns a Flask response.
fulfillment_url = flask.request.values.get('url', None)

try:
response = RBDigitalFulfillmentProxy.proxy(self._db, bearer, fulfillment_url,
api_class=api_class)
except RBDProxyException as e:
status = e.args[0].get('status', 500)
message = e.args[0].get('message', 'unspecified error')
self.log.error('RBDProxyException: {} {}'.format(status, message))
response = Response(
response=json.dumps({"message": message}),
status=status, content_type='application/json;charset=UTF-8',
)

return response
6 changes: 1 addition & 5 deletions api/metadata_wrangler.py
Original file line number Diff line number Diff line change
Expand Up @@ -322,7 +322,6 @@ class BaseMetadataWranglerCoverageProvider(OPDSImportCoverageProvider):
Identifier.OVERDRIVE_ID,
Identifier.BIBLIOTHECA_ID,
Identifier.AXIS_360_ID,
Identifier.RB_DIGITAL_ID,
Identifier.URI,
]

Expand Down Expand Up @@ -352,10 +351,7 @@ def create_identifier_mapping(self, batch):
"""
mapping = dict()
for identifier in batch:
if identifier.type in [
Identifier.AXIS_360_ID, Identifier.BIBLIOTHECA_ID,
Identifier.RB_DIGITAL_ID
]:
if identifier.type in [Identifier.AXIS_360_ID, Identifier.BIBLIOTHECA_ID]:
for e in identifier.equivalencies:
if e.output.type == Identifier.ISBN:
mapping[e.output] = identifier
Expand Down
Loading

0 comments on commit b0e0706

Please sign in to comment.