Skip to content

Commit

Permalink
Merge pull request #7 from macbookandrew/feature/update-pull-zone
Browse files Browse the repository at this point in the history
add getPullZone and updatePullZone methods
  • Loading branch information
cp6 committed Dec 13, 2020
2 parents d9c6657 + 0fcf0d4 commit 97a783d
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 3 deletions.
6 changes: 4 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# BunnyCDN API Class
The most comprehensive, feature packed and easy to use PHP class for the BunnyCDN pull and storage zones [API](https://bunnycdn.docs.apiary.io/).

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


Expand Down Expand Up @@ -46,7 +46,9 @@ If you want to interact with storage zones you will need your BunnyCDN API key s
* View monthly charge breakdown
* Apply coupon code
* List pull zones
* Get pull zone
* Add pull zone
* Update pull zone
* Delete pull zone
* Purge pull zone
* Add hostname to pull zone
Expand Down Expand Up @@ -553,4 +555,4 @@ $bunny->insertPullZoneLogs($id, $date);
## TODO

* Proper exception handling
* Improve action logging
* Improve action logging
23 changes: 22 additions & 1 deletion src/BunnyAPI.php
Original file line number Diff line number Diff line change
Expand Up @@ -179,6 +179,16 @@ public function listPullZones()
return $this->APIcall('GET', 'pullzone');
}

/**
* Gets a single pull zone information
* @param int $id
* @return string
*/
public function getPullZone(int $id)
{
return $this->APIcall('GET', "pullzone/$id");
}

/**
* Creates pull zone
* @param string $name
Expand All @@ -198,6 +208,17 @@ public function createPullZone(string $name, string $origin, array $args = array
return $this->APIcall('POST', 'pullzone', json_encode($args));
}

/**
* Updates pull zone
* @param int $id
* @param array $args
* @return string
*/
public function updatePullZone(int $id, array $args = array())
{
return $this->APIcall('POST', "pullzone/$id", json_encode($args));
}

/**
* Returns pull zone information for id
* @param int $id
Expand Down Expand Up @@ -1223,4 +1244,4 @@ public function costCalculator(int $bytes): array
);
}

}
}

0 comments on commit 97a783d

Please sign in to comment.