11# -*- coding: utf-8 -*-
22from __future__import unicode_literals
3- from json import loads
43
54from github3 .models import GitHubCore
65from github3 .users import User
@@ -21,6 +20,10 @@ def __init__(self, deployment, session=None):
2120#: SHA of the branch on GitHub
2221self .sha = deployment .get ('sha' )
2322
23+ #: The reference used to create the Deployment, e.g.,
24+ #: `deploy-20140526`
25+ self .ref = deployment .get ('ref' )
26+
2427#: User object representing the creator of the deployment
2528self .creator = deployment .get ('creator' )
2629if self .creator :
@@ -38,6 +41,9 @@ def __init__(self, deployment, session=None):
3841#: Description of the deployment
3942self .description = deployment .get ('description' )
4043
44+ #: Target for the deployment, e.g., 'production', 'staging'
45+ self .environment = deployment .get ('environment' )
46+
4147#: URL to get the statuses of this deployment
4248self .statuses_url = deployment .get ('statuses_url' )
4349
@@ -113,5 +119,14 @@ def __init__(self, status, session=None):
113119#: Description of the deployment
114120self .description = status .get ('description' )
115121
122+ #: :class:`Deployment` representing the deployment this status is
123+ #: associated with
124+ self .deployment = status .get ('deployment' )
125+ if self .deployment :
126+ self .deployment = Deployment (self .deployment ,self )
127+
128+ #: URL for the deployment this status is associated with
129+ self .deployment_url = status .get ('deployment_url' )
130+
116131def _repr (self ):
117132return '<DeploymentStatus [{0}]>' .format (self .id )