Update github3.repos.issue_import for consistency
# -*- coding: utf-8 -*-
-from ..models import GitHubCore
+"""This module contains the logic for GitHub's import issue API."""
+from .. import models
-"""
-github3.repos.issue_import
-==========================
+class ImportedIssue(models.GitHubCore):
+ """Represents an issue imported via the unofficial API.
-This module contains the ImportedIssue object for Github's import issue API
+ See also: https://gist.github.com/jonmagic/5282384165e0f86ef105
-"""
+ This object has the following attributes:
+ .. attribute:: created_at
-class ImportedIssue(GitHubCore):
- """
- The :class:`ImportedIssue <ImportedIssue>` object. This represents
- information from the Import Issue API.
+ A :class:`~datetime.datetime` object representing the date and time
+ when this imported issue was created.
- See also: https://gist.github.com/jonmagic/5282384165e0f86ef105
+ .. attribute:: id
+
+ The globally unique identifier for this imported issue.
+
+ .. attribute:: import_issues_url
+
+ The URL used to import more issues via the API.
+
+ .. attribute:: repository_url
+
+ The URL used to retrieve the repository via the API.
+
+ .. attribute:: status
+
+ The status of this imported issue.
+
+ .. attribute:: updated_at
+
+ A :class:`~datetime.datetime` object representing te date and time
+ when this imported issue was last updated.
"""
IMPORT_CUSTOM_HEADERS = {
@@ -24,19 +42,10 @@ class ImportedIssue(GitHubCore):
}
def _update_attributes(self, issue):
- self.id = self._get_attribute(issue, 'id')
-
- self.status = self._get_attribute(issue, 'status')
-
- self.url = self._get_attribute(issue, 'url')
-
- # Since created_at and updated_at returns slightly different format
- # we can't use self._strptime
- # For example, repo correctly returns '2015-04-15T03:40:51Z'
- # For ImportedIssue, the format is '2016-01-14T10:57:56-08:00'
- self.created_at = self._get_attribute(issue, 'created_at')
- self.updated_at = self._get_attribute(issue, 'updated_at')
- self.import_issues_url = self._get_attribute(
- issue, 'import_issues_url'
- )
- self.repository_url = self._get_attribute(issue, 'repository_url')
+ self._api = issue['url']
+ self.created_at = self._strptime(issue['created_at'])
+ self.id = issue['id']
+ self.import_issues_url = issue['import_issues_url']
+ self.repository_url = issue['repository_url']
+ self.status = issue['status']
+ self.updated_at = self._strptime(issue['updated_at'])
