Skip to content
This repository has been archived by the owner on Feb 16, 2023. It is now read-only.

Commit

Permalink
Merge branch 'release/v0.1.5'
Browse files Browse the repository at this point in the history
* release/v0.1.5:
  Bump version: 0.1.4 → 0.1.5
  Updated HISTORY.rst and usage.rst to reflect keys being a kwarg for Resource
  Updated Resource class keys to be a kwarg on init
  • Loading branch information
m-housh committed Oct 27, 2016
2 parents bec2e42 + 04847d7 commit 79c9334
Show file tree
Hide file tree
Showing 7 changed files with 14 additions and 9 deletions.
5 changes: 5 additions & 0 deletions HISTORY.rst
Expand Up @@ -6,3 +6,8 @@ History
------------------

* First release on PyPI.

0.1.5
--------------------

* Resource keys is now a kwarg on instantiation
3 changes: 1 addition & 2 deletions docs/usage.rst
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion eve_resource/__init__.py
Expand Up @@ -9,7 +9,7 @@

__author__ = 'Michael Housh'
__email__ = 'mhoush@houshhomeenergy.com'
__version__ = '0.1.4'
__version__ = '0.1.5'

__all__ = [
# exceptions
Expand Down
7 changes: 4 additions & 3 deletions eve_resource/resource.py
Expand Up @@ -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]
Expand Down
2 changes: 1 addition & 1 deletion setup.cfg
@@ -1,5 +1,5 @@
[bumpversion]
current_version = 0.1.4
current_version = 0.1.5
commit = True
tag = True

Expand Down
2 changes: 1 addition & 1 deletion setup.py
Expand Up @@ -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",
Expand Down
2 changes: 1 addition & 1 deletion tests/test_resource.py
Expand Up @@ -16,7 +16,7 @@

@pytest.fixture()
def accounts():
return resource.Resource('accounts', 'username', 'password')
return resource.Resource('accounts', keys=('username', 'password'))


@pytest.fixture()
Expand Down

0 comments on commit 79c9334

Please sign in to comment.