Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

added service discovery page and corresponding api config-file

  • Loading branch information...
commit ddf84043f47bb122ceee30c69b8c67edce5aa5d3 1 parent 59f798c
@markaspot authored
View
3  config/routes.php
@@ -14,7 +14,6 @@
Router::connect("/open311/requests",array('plugin' => 'open311' ,'controller' => 'open311','action' => 'add', '[method]' => 'POST'),array('id' => '[0-9]+|[A-Fa-f0-9]{8}-[A-Fa-f0-9]{4}-[A-Fa-f0-9]{4}-[A-Fa-f0-9]{4}-[A-Fa-f0-9]{12}', 'pass' => array('id')));
-
- //Router::connect("/open311/service/",array('controller' => 'open311', "action" => "service", "[method]" => "GET"));
+ Router::connect("/open311/discovery",array('plugin' => 'open311' ,'controller' => 'open311','action' => 'discovery', '[method]' => 'GET'));
?>
View
17 controllers/components/open311.php
@@ -125,5 +125,22 @@ function mapRequest($data) {
return $this->data;
}
+
+
+function mapConfigDiscovery() {
+ Configure::load('open311');
+
+ $discovery['changeset'] = Configure::read('open311.changeset');
+ $discovery['contact'] = Configure::read('open311.contact');
+ $discovery['key_service'] = Configure::read('open311.contact');
+ $discovery['endpoints']['specification'] = "http://wiki.open311.org/GeoReport_v2";
+ $discovery['endpoints']['endpoint']['url'] = Configure::read('open311.url');
+ $discovery['endpoints']['endpoint']['changeset'] = "http://wiki.open311.org/GeoReport_v2";
+ $discovery['endpoints']['endpoint']['type'] = Configure::read('open311.type');
+ $discovery['endpoints']['endpoint']['url'] = Configure::read('open311.url');
+ $discovery['endpoints']['endpoint']['formats'] = Configure::read('open311.formats');
+ return $discovery;
+
+ }
}
View
14 controllers/open311_controller.php
@@ -52,6 +52,8 @@ class Open311Controller extends AppController {
public function beforeFilter () {
// Try to login user via REST
+ $this->Auth->allow(array('discovery'));
+
if ($this->Rest->isActive()) {
if ($this->Auth->user('id') && $this->params['url']['apikey']) {
@@ -168,6 +170,18 @@ function services() {
$this->set(compact('services'));
$this->render('services');
}
+
+
+ /**
+ * method to describe api
+ *
+ * @return void
+ */
+
+ function discovery(){
+ $discovery = $this->Open311->mapConfigDiscovery();
+ $this->set(compact('discovery'));
+ }
/**
* post request / add marker
View
11 readme.textile
@@ -20,6 +20,10 @@ h3. Install Open311-Plugin
pre. git submodule add git://github.com/markaspot/mas-open311.git plugins/open311
git submodule update --init
+h3. Copy config file
+
+Copy @plugins/config/open311.php@ in @app/config/@
+
h3. Adding the plugin to your app_controller
Simply add the plugin as another component.
@@ -34,11 +38,10 @@ Service endpoint will be @/open311/@ as controller and custom actions in REST-fo
h2. Things to do:
-* adding JSON Support,
-* adding DELETE Requests
+* -adding JSON Support-
* adding GET Service Defininiton
-* adding GET request_id from token
-* adding jurisdiction ID where and if neccessary
+* -adding jurisdiction ID where and if neccessary-
+* -adding Service Discovery-
* custom validation for requests
* better error handling
Please sign in to comment.
Something went wrong with that request. Please try again.