11# -*- coding: utf-8 -*-
2+ """GitHub Pages related logic."""
23from __future__ import unicode_literals
3- from ..models import GitHubCore
44
5+ from .. import models
56
6- class PagesInfo (GitHubCore ):
7- def _update_attributes (self , info ):
8- self ._api = self ._get_attribute (info , 'url' )
97
10- #: Status of the pages site, e.g., built
11- self .status = self ._get_attribute (info , 'status' )
8+ class PagesInfo (models .GitHubCore ):
9+ """Representation of the information about a GitHub pages website.
10+
11+ .. attribute:: cname
12+
13+ The cname in use for the pages site, if one is set.
1214
13- #: CName used for the pages site
14- self .cname = self ._get_attribute (info , 'cname' )
15+ .. attribute:: custom_404
1516
16- #: Boolean indicating whether there is a custom 404 for the pages site
17- self .custom_404 = self ._get_attribute (info , 'custom_404' )
17+ A boolean attribute indicating whether the user configured a custom
18+ 404 page for this site.
19+
20+ .. attribute:: status
21+
22+ The current status of the pages site, e.g., ``built``.
23+ """
24+
25+ def _update_attributes (self , info ):
26+ self ._api = info ['url' ]
27+ self .cname = info ['cname' ]
28+ self .custom_404 = info ['custom_404' ]
29+ self .status = info ['status' ]
1830
1931 def _repr (self ):
2032 info = self .cname or ''
@@ -24,33 +36,52 @@ def _repr(self):
2436 return '<Pages Info [{0}]>' .format (info )
2537
2638
27- class PagesBuild (GitHubCore ):
28- def _update_attributes (self , build ):
29- self ._api = self ._get_attribute (build , 'url' )
39+ class PagesBuild (models .GitHubCore ):
40+ """Representation of a single build of a GitHub pages website.
3041
31- #: Status of the pages build, e.g., building
32- self .status = self ._get_attribute (build , 'status' )
42+ .. attribute:: commit
3343
34- #: Error dictionary containing the error message
35- self .error = self ._get_attribute (build , 'error' )
44+ The SHA of the commit that triggered this build.
3645
37- from .. import users
38- #: :class:`User <github3.users.User>` representing who pushed the
39- #: commit
40- self .pusher = self ._class_attribute (build , 'pusher' , users .ShortUser ,
41- self )
46+ .. attribute:: created_at
47+
48+ A :class:`~datetime.datetime` object representing the date and time
49+ when this build was created.
4250
43- #: SHA of the commit that triggered the build
44- self .commit = self ._get_attribute (build , 'commit' )
51+ .. attribute:: duration
4552
46- #: Time the build took to finish
47- self .duration = self ._get_attribute (build , 'duration' )
53+ The time it spent processing this build.
4854
49- #: Datetime the build was created
50- self .created_at = self ._strptime_attribute (build , 'created_at' )
55+ .. attribute:: error
5156
52- #: Datetime the build was updated
53- self .updated_at = self ._strptime_attribute (build , 'updated_at' )
57+ If this build errored, a dictionary containing the error message and
58+ details about the error.
59+
60+ .. attribute:: pusher
61+
62+ A :class:`~github3.users.ShortUser` representing the user who pushed
63+ the commit that triggered this build.
64+
65+ .. attribute:: status
66+
67+ The current statues of the build, e.g., ``building``.
68+
69+ .. attribute:: updated_at
70+
71+ A :class:`~datetime.datetime` object representing the date and time
72+ when this build was last updated.
73+ """
74+
75+ def _update_attributes (self , build ):
76+ from .. import users
77+ self ._api = self ._get_attribute (build , 'url' )
78+ self .commit = build ['commit' ]
79+ self .created_at = self ._strptime (build ['created_at' ])
80+ self .duration = build ['duration' ]
81+ self .error = build ['error' ]
82+ self .pusher = users .ShortUser (build ['pusher' ], self )
83+ self .status = build ['status' ]
84+ self .updated_at = self ._strptime (build ['updated_at' ])
5485
5586 def _repr (self ):
5687 return '<Pages Build [{0}/{1}]>' .format (self .commit , self .status )
0 commit comments