<s> """<STR_LIT>""" <EOL> from __future__ import unicode_literals <EOL> from json import dumps <EOL> from . . decorators import requires_auth <EOL> from . . models import GitHubCore <EOL> class Hook ( GitHubCore ) : <EOL> """<STR_LIT>""" <EOL> def _update_attributes ( self , hook , session = None ) : <EOL> self . _api = hook . get ( '<STR_LIT:url>' , '<STR_LIT>' ) <EOL> self . updated_at = self . _strptime ( hook . get ( '<STR_LIT>' ) ) <EOL> self . created_at = self . _strptime ( hook . get ( '<STR_LIT>' ) ) <EOL> self . name = hook . get ( '<STR_LIT:name>' ) <EOL> self . events = hook . get ( '<STR_LIT>' ) <EOL> self . active = hook . get ( '<STR_LIT>' ) <EOL> self . config = hook . get ( '<STR_LIT>' ) <EOL> self . id = hook . get ( '<STR_LIT:id>' ) <EOL> def _repr ( self ) : <EOL> return '<STR_LIT>' . format ( self . name ) <EOL> @ requires_auth <EOL> def delete ( self ) : <EOL> """<STR_LIT>""" <EOL> return self . _boolean ( self . _delete ( self . _api ) , <NUM_LIT> , <NUM_LIT> ) <EOL> @ requires_auth <EOL> def edit ( self , config = { } , events = [ ] , add_events = [ ] , rm_events = [ ] , <EOL> active = True ) : <EOL> """<STR_LIT>""" <EOL> data = { '<STR_LIT>' : config , '<STR_LIT>' : active } <EOL> if events : <EOL> data [ '<STR_LIT>' ] = events <EOL> if add_events : <EOL> data [ '<STR_LIT>' ] = add_events <EOL> if rm_events : <EOL> data [ '<STR_LIT>' ] = rm_events <EOL> json = self . _json ( self . _patch ( self . _api , data = dumps ( data ) ) , <NUM_LIT:200> ) <EOL> if json : <EOL> self . _update_attributes ( json ) <EOL> return True <EOL> return False <EOL> @ requires_auth <EOL> def ping ( self ) : <EOL> """<STR_LIT>""" <EOL> url = self . _build_url ( '<STR_LIT>' , base_url = self . _api ) <EOL> return self . _boolean ( self . _post ( url ) , <NUM_LIT> , <NUM_LIT> ) <EOL> @ requires_auth <EOL> def test ( self ) : <EOL> """<STR_LIT>""" <EOL> url = self . _build_url ( '<STR_LIT>' , base_url = self . _api ) <EOL> return self . _boolean ( self . _post ( url ) , <NUM_LIT> , <NUM_LIT> ) </s>
