Skip to content

Commit 97a783d

Browse files
authored
Merge pull request #7 from macbookandrew/feature/update-pull-zone
add getPullZone and updatePullZone methods
2 parents d9c6657 + 0fcf0d4 commit 97a783d

File tree

2 files changed

+26
-3
lines changed

2 files changed

+26
-3
lines changed

README.md

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
# BunnyCDN API Class
22
The most comprehensive, feature packed and easy to use PHP class for the BunnyCDN pull and storage zones [API](https://bunnycdn.docs.apiary.io/).
33

4-
This class whilst having a main focus on storage zone interaction includes pull zone features.
4+
This class whilst having a main focus on storage zone interaction includes pull zone features.
55
Combining API with FTP, managing and using BunnyCDN storage zones just got easier.
66

77

@@ -46,7 +46,9 @@ If you want to interact with storage zones you will need your BunnyCDN API key s
4646
* View monthly charge breakdown
4747
* Apply coupon code
4848
* List pull zones
49+
* Get pull zone
4950
* Add pull zone
51+
* Update pull zone
5052
* Delete pull zone
5153
* Purge pull zone
5254
* Add hostname to pull zone
@@ -553,4 +555,4 @@ $bunny->insertPullZoneLogs($id, $date);
553555
## TODO
554556

555557
* Proper exception handling
556-
* Improve action logging
558+
* Improve action logging

src/BunnyAPI.php

Lines changed: 22 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -179,6 +179,16 @@ public function listPullZones()
179179
return $this->APIcall('GET', 'pullzone');
180180
}
181181

182+
/**
183+
* Gets a single pull zone information
184+
* @param int $id
185+
* @return string
186+
*/
187+
public function getPullZone(int $id)
188+
{
189+
return $this->APIcall('GET', "pullzone/$id");
190+
}
191+
182192
/**
183193
* Creates pull zone
184194
* @param string $name
@@ -198,6 +208,17 @@ public function createPullZone(string $name, string $origin, array $args = array
198208
return $this->APIcall('POST', 'pullzone', json_encode($args));
199209
}
200210

211+
/**
212+
* Updates pull zone
213+
* @param int $id
214+
* @param array $args
215+
* @return string
216+
*/
217+
public function updatePullZone(int $id, array $args = array())
218+
{
219+
return $this->APIcall('POST', "pullzone/$id", json_encode($args));
220+
}
221+
201222
/**
202223
* Returns pull zone information for id
203224
* @param int $id
@@ -1223,4 +1244,4 @@ public function costCalculator(int $bytes): array
12231244
);
12241245
}
12251246

1226-
}
1247+
}

0 commit comments

Comments
 (0)