Completed
Pull Request — master (#341)
by
unknown
02:03
created

ArticleUpdate._create_payload()   A

Complexity

Conditions 1

Size

Total Lines 8

Duplication

Lines 0
Ratio 0 %
Metric Value
dl 0
loc 8
rs 9.4286
cc 1
1
from lib.actions import BaseAction
2
3
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