A Web SDK for using GeoSpock APIs. Check out the demo. This SDK is a thin wrapper around REST.js (see https://github.com/cujojs/rest) and therefore is uses WHEN.js promises (cujojs). All the SDK methods returns a promise which is resolved when the ajax call succeed and fails if the ajax call encounters errors.
bower install GeoSpockWeb
- Add it to your site
<script src="bower_components/GeoSpockWeb/dist/geospockweb.min.js"></script>
- Instantiate it
var geoSpockWeb = new GeoSpockWeb(serverUrl, apiKey);
- GET
geoSpockWeb
.get(id, type)
.then(function(response) {
console.log("Response from the server: " + JSON.stringify(response));
})
.fail(function(response){
console.log("Something went wrong doing get: " + JSON.stringify(response));
});
- POST
geoSpockWeb
.post(data, type)
.then(function(response) {
console.log("Response from the server: " + JSON.stringify(response));
});
})
.fail(function(response){
console.log("Something went wrong doing get: " + JSON.stringify(response));
});
- PUT
geoSpockWeb
.put(id, data, type)
.then(function(response) {
console.log("Response from the server: " + JSON.stringify(response));
})
.fail(function(response){
console.log("Something went wrong doing get: " + JSON.stringify(response));
});
- DELETE
geoSpockWeb
.delete(id, type)
.then(function(response) {
console.log("Response from the server: " + JSON.stringify(response));
})
.fail(function(response){
console.log("Something went wrong doing get: " + JSON.stringify(response));
});
- fork https://github.com/Geovation/GeoSpockWeb
- work on it, commit and push into your repo
- from GitHub ask for a pull request
- install node (I like nvm)
npm install -g gulp
npm install
gulp
to see the list of available tasks
gulp test
runs the tests and linting for all files in the foldersrc
.