|
1 | 1 | # -*- coding: utf-8 -*-
|
2 |
| -""" |
3 |
| -github3.repos.tag |
4 |
| -================= |
| 2 | +"""This module contains the RepoTag object for GitHub's tag API.""" |
| 3 | +from __future__ import unicode_literals |
5 | 4 |
|
6 |
| -This module contains the RepoTag object for GitHub's tag API. |
| 5 | +from . import commit |
| 6 | +from .. import models |
7 | 7 |
|
8 |
| -""" |
9 |
| -from __future__ import unicode_literals |
10 | 8 |
|
11 |
| -from ..models import GitHubCore |
| 9 | +class RepoTag(models.GitHubCore): |
| 10 | + """Representation of a tag made on a GitHub repository. |
12 | 11 |
|
| 12 | + .. note:: |
13 | 13 |
|
14 |
| -class RepoTag(GitHubCore): |
15 |
| - """The :class:`RepoTag <RepoTag>` object. This stores the information |
16 |
| - representing a tag that was created on a repository. |
| 14 | + This is distinct from :class:`~github3.git.Tag`. This object |
| 15 | + has information specific to a tag on a *GitHub* repository. |
| 16 | + That includes URLs to the tarball and zipball files auto-generated |
| 17 | + by GitHub. |
17 | 18 |
|
18 | 19 | See also: http://developer.github.com/v3/repos/#list-tags
|
19 |
| - """ |
20 |
| - def _update_attributes(self, tag): |
21 |
| - #: Name of the tag. |
22 |
| - self.name = self._get_attribute(tag, 'name') |
23 | 20 |
|
24 |
| - #: URL for the GitHub generated zipball associated with the tag. |
25 |
| - self.zipball_url = self._get_attribute(tag, 'zipball_url') |
| 21 | + This object has the following attributes: |
| 22 | +
|
| 23 | + .. attribute:: commit |
| 24 | +
|
| 25 | + .. versionchanged:: 1.0.0 |
| 26 | +
|
| 27 | + This attribute used to be a two item dictionary. |
| 28 | +
|
| 29 | + A :class:`~github3.repos.commit.MiniCommit` object representing the |
| 30 | + commit this tag references. |
26 | 31 |
|
27 |
| - #: URL for the GitHub generated tarball associated with the tag. |
28 |
| - self.tarball_url = self._get_attribute(tag, 'tarball_url') |
| 32 | + .. attribute:: name |
29 | 33 |
|
30 |
| - #: Dictionary containing the SHA and URL of the commit. |
31 |
| - self.commit = self._get_attribute(tag, 'commit', {}) |
| 34 | + The name of this tag, e.g., ``v1.0.0``. |
| 35 | +
|
| 36 | + .. attribute:: tarball_url |
| 37 | +
|
| 38 | + The URL for the tarball file generated by GitHub for this tag. |
| 39 | +
|
| 40 | + .. attribute:: zipball_url |
| 41 | +
|
| 42 | + The URL for the zipball file generated by GitHub for this tag. |
| 43 | + """ |
| 44 | + |
| 45 | + def _update_attributes(self, tag): |
| 46 | + self.commit = commit.MiniCommit(tag['commit'], self) |
| 47 | + self.name = tag['name'] |
| 48 | + self.tarball_url = tag['tarball_url'] |
| 49 | + self.zipball_url = tag['zipball_url'] |
32 | 50 |
|
33 | 51 | def _repr(self):
|
34 | 52 | return '<Repository Tag [{0}]>'.format(self)
|
|
0 commit comments