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

Services   A

Complexity

Total Complexity 3

Size/Duplication

Total Lines 39
Duplicated Lines 0 %

Importance

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

3 Methods

Rating   Name   Duplication   Size   Complexity  
A getTypes() 0 4 1
A create() 0 4 1
A update() 0 4 1
1
<?php
2
3
namespace UON\Endpoint;
4
5
use UON\Client;
6
7
/**
8
 * Class Services
9
 * @package UON
10
 */
11
class Services extends Client
12
{
13
    /**
14
     * Add service to voucher
15
     *
16
     * @link    https://api.u-on.ru/{key}/request-action/create.{_format}
17
     * @param   array $parameters - List of parameters
18
     * @return  array|false
19
     */
20
    public function create(array $parameters)
21
    {
22
        $endpoint = '/service/create';
23
        return $this->doRequest('post', $endpoint, $parameters);
24
    }
25
26
    /**
27
     * Get a list of service types for voucher
28
     *
29
     * @link    https://api.u-on.ru/{key}/service_type.{_format}
30
     * @return  array|false
31
     */
32
    public function getTypes()
33
    {
34
        $endpoint = '/service_type';
35
        return $this->doRequest('get', $endpoint);
36
    }
37
38
    /**
39
     * Update service by ID
40
     *
41
     * @link    https://api.u-on.ru/{key}/service/update/{id}.{_format}
42
     * @param   int $id - Unique ID of service
43
     * @param   array $parameters - List of parameters
44
     * @return  array|false
45
     */
46
    public function update($id, array $parameters)
47
    {
48
        $endpoint = '/service/update/' . $id;
49
        return $this->doRequest('post', $endpoint, $parameters);
50
    }
51
52
}
53