GithubHelp home page GithubHelp logo

freshbone's Introduction

freshbone

web application framework for building freshbooks applications based on its public API. This framework was build as a layer on top of Backbone.js.

This Framework is under development and is currently not considered stable.

Freshbooks public API - XML Requests

  • Backbone works well with Restful JSON APIs, but Freshbooks API is not Restful (yet) and works only with XML. Freshbone hooks the necessary pieces so that the application developer doesn't have to deal with that in his application.

e.g: to fetch model:

    var staff = new Freshbone.Model({'staff_id' : 1});
    staff.fetch({
        success : function(model, resp) {
            console.log(model.attributes);
        }
    });

Freshbooks public API - XML Responses

  • Backbone expects a JSON response and parse it as a JavaScript object, but Freshbooks sends back an XML response, so the framework takes care of properly parsing the response sent into the appropriate JavaScript objects.

e.g: access staff member information

    var staff = new Freshbone.Model({'staff_id' : 1});
    staff.fetch({
        success : function(model, resp) {
            console.log(model.attributes);
        }
    });

Freshbone API Errors

  • Backbone expect erros to be HTTP Response failures, but Freshbooks sends API errors as valid HTTP responses, so Freshbone hooks into the appropriate methods to make sure the right event handlers are called and that they have access to an error object containing information about the error.

e.g: fetching an inxisting staff member

    var staff = new Freshbone.Model({'staff_id' : 1});
    staff.fetch({
        success : function(model, resp) {
            ...
        },
        error : function(model, resp, xhr) {
            console.log(resp.error);
        }
    });

Freshbone Local Caching

  • Backbone requests always triggers an Ajax call to process the data (read, create, update, delete). But for Freshbooks we want to deliver to the end-user a better experience on our applications, so we decided to implement a local caching layer on top of Backbone, so that we can reuse already fetched data. The local caching has two layers: memory - for fast access to the lastest list api call, and localStorage where all api list calls are stored, if a resource is not avaialble in any of those layers the framework will issue an Ajax call keeping the local caching updated.

Freshbone Pages

  • This component is responsible for managing application pages (basically screens of the application), each page will have one or many views associated with it, and a page can register subpages making easier the management of nested pages. The Page object extends from the View object.

Freshbone Forms

  • This object is responsible for html form serialization, input validation and for converting form data into a valid Model.

Freshbone Transition

  • This object is responsible for managing the screen transitions of Freshbone applications, making sure the origin and destination pages stay in the desired state.

freshbone's People

Contributors

marcos-abreu avatar

Stargazers

 avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.