Skip to content

Commit

Permalink
Merge pull request hove-io#28 from CanalTP/api_entry_point_corrections
Browse files Browse the repository at this point in the history
Jormungandr: Small changes in the api
  • Loading branch information
kinnou02 committed Nov 28, 2013
2 parents 1286995 + 8de0b84 commit 15e324d
Show file tree
Hide file tree
Showing 7 changed files with 16 additions and 13 deletions.
1 change: 0 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
stats
debug
release
fast
Doc
qtcreator-build
ui_mainwindow.h
Expand Down
2 changes: 1 addition & 1 deletion source/jormungandr/flask-restful
6 changes: 3 additions & 3 deletions source/jormungandr/index.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
from flask.ext.restful import Resource

from flask import url_for

def index(api):
api.add_resource(Index, '/')
Expand All @@ -14,7 +14,7 @@ def get(self):
"status" : "deprecated",
"links" : [
{
"href" : "http://api.navitia.io/v0",
"href" : url_for("v0", _external=True),
"templated" : False
}
]
Expand All @@ -25,7 +25,7 @@ def get(self):
"status" : "current",
"links" : [
{
"href" : "http://api.navitia.io/v1",
"href" : url_for("v1.index", _external=True),
"templated" : False
}
]
Expand Down
3 changes: 3 additions & 0 deletions source/jormungandr/interfaces/v0_routing.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,9 @@ def __init__(self, *args, **kwargs):

def v0_routing(api):
api.app.url_map.converters['region'] = RegionConverter
api.add_resource(Regions.Regions,
'/v0/regions.json',
endpoint='v0') #it just redirect to regions
api.add_resource(Regions.Regions,
'/v0/regions.json',
endpoint='v0.regions')
Expand Down
3 changes: 2 additions & 1 deletion source/jormungandr/interfaces/v1/Coord.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,8 @@ def get(self, region=None, lon=None, lat=None, id=None, *args, **kwargs):
"distance" : 200,
"type[]" : ["address"],
"depth" : 1,
"start_page": 0
"start_page": 0,
"filter" : ""
}
pb_result = InstanceManager().dispatch(args, self.region, "places_nearby")
if len(pb_result.places_nearby) > 0:
Expand Down
10 changes: 6 additions & 4 deletions source/jormungandr/interfaces/v1/Index.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#coding=utf-8
from flask import Flask, url_for, current_app
from flask import url_for
from flask.ext.restful import Resource

class Index(Resource):
Expand All @@ -9,10 +9,12 @@ def get(self):
{"href" : url_for('v1.coverage', _external=True),
"rel" : "coverage",
"title" : "Coverage of navitia"},
{"href" : "/coord/lon;lat",
{"href" : url_for('v1.coord', lon=.0, lat=.0, _external=True),#TODO find a way to display {long:lat} in the url
"rel" : "coord",
"title" : "Inverted geocooding" },
{"href" : "v1/journeys",
"title" : "Inverted geocoding for a given longitude and latitude",
"templated" : True
},
{"href" : url_for('v1.journeys', _external=True),
"rel" : "journeys",
"title" : "Compute journeys"}
]
Expand Down
4 changes: 1 addition & 3 deletions source/jormungandr/interfaces/v1_routing.py
Original file line number Diff line number Diff line change
Expand Up @@ -65,9 +65,7 @@ def v1_routing(api):
endpoint='v1.coverage')

api.add_resource(Coord.Coord,
region + 'coord',
region + 'coord/<lon:lon>;<lat:lat>',
coord,
'/v1/coord/<lon:lon>;<lat:lat>',
endpoint='v1.coord')

collections = converters_collection_type.collections_to_resource_type.keys()
Expand Down

0 comments on commit 15e324d

Please sign in to comment.