Completed
Push — master ( 8bbda0...ede634 )
by ARCANEDEV
8s
created

Sku::save()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 2

Importance

Changes 1
Bugs 0 Features 0
Metric Value
c 1
b 0
f 0
dl 0
loc 4
ccs 0
cts 4
cp 0
rs 10
cc 1
eloc 2
nc 1
nop 1
crap 2
1
<?php namespace Arcanedev\Stripe\Resources;
2
3
use Arcanedev\Stripe\Contracts\Resources\SkuInterface;
4
use Arcanedev\Stripe\StripeResource;
5
6
/**
7
 * Class     Sku
8
 *
9
 * @package  Arcanedev\Stripe\Resources
10
 * @author   ARCANEDEV <[email protected]>
11
 * @link     https://stripe.com/docs/api#skus
12
 *
13
 * @property  string                            id
14
 * @property  string                            object             // 'sku'
15
 * @property  bool                              livemode
16
 * @property  bool                              active
17
 * @property  int                               created
18
 * @property  int                               updated
19
 * @property  array                             attributes
20
 * @property  string                            currency
21
 * @property  array                             inventory
22
 * @property  \Arcanedev\Stripe\AttachedObject  metadata
23
 * @property  int                               price
24
 * @property  string                            product
25
 * @property  string                            image
26
 * @property  array                             package_dimensions
27
 */
28
class Sku extends StripeResource implements SkuInterface
29
{
30
    /* ------------------------------------------------------------------------------------------------
31
     |  Main Functions
32
     | ------------------------------------------------------------------------------------------------
33
     */
34
    /**
35
     * Retrieve a Sku.
36
     *
37
     * @link   https://stripe.com/docs/api#retrieve_sku
38
     *
39
     * @param  string             $id
40
     * @param  array|string|null  $options
41
     *
42
     * @return self
43
     */
44
    public static function retrieve($id, $options = null)
45
    {
46
        return self::scopedRetrieve($id, $options);
47
    }
48
49
    /**
50
     * Create a Sku.
51
     *
52
     * @link   https://stripe.com/docs/api#create_sku
53
     *
54
     * @param  array|null         $params
55
     * @param  array|string|null  $options
56
     *
57
     * @return self
58
     */
59
    public static function create($params = null, $options = null)
60
    {
61
        return self::scopedCreate($params, $options);
62
    }
63
64
    /**
65
     * Update a Sku.
66
     *
67
     * @link   https://stripe.com/docs/api#update_sku
68
     *
69
     * @param  array|string|null  $options
70
     *
71
     * @return self
72
     */
73
    public function save($options = null)
74
    {
75
        return $this->scopedSave($options);
76
    }
77
78
    /**
79
     * List all SKUs.
80
     *
81
     * @link   https://stripe.com/docs/api#list_skus
82
     *
83
     * @param  array|null         $params
84
     * @param  array|string|null  $options
85
     *
86
     * @return \Arcanedev\Stripe\Collection|array
87
     */
88
    public static function all($params = null, $options = null)
89
    {
90
        return self::scopedAll($params, $options);
91
    }
92
93
    /**
94
     * Delete a product SKU.
95
     *
96
     * @link   https://stripe.com/docs/api#delete_sku
97
     *
98
     * @param  array|null         $params
99
     * @param  array|string|null  $options
100
     *
101
     * @return self
102
     */
103
    public function delete($params = null, $options = null)
104
    {
105
        return $this->scopedDelete($params, $options);
106
    }
107
}
108