Completed
Push — master ( 3c61a8...5ea3bf )
by
unknown
02:27
created

ArticleUpdate   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 16
Duplicated Lines 0 %
Metric Value
wmc 2
dl 0
loc 16
rs 10

2 Methods

Rating   Name   Duplication   Size   Complexity  
A run() 0 6 1
A _create_payload() 0 8 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