Passed
Push — develop ( ac969d...0f04a2 )
by Edwin
03:44
created

DiscountCode::__construct()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 14
Code Lines 11

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 12
CRAP Score 1

Importance

Changes 1
Bugs 0 Features 0
Metric Value
c 1
b 0
f 0
dl 0
loc 14
ccs 12
cts 12
cp 1
rs 9.4285
cc 1
eloc 11
nc 1
nop 1
crap 1
1
<?php
2
3
namespace ShopifyClient\Resource;
4
5
use ShopifyClient\Action\Action;
6
use ShopifyClient\Request;
7
8
/**
9
 * https://help.shopify.com/api/reference/discountcode
10
 *
11
 * @method create(array $parameters = [])
12
 * @method createBatch(float $parentId, array $parameters = [])
13
 * @method get(float $parentId)
14
 * @method getBatch(float $parentId, float $childId)
15
 * @method all(float $parentId)
16
 * @method allBatch(float $parentId, float $childId)
17
 * @method lookup(float $parentId, array $parameters = [])
18
 * @method count(float $parentId)
19
 * @method update(float $parentId, array $parameters = [])
20
 * @method delete(float $parentId)
21
 */
22
class DiscountCode extends AbstractResource implements Resource
23
{
24
    /**
25
     * DiscountCode constructor.
26
     * @param Request $request
27
     */
28 5
    public function __construct(Request $request)
29
    {
30 5
        parent::__construct($request);
31
32 5
        $this->actions->add('create', new Action(Request::METHOD_POST, 'price_rules/%s/discount_codes.json', 'discount_code', 'discount_code'));
33 5
        $this->actions->add('createBatch', new Action(Request::METHOD_POST, 'price_rules/%s/batch.json', 'discount_code_creation', 'discount_codes'));
34 5
        $this->actions->add('get', new Action(Request::METHOD_GET, 'price_rules/%s/discount_codes/%s.json', 'discount_code','discount_code'));
35 5
        $this->actions->add('getBatch', new Action(Request::METHOD_GET, 'price_rules/%s/batch/%s.json', 'discount_code_creation', 'discount_code_creation'));
36 5
        $this->actions->add('all', new Action(Request::METHOD_GET, 'price_rules/%s/discount_codes.json', 'discount_codes', 'discount_codes'));
37 5
        $this->actions->add('allBatch', new Action(Request::METHOD_GET, 'price_rules/%s/batch/%s/discount_codes.json', 'discount_codes', 'discount_codes'));
38 5
        $this->actions->add('lookup', new Action(Request::METHOD_GET, 'discount_codes/lookup.json', 'discount_code', 'discount_code'));
39 5
        $this->actions->add('update', new Action(Request::METHOD_PUT, 'price_rules/%s/discount_codes/%s.json', 'discount_code', 'discount_code'));
40 5
        $this->actions->add('delete', new Action(Request::METHOD_DELETE, 'price_rules/%s/discount_codes/%s.json'));
41 5
    }
42
}
43