# Path: suma/common/resources/base.py
# class ResourceWrapper(dict):
#     def __init__(self, resource):
#         self.resource = resource
# 
#     def unwrap(self):
#         return self.resource


from suma.common.resources.base import ResourceWrapper


class LinkFactory(object):

    def __init__(self, request):
        self.request = request

    def __getitem__(self, key):
        svc = self.request.find_service(name='link')
        link = svc.get_link_by_id_or_hashid(key)
        if link:

# Path: suma/common/resources/base.py
# class ResourceWrapper(dict):
#     def __init__(self, resource):
#         self.resource = resource
# 
#     def unwrap(self):
#         return self.resource


# Path: suma/api/resources.py
from suma.common.resources.base import ResourceWrapper



class LinkFactory(object):

    def __init__(self, request):
        self.request = request

    def __getitem__(self, key):
        svc = self.request.find_service(name='link')
        link = svc.get_link_by_id_or_hashid(key)
        if link:

            return LinkResource(link)