-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #13 from exonet/refactor
Breaking refactor
- Loading branch information
Showing
31 changed files
with
705 additions
and
468 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,4 @@ | ||
from .Client import Client | ||
from .RequestBuilder import RequestBuilder | ||
from .result import Parser | ||
from .create_resource import create_resource |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,14 +1,13 @@ | ||
from inflection import camelize | ||
from .result.Resource import Resource | ||
|
||
class create_resource: | ||
def create_resource(resource_type, attributes=(), id=None, relationships=None): | ||
"""Create a dynamic Resource based on the type that is provided in the data. | ||
:param resource_type: The resource type. | ||
:param attributes: The json data to construct a Resource. | ||
:param id: The Resource identifier. | ||
:param relationships: The initial relationships for the resource. | ||
:return: A Resource instance. | ||
""" | ||
return type(camelize(resource_type), (Resource,), {})(attributes=attributes, id=id, relationships=relationships) | ||
from .structures.Resource import Resource | ||
|
||
|
||
def create_resource(resource): | ||
"""Create a dynamic Resource based on the type that is provided in the data. | ||
:param resource: The resource. | ||
:return: A Resource instance. | ||
""" | ||
resource_type = resource['type'] | ||
|
||
return type(camelize(resource_type), (Resource,), {})(resource) |
Oops, something went wrong.