An extensible, JavaScript REST client base class.
JavaScript CoffeeScript Ruby
Switch branches/tags
Nothing to show
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Failed to load latest commit information.
build
dist
public
src
.gitignore
.npmignore
.travis.yml
Gemfile
Gruntfile.js
README.md
package.json
test.js

README.md

Breathe Easy

Build Status

An extensible, JavaScript REST client base class.

Usage

Breathe Easy is a barebones set of objects for constructing RESTful JavaScript web service consumers.

That being said, it also provides an object called Smoother that removes much of the boilerplate involved in constructing a client.

Basic Usage with Smoother

Include smoother.min.js and you're good to go.

Let's say we want to represent GitHub's users api.

Github = Smoother.new('https://api.github.com');
Github.register('User', function() {
  this.base('users');
  this.member(function() {
    this.setup(function(username) {
      this.username = username;
    });
    this.base(function() {
      return this.username;
    });
    this.get('gists');
  });
});
u = Github.User.new('benastan');
u.url();
=> https://api.github.com/users/benastan
u.get().done(function(user) { console.log(user.id); });
=> 588040
u.gists().done(function(gists) { console.log(gists[0].description); });
=> Stupid simple rails modals.

Sweet damn! An API Consumer in 10 lines.