Passed
Push — master ( f86309...3fa716 )
by Mr
01:59 queued 22s
created

Catalog   A

Complexity

Total Complexity 3

Size/Duplication

Total Lines 40
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
dl 0
loc 40
rs 10
c 0
b 0
f 0
wmc 3

3 Methods

Rating   Name   Duplication   Size   Complexity  
A update() 0 4 1
A get() 0 4 1
A create() 0 4 1
1
<?php
2
3
namespace UON\Endpoint;
4
5
use UON\Client;
6
7
/**
8
 * Class Catalog
9
 * @package UON
10
 */
11
class Catalog extends Client
12
{
13
    /**
14
     * Get services of "I'am operator" by page number (first page by default)
15
     *
16
     * @link    https://api.u-on.ru/{key}/bcard-bonus-by-card/{id}.{_format}
17
     * @param   int $page - Unique card ID
18
     * @return  array|false
19
     */
20
    public function get($page = 1)
21
    {
22
        $endpoint = '/catalog-service/' . $page;
23
        return $this->doRequest('get', $endpoint);
24
    }
25
26
    /**
27
     * Create services of "I'am operator"
28
     *
29
     * @link    https://api.u-on.ru/{key}/bcard-activate/create.{_format}
30
     * @param   array $parameters - List of parameters [s_id ...]
31
     * @return  array|false
32
     */
33
    public function create(array $parameters)
34
    {
35
        $endpoint = '/catalog-service/create';
36
        return $this->doRequest('post', $endpoint, $parameters);
37
    }
38
39
    /**
40
     * Update services of "I'am operator"
41
     *
42
     * @link    https://api.u-on.ru/{key}/catalog-service/update/{id}.{_format}
43
     * @param   int $id - Unique ID of element
44
     * @param   array $parameters - List of parameters [s_id ...]
45
     * @return  array|false
46
     */
47
    public function update($id, array $parameters)
48
    {
49
        $endpoint = '/catalog-service/update/' . $id;
50
        return $this->doRequest('post', $endpoint, $parameters);
51
    }
52
53
}
54