Completed
Push — master ( 0f5404...9fd863 )
by Sergey
08:17 queued 05:42
created

BoardSections::edit()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 9
Code Lines 5

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 1
eloc 5
nc 1
nop 2
dl 0
loc 9
rs 9.6666
c 0
b 0
f 0
1
<?php
2
3
namespace seregazhuk\PinterestBot\Api\Providers;
4
5
use seregazhuk\PinterestBot\Api\Providers\Core\Provider;
6
use seregazhuk\PinterestBot\Helpers\UrlBuilder;
7
8
class BoardSections extends Provider
9
{
10
    /**
11
     * @param string $boardId
12
     * @return array|bool
13
     */
14
    public function forBoard($boardId)
15
    {
16
        return $this->get(UrlBuilder::RESOURCE_GET_BOARD_SECTIONS, ['board_id' => $boardId]);
17
    }
18
19
    /**
20
     * @param string $boardId
21
     * @param string $title
22
     * @return bool
23
     */
24
    public function create($boardId, $title)
25
    {
26
        $requestOptions = [
27
            'board_id' => $boardId,
28
            'name' => $title,
29
            'initial_pins' => []
30
        ];
31
32
        return $this->post(UrlBuilder::RESOURCE_ADD_BOARD_SECTION, $requestOptions);
33
    }
34
35
    /**
36
     * @param string $sectionId
37
     * @param string $title
38
     * @return bool
39
     */
40
    public function edit($sectionId, $title)
41
    {
42
        $requestOptions = [
43
            'section_id' => $sectionId,
44
            'name' => $title,
45
        ];
46
47
        return $this->post(UrlBuilder::RESOURCE_EDIT_BOARD_SECTION, $requestOptions);
48
    }
49
50
    /**
51
     * @param string $sectionId
52
     * @return bool
53
     */
54
    public function delete($sectionId)
55
    {
56
        return $this->post(UrlBuilder::RESOURCE_DELETE_BOARD_SECTION, ['section_id' => $sectionId]);
57
    }
58
}
59