1: <?php
2:
3: namespace Cloudflare\Zone;
4:
5: use Cloudflare\Api;
6: use Cloudflare\Zone;
7:
8: /**
9: * CloudFlare API wrapper
10: *
11: * Zone Plan
12: *
13: * @author James Bell <[email protected]>
14: *
15: * @version 1
16: */
17: class Plan extends Api
18: {
19: /**
20: * Default permissions level
21: *
22: * @var array
23: */
24: protected $permission_level = ['read' => '#billing:read', 'edit' => '#billing:edit'];
25:
26: /**
27: * Available plans (permission needed: #billing:read)
28: * List all plans the zone can subscribe to.
29: *
30: * @param string $zone_identifier
31: */
32: public function available($zone_identifier)
33: {
34: return $this->get('zones/'.$zone_identifier.'/plans');
35: }
36:
37: /**
38: * Available plans (permission needed: #billing:read)
39: *
40: * @param string $zone_identifier
41: * @param string $identifier API item identifier tag
42: */
43: public function details($zone_identifier, $identifier)
44: {
45: return $this->get('zones/'.$zone_identifier.'/plans/'.$identifier);
46: }
47:
48: /**
49: * Change plan (permission needed: #billing:edit)
50: * Change the plan level for the zone. This will cancel any previous subscriptions and subscribe the zone to the new plan.
51: *
52: * @param string $zone_identifier
53: * @param string $identifier API item identifier tag
54: */
55: public function change($zone_identifier, $identifier)
56: {
57: return $this->put('zones/'.$zone_identifier.'/plans/'.$identifier.'/subscribe');
58: }
59: }
60: