Skip to content

Commit

Permalink
Merge pull request #284 from juliamcclellan/am_docs
Browse files Browse the repository at this point in the history
Fix docs rendering errors
  • Loading branch information
pcattori committed Aug 22, 2019
2 parents f244efb + bb4c92e commit 286d020
Show file tree
Hide file tree
Showing 4 changed files with 23 additions and 13 deletions.
1 change: 1 addition & 0 deletions docs/contributor-guide.rst
Original file line number Diff line number Diff line change
Expand Up @@ -143,6 +143,7 @@ Overview of Resource and Collection interaction (from_json and from_data confusi

.. image:: resource:collectionRoute.png
.. image:: resource:collectionRequest.png

**Step 1 (red)**: `yourCollection`’s `by_relative_id` returns `super.by_relative_id`, which comes from `baseCollection`

**Step 1a (black)**: within `by_relative_id`, variable `resource_json` is defined as `self.client.get.[etc]`. `Client`’s `.get` returns `self.request`
Expand Down
8 changes: 4 additions & 4 deletions tamr_unify_client/base_collection.py
Original file line number Diff line number Diff line change
Expand Up @@ -103,12 +103,12 @@ def by_external_id(self, resource_class, external_id):
return items[0]

def delete_by_resource_id(self, resource_id):
"""Deletes a resource from this collection by resource_id.
"""Deletes a resource from this collection by resource ID.
:param resource_id: the resource_id of the resource that will be deleted.
:type: str
:param resource_id: The resource ID of the resource that will be deleted.
:type resource_id: str
:return: HTTP response from the server.
:rtype: :class: `requests.Response`
:rtype: :class:`requests.Response`
"""
path = f"{self.api_path}/{resource_id}"
response = self.client.delete(path).successful()
Expand Down
22 changes: 15 additions & 7 deletions tamr_unify_client/project/attribute_mapping/collection.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,26 +3,31 @@

class AttributeMappingCollection:
"""Collection of :class:`~tamr_unify_client.project.attribute_mapping.resource.AttributeMapping`
:param map_url: API path used to access this collection.
:type api_path: str
:param client: Client for API call delegation.
:type client: :class:`~tamr_unify_client.Client`
:param api_path: API path used to access this collection.
:type api_path: str
"""

def __init__(self, client, api_path):
self.api_path = api_path
self.client = client
self.api_path = api_path

def stream(self):
"""Stream items in this collection.
"""Stream attribute mappings in this collection. Implicitly called when iterating
over this collection.
:returns: Stream of attribute mappings.
:rtype: Python generator yielding :class:`~tamr_unify_client.project.attribute_mapping.resource.AttributeMapping`
"""
all_maps = self.client.get(self.api_path).successful().json()
for mapping in all_maps:
yield AttributeMapping(self.client, mapping)

def by_resource_id(self, resource_id):
"""Retrieve an item in this collection by resource ID.
:param resource_id: The resource ID.
:type resource_id: str
:returns: The specified attribute mapping.
Expand All @@ -37,6 +42,7 @@ def by_resource_id(self, resource_id):

def by_relative_id(self, relative_id):
"""Retrieve an item in this collection by relative ID.
:param relative_id: The relative ID.
:type relative_id: str
:returns: The specified attribute mapping.
Expand All @@ -47,8 +53,9 @@ def by_relative_id(self, relative_id):

def create(self, creation_spec):
"""Create an Attribute mapping in this collection
:param creation_spec: Attribute mapping creation specification should be formatted as specified in the
`Public Docs for adding an AttributeMapping <https://docs.tamr.com/reference#create-an-attribute-mapping>`_.
`Public Docs for adding an AttributeMapping <https://docs.tamr.com/reference#create-an-attribute-mapping>`_.
:type creation_spec: dict[str, str]
:returns: The created Attribute mapping
:rtype: :class:`~tamr_unify_client.project.attribute_mapping.resource.AttributeMapping`
Expand All @@ -57,10 +64,11 @@ def create(self, creation_spec):
return AttributeMapping(self.client, data)

def delete_by_resource_id(self, resource_id):
"""delete an attribute mapping using its Resource ID.
"""Delete an attribute mapping using its Resource ID.
:param resource_id: the resource ID of the mapping to be deleted.
:type resource_id: str
:returns: HTTP status code
:returns: HTTP response from the server
:rtype: :class:`requests.Response`
"""
path = self.api_path + "/" + resource_id
Expand Down
5 changes: 3 additions & 2 deletions tamr_unify_client/project/attribute_mapping/resource.py
Original file line number Diff line number Diff line change
Expand Up @@ -81,9 +81,10 @@ def spec(self):
return AttributeMappingSpec.of(self)

def delete(self):
"""delete this attribute mapping.
"""Delete this attribute mapping.
:return: HTTP response from the server
:rtype: :class `requests.Response`
:rtype: :class:`requests.Response`
"""
response = self.client.delete(self.api_path).successful()
return response
Expand Down

0 comments on commit 286d020

Please sign in to comment.