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

Bcard::activate()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 1
eloc 2
nc 1
nop 1
dl 0
loc 4
rs 10
c 0
b 0
f 0
1
<?php
2
3
namespace UON\Endpoint;
4
5
use UON\Client;
6
7
/**
8
 * Class Bcard
9
 * @package UON
10
 */
11
class Bcard extends Client
12
{
13
    /**
14
     * Bonus card activation
15
     *
16
     * @link    https://api.u-on.ru/{key}/bcard-activate/create.{_format}
17
     * @param   array $parameters - List of parameters [bc_number, user_id]
18
     * @return  array|false
19
     */
20
    public function activate(array $parameters)
21
    {
22
        $endpoint = '/bcard-activate/create';
23
        return $this->doRequest('post', $endpoint, $parameters);
24
    }
25
26
27
    /**
28
     * Bonus card create
29
     *
30
     * @link    https://api.u-on.ru/{key}/bcard/create.{_format}
31
     * @param   array $parameters - List of parameters [number, bonuses etc.]
32
     * @return  array|false
33
     */
34
    public function create(array $parameters)
35
    {
36
        $endpoint = '/bcard/create';
37
        return $this->doRequest('post', $endpoint, $parameters);
38
    }
39
40
    /**
41
     * Bonuses add/delete by bonus card
42
     *
43
     * @link    https://api.u-on.ru/{key}/bcard-bonus/create.{_format}
44
     * @param   array $parameters - List of parameters [bc_number, user_id etc.]
45
     * @return  array|false
46
     */
47
    public function createBonus(array $parameters)
48
    {
49
        $endpoint = '/bcard-bonus/create';
50
        return $this->doRequest('post', $endpoint, $parameters);
51
    }
52
53
    /**
54
     * Get bonus transactions by bonus card
55
     *
56
     * @link    https://api.u-on.ru/{key}/bcard-bonus-by-card/{id}.{_format}
57
     * @param   int $id - Unique card ID
58
     * @return  array|false
59
     */
60
    public function getByCard($id)
61
    {
62
        $endpoint = '/bcard-bonus-by-card/' . $id;
63
        return $this->doRequest('get', $endpoint);
64
    }
65
66
    /**
67
     * Get bonus transactions by user ID
68
     *
69
     * @link    https://api.u-on.ru/{key}/bcard-bonus-by-user/{id}.{_format}
70
     * @param   int $id - Unique user ID
71
     * @return  array|false
72
     */
73
    public function getByUser($id)
74
    {
75
        $endpoint = '/bcard-bonus-by-user/' . $id;
76
        return $this->doRequest('get', $endpoint);
77
    }
78
79
}
80