Completed
Pull Request — master (#349)
by Tomaz
02:59
created

EnableHookAction.run()   A

Complexity

Conditions 1

Size

Total Lines 13

Duplication

Lines 0
Ratio 0 %
Metric Value
cc 1
dl 0
loc 13
rs 9.4286
1
import json
2
3
from lib.action import TravisCI
4
5
6
class EnableHookAction(TravisCI):
7
    def run(self, hook_id):
8
        """
9
        Enable a hook to monitor through Travis
10
        """
11
        path = '/hooks/' + str(hook_id)
12
        json_req = {
13
            'hook': {
14
                'active': 'true'
15
            }
16
        }
17
        json_req = json.dumps(json_req)
18
        response = self._perform_request(path, data=json_req, method='PUT')
19
        return response.content
20