Total Complexity | 2 |
Total Lines | 16 |
Duplicated Lines | 0 % |
1 | from lib.actions import BaseAction |
||
4 | class ArticleUpdate(BaseAction): |
||
5 | def run(self, slug, title, body): |
||
6 | slug = self._convert_slug(slug) |
||
7 | path = '/articles/%s' % slug |
||
8 | payload = self._create_payload(title=title, body=body) |
||
9 | response = self._api_put(path, json=payload) |
||
10 | return response |
||
11 | |||
12 | def _create_payload(self, title, body): |
||
13 | payload = { |
||
14 | 'article': { |
||
15 | 'title': title, |
||
16 | 'body': body, |
||
17 | } |
||
18 | } |
||
19 | return payload |
||
20 |