diff --git a/HISTORY.rst b/HISTORY.rst index b125f32..eb48d91 100755 --- a/HISTORY.rst +++ b/HISTORY.rst @@ -6,3 +6,8 @@ History ------------------ * First release on PyPI. + +0.1.5 +-------------------- + +* Resource keys is now a kwarg on instantiation diff --git a/docs/usage.rst b/docs/usage.rst index 33d188d..387390a 100644 --- a/docs/usage.rst +++ b/docs/usage.rst @@ -18,8 +18,7 @@ persons.py:: persons = eve_resource.Resource( 'persons', # resource name, to register with the app. - - 'first_name', 'last_name' # keys for resource fields. + keys=('first_name', 'last_name') # keys for resource fields. ) @persons.schema diff --git a/eve_resource/__init__.py b/eve_resource/__init__.py index d816d6e..92f3541 100644 --- a/eve_resource/__init__.py +++ b/eve_resource/__init__.py @@ -9,7 +9,7 @@ __author__ = 'Michael Housh' __email__ = 'mhoush@houshhomeenergy.com' -__version__ = '0.1.4' +__version__ = '0.1.5' __all__ = [ # exceptions diff --git a/eve_resource/resource.py b/eve_resource/resource.py index 35bcd18..ba52a27 100644 --- a/eve_resource/resource.py +++ b/eve_resource/resource.py @@ -19,15 +19,16 @@ class Resource(object): registering event hooks with the :class:`eve.Eve` api. :param name: The resource name to be registered with the api. - :param keys: Strings used as a key for the fields of the resource schema. + :param keys: Iterable of strings used as a key for the fields of the + resource schema. Example:: - persons = Resource('persons', 'first_name', 'last_name') + persons = Resource('persons', keys=('first_name', 'last_name')) """ - def __init__(self, name, *keys): + def __init__(self, name, keys=[]): self.name = name self._key = None # type: NamedTuple self._definition = None # type: Dict[str, Any] diff --git a/setup.cfg b/setup.cfg index fd26263..91c99ae 100644 --- a/setup.cfg +++ b/setup.cfg @@ -1,5 +1,5 @@ [bumpversion] -current_version = 0.1.4 +current_version = 0.1.5 commit = True tag = True diff --git a/setup.py b/setup.py index a2f2cca..9617040 100644 --- a/setup.py +++ b/setup.py @@ -26,7 +26,7 @@ setup( name='eve_resource', - version='0.1.4', + version='0.1.5', description="Resource utilities for Eve", long_description=readme + '\n\n' + history, author="Michael Housh", diff --git a/tests/test_resource.py b/tests/test_resource.py index 606c457..f9b2b8f 100644 --- a/tests/test_resource.py +++ b/tests/test_resource.py @@ -16,7 +16,7 @@ @pytest.fixture() def accounts(): - return resource.Resource('accounts', 'username', 'password') + return resource.Resource('accounts', keys=('username', 'password')) @pytest.fixture()