Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Added basic Google maps support.

  • Loading branch information...
commit 3c6a3f30a4fcf28adaf99cb5f92f42495560bca1 1 parent 746dd6f
@m4tthumphrey authored
Showing with 40 additions and 0 deletions.
  1. +1 −0  bootstrap.php
  2. +39 −0 classes/provider/googlemaps.php
View
1  bootstrap.php
@@ -24,6 +24,7 @@
'Api\\Api_HTTP_Auth_Basic' => __DIR__.'/classes/provider/httpauth/basic.php',
'Api\\Api_Asana' => __DIR__.'/classes/provider/httpauth/basic/asana.php',
+ 'Api\\Api_Googlemaps' => __DIR__.'/classes/provider/googlemaps.php',
'Api\\Api_Mailchimp' => __DIR__.'/classes/provider/mailchimp.php',
'Api\\Api_Lastfm' => __DIR__.'/classes/provider/lastfm.php',
'Api\\Api_Postmark' => __DIR__.'/classes/provider/postmark.php',
View
39 classes/provider/googlemaps.php
@@ -0,0 +1,39 @@
+<?php
+
+namespace Api;
+
+class Api_Googlemaps extends Api
+{
+ public function __construct($options = array())
+ {
+ }
+
+ public function api_url()
+ {
+ return 'http://maps.googleapis.com/maps/api/%s/json';
+ }
+
+ public function callback($request)
+ {
+ $message = 'An error occurred connecting to the Google Map servers';
+
+ try
+ {
+ $data = $request->execute();
+ $data = json_decode($data);
+
+ if ($data->status != 'OK')
+ {
+ throw new ApiException($data->status);
+ }
+
+ return $data;
+ }
+ catch (\Exception $e)
+ {
+ throw new ApiException($e->getMessage());
+ }
+
+ throw new ApiException($message);
+ }
+}
Please sign in to comment.
Something went wrong with that request. Please try again.