Passed
Push — master ( a4d359...48ca8a )
by Dane
02:05
created

Subscriptions::getAll()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 1
eloc 1
c 1
b 0
f 0
nc 1
nop 0
dl 0
loc 3
rs 10
1
<?php
2
3
namespace AcquiaCloudApi\Endpoints;
4
5
use AcquiaCloudApi\Response\OperationResponse;
6
use AcquiaCloudApi\Response\SubscriptionResponse;
7
use AcquiaCloudApi\Response\SubscriptionsResponse;
8
9
class Subscriptions extends CloudApiBase implements CloudApiInterface
10
{
11
    /**
12
     * Shows all Subscriptions.
13
     *
14
     * @return SubscriptionsResponse<SubscriptionResponse>
15
     */
16
    public function getAll(): SubscriptionsResponse
17
    {
18
        return new SubscriptionsResponse($this->client->request('get', '/subscriptions'));
19
    }
20
21
    /**
22
     * Shows information about an subscription.
23
     *
24
     * @param  string $subscriptionUuid
25
     * @return SubscriptionResponse
26
     */
27
    public function get($subscriptionUuid): SubscriptionResponse
28
    {
29
        return new SubscriptionResponse(
30
            $this->client->request(
31
                'get',
32
                "/subscriptions/${subscriptionUuid}"
33
            )
34
        );
35
    }
36
37
    /**
38
     * Renames an subscription.
39
     *
40
     * @param  string $subscriptionUuid
41
     * @param  string $name
42
     * @return OperationResponse
43
     */
44
    public function rename($subscriptionUuid, $name): OperationResponse
45
    {
46
47
        $options = [
48
            'json' => [
49
                'name' => $name,
50
            ],
51
        ];
52
53
        return new OperationResponse(
54
            $this->client->request(
55
                'put',
56
                "/subscriptions/${subscriptionUuid}",
57
                $options
58
            )
59
        );
60
    }
61
}
62