Skip to content
This repository was archived by the owner on May 22, 2021. It is now read-only.

Commit adf165d

Browse files
committed
Update github3.repos.issue_import for consistency
1 parent b273037 commit adf165d

File tree

1 file changed

+36
-27
lines changed

1 file changed

+36
-27
lines changed

github3/repos/issue_import.py

+36-27
Original file line numberDiff line numberDiff line change
@@ -1,42 +1,51 @@
11
# -*- coding: utf-8 -*-
2-
from ..models import GitHubCore
2+
"""This module contains the logic for GitHub's import issue API."""
3+
from .. import models
34

45

5-
"""
6-
github3.repos.issue_import
7-
==========================
6+
class ImportedIssue(models.GitHubCore):
7+
"""Represents an issue imported via the unofficial API.
88
9-
This module contains the ImportedIssue object for Github's import issue API
9+
See also: https://gist.github.com/jonmagic/5282384165e0f86ef105
1010
11-
"""
11+
This object has the following attributes:
1212
13+
.. attribute:: created_at
1314
14-
class ImportedIssue(GitHubCore):
15-
"""
16-
The :class:`ImportedIssue <ImportedIssue>` object. This represents
17-
information from the Import Issue API.
15+
A :class:`~datetime.datetime` object representing the date and time
16+
when this imported issue was created.
1817
19-
See also: https://gist.github.com/jonmagic/5282384165e0f86ef105
18+
.. attribute:: id
19+
20+
The globally unique identifier for this imported issue.
21+
22+
.. attribute:: import_issues_url
23+
24+
The URL used to import more issues via the API.
25+
26+
.. attribute:: repository_url
27+
28+
The URL used to retrieve the repository via the API.
29+
30+
.. attribute:: status
31+
32+
The status of this imported issue.
33+
34+
.. attribute:: updated_at
35+
36+
A :class:`~datetime.datetime` object representing te date and time
37+
when this imported issue was last updated.
2038
"""
2139

2240
IMPORT_CUSTOM_HEADERS = {
2341
'Accept': 'application/vnd.github.golden-comet-preview+json'
2442
}
2543

2644
def _update_attributes(self, issue):
27-
self.id = self._get_attribute(issue, 'id')
28-
29-
self.status = self._get_attribute(issue, 'status')
30-
31-
self.url = self._get_attribute(issue, 'url')
32-
33-
# Since created_at and updated_at returns slightly different format
34-
# we can't use self._strptime
35-
# For example, repo correctly returns '2015-04-15T03:40:51Z'
36-
# For ImportedIssue, the format is '2016-01-14T10:57:56-08:00'
37-
self.created_at = self._get_attribute(issue, 'created_at')
38-
self.updated_at = self._get_attribute(issue, 'updated_at')
39-
self.import_issues_url = self._get_attribute(
40-
issue, 'import_issues_url'
41-
)
42-
self.repository_url = self._get_attribute(issue, 'repository_url')
45+
self._api = issue['url']
46+
self.created_at = self._strptime(issue['created_at'])
47+
self.id = issue['id']
48+
self.import_issues_url = issue['import_issues_url']
49+
self.repository_url = issue['repository_url']
50+
self.status = issue['status']
51+
self.updated_at = self._strptime(issue['updated_at'])

0 commit comments

Comments
 (0)