From fdd8d0cd04a45163e2b45df5bc0b40a5fd153013 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Pierre=20Mazi=C3=A8re?= Date: Sat, 25 Jun 2016 09:57:02 +0200 Subject: [PATCH] new bridge: StripeAPIChangeLog MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Pierre Mazière --- bridges/StripeAPIChangeLogBridge.php | 45 ++++++++++++++++++++++++++++ 1 file changed, 45 insertions(+) create mode 100644 bridges/StripeAPIChangeLogBridge.php diff --git a/bridges/StripeAPIChangeLogBridge.php b/bridges/StripeAPIChangeLogBridge.php new file mode 100644 index 00000000..664c96fb --- /dev/null +++ b/bridges/StripeAPIChangeLogBridge.php @@ -0,0 +1,45 @@ +maintainer = 'Pierre Mazière'; + $this->name = 'Stripe API Changelog'; + $this->uri = ''; + $this->description = 'Returns the changes made to the stripe.com API'; + $this->update = '2016-06-20'; + } + + public function collectData(array $param){ + $html = file_get_html('https://stripe.com/docs/upgrades') + or $this->returnError('No results for Stripe API Changelog', 404); + + + foreach($html->find('h2') as $change){ + $item=new \Item(); + $item->title=trim($change->plaintext); + $item->uri='https://stripe.com/docs/upgrades#'.$item->title; + $item->name='stripe'; + $item->content=$change->nextSibling()->outertext; + $item->timestamp=strtotime($item->title); + $this->items[]=$item; + } + } + + public function getName(){ + return 'Stripe API Changelog'; + } + + public function getURI(){ + return 'https://stripe.com/docs/upgrades'; + } + + public function getCacheDuration(){ + return 86400; // one day + } +}