from .endpoints import ENDPOINTS
from .managers import Manager


class WorkflowMax:
    """An ORM-like interface to the WorkflowMax API"""

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

        for k, v in ENDPOINTS.items():
            setattr(self, v['plural'], Manager(k, credentials))

    def __repr__(self):
        return '%s:\n    %s' % (self.__class__.__name__, '\n    '.join(
            v['plural'] for v in ENDPOINTS.values()
        ))

@@ -1,12 +1,49 @@
+from .credentials import Credentials%0A
 from .endpoi
@@ -63,16 +63,16 @@
 DPOINTS%0A
-
 from .ma
@@ -207,16 +207,241 @@
 tials):%0A
+        if not isinstance(credentials, Credentials):%0A            raise TypeError(%0A                'Expected a Credentials instance, got %25s.' %25 (%0A                    type(credentials).__name__,%0A                )%0A            )%0A
         
@@ -684,16 +684,23 @@
         
+sorted(
 v%5B'plura
@@ -730,16 +730,17 @@
 values()
+)
 %0A       

Check credentials; sort repr output