Пример #1
0
def get_routes():
    path = request.path
    representation = HALRepresentation({})
    representation.add_curie('hl', TRANSPORT_CURIE)
    representation.add_link('self', '{bp}'.format(bp=path))
    representation.add_link('hl:p-r', '{bp}park-and-rides'.format(bp=path),
                            title='Park and Rides Real-Time Information')
    response = make_response(representation.as_json(), 200)
    response.headers['Content-Type'] = "application/json"
    return response
Пример #2
0
def get_routes():
    path = request.path
    representation = HALRepresentation({})
    representation.add_curie('hl', 'http://moxie.readthedocs.org/en/latest/http_api/contact.html#{rel}')
    representation.add_link('self', '{bp}'.format(bp=path))
    representation.add_link('hl:search', '{bp}search?q={{q}}&medium={{medium}}'.format(bp=path),
                            templated=True, title='Search')
    response = make_response(representation.as_json(), 200)
    response.headers['Content-Type'] = "application/json"
    return response
Пример #3
0
def get_routes():
    path = request.path
    representation = HALRepresentation({})
    representation.add_curie('hl', 'http://moxie.readthedocs.org/en/latest/http_api/library.html#{rel}')
    representation.add_link('self', '{bp}'.format(bp=path))
    representation.add_link('hl:search', '{bp}search?title={{title}}&author={{author}}&isbn={{isbn}}'.format(bp=path),
                            templated=True, title='Search')
    representation.add_link('hl:item', '{bp}item:{{id}}'.format(bp=path),
                            templated=True, title='POI detail')
    response = make_response(representation.as_json(), 200)
    response.headers['Content-Type'] = "application/json"
    return response
Пример #4
0
def get_routes():
    path = request.path
    representation = HALRepresentation({})
    representation.add_curie('hl', 'http://moxie.readthedocs.org/en/latest/http_api/oxford_dates.html#{rel}')
    representation.add_link('self', '{bp}'.format(bp=path))
    representation.add_link('hl:today', '{bp}today'.format(bp=path),
                            title='Today date')
    representation.add_link('hl:date', '{bp}{{yyyy}}-{{mm}}-{{dd}}'.format(bp=path),
                            templated=True, title="Format arbitrary date")
    response = make_response(representation.as_json(), 200)
    response.headers['Content-Type'] = "application/json"
    return response
Пример #5
0
def get_routes():
    path = request.path
    representation = HALRepresentation({})
    representation.add_curie('hl', CURIE_ENDPOINT)
    representation.add_link('self', '{bp}'.format(bp=path))
    representation.add_link('hl:bookings', '{bp}bookings'.format(bp=path), title="Bookings")
    representation.add_link('hl:subjects', '{bp}subjects'.format(bp=path), title="Subjects")
    representation.add_link('hl:search', '{bp}search?q={{q}}'.format(bp=path),
                            templated=True, title='Search')
    representation.add_link('hl:course', '{bp}course/{{id}}'.format(bp=path),
                            templated=True, title='Course details')
    response = make_response(representation.as_json(), 200)
    response.headers['Content-Type'] = "application/json"
    return response
Пример #6
0
def get_routes():
    path = request.path
    representation = HALRepresentation({})
    representation.add_curie('hl', PLACES_CURIE)
    representation.add_link('self', '{bp}'.format(bp=path))
    representation.add_link('hl:search', '{bp}search?q={{q}}'.format(bp=path),
                            templated=True, title='Search')
    representation.add_link('hl:types', '{bp}types'.format(bp=path),
            title='List of types')
    representation.add_link('hl:detail', '{bp}{{id}}'.format(bp=path),
                            templated=True, title='POI detail')
    representation.add_link('hl:rti',
            '{bp}{{id}}/rti/{{type}}'.format(bp=path), templated=True,
            title='Real-Time Information for a given POI')
    response = make_response(representation.as_json(), 200)
    response.headers['Content-Type'] = "application/json"
    return response
Пример #7
0
def get_routes():
    path = request.path
    representation = HALRepresentation({})
    representation.add_curie(
        'hl',
        'http://moxie.readthedocs.org/en/latest/http_api/events.html#{rel}')
    representation.add_link('self', '{bp}'.format(bp=path))
    representation.add_link('hl:search',
                            '{bp}search'.format(bp=path),
                            title="Search events")
    representation.add_link('hl:event',
                            '{bp}event/{{id}}'.format(bp=path),
                            templated=True,
                            title="Event")
    response = make_response(representation.as_json(), 200)
    response.headers['Content-Type'] = "application/json"
    return response