summaryrefslogtreecommitdiff
path: root/inboxapp-service/app/factory/__init__.py
blob: c7f3cf32637c08516f2dc6ff68a1ac8a41720977 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
import inboxapp

class ProviderNotFoundException(Exception):
    def __init__(self, provider):
        self.provider = provider

    def __str__(self):
        return "Provider '%s' not found" % self.provider

class ClientFactory:

    @staticmethod
    def create(provider, account):
        if provider  == 'inboxapp':
            return inboxapp.Client(account)
        raise ProviderNotFoundException(provider)

class MailConverterFactory:

    @staticmethod
    def create(provider, client):
        if provider ==  'inboxapp':
            return inboxapp.MailConverter(client)
        raise ProviderNotFoundException(provider)