Skip to content

sebastianovide/GeoSpockWeb

 
 

Repository files navigation

GeoSpock Web Build Status

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.

1. Installation

  • bower install GeoSpockWeb

2. Usage

  • 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));
  });

3. GitHuh contributions

4. Development

  • install node (I like nvm)
  • npm install -g gulp
  • npm install
  • gulp to see the list of available tasks

5. Essential Gulp Task

  • gulp test runs the tests and linting for all files in the folder src.

About

JS Library to use GeoSpock services

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

  • JavaScript 99.0%
  • HTML 1.0%