Skip to content

hrovira/Backbone.GoogleAPIs

Repository files navigation

backbone.googleapis

UNDER DEVELOPMENT

Test Page / Live Demo

Table Of Contents

  • Overview
    • Supported Kinds
  • Notes
    • Dependencies
    • Expectations
    • Not Implemented
    • Renamed Functions
  • Backbone.GoogleAPIs
    • Class API Descriptions
      • Google Drive
      • Google Plus
      • Google Cloud Storage
    • Class Hierarchy
    • Published Events
  • Usage
    • Bower
    • Require.JS (AMD)
    • Plain HTML/Javascript

This library extends Backbone.js Model to provide CRUD operations compatible with the following Google APIs:

Supported Kinds

drive#about drive#app drive#change drive#childReference
drive#parentReference drive#permission drive#revision drive#property
drive#comment drive#commentReply drive#appList drive#changeList
drive#fileList drive#appList drive#childList drive#parentList
drive#permissionList drive#revisionList drive#propertyList drive#commentList
drive#commentReplyList drive#file
storage#bucket storage#bucketAccessControl storage#object storage#objectAccessControl
storage#buckets storage#bucketAccessControls storage#objects storage#objectAccessControls
plus#person plus#peopleFeed plus#moment plus#momentsFeed
plus#activity plus#activityFeed plus#comment plus#commentFeed

Dependencies

  • jQuery: ~2.0.3
  • Underscore.js: ~1.4.4
  • Backbone.js: ~1.0.0
  • Require.js: ~2.1.5

Ironically, Require.js is not actually a required dependency. This library supports clients with and without AMD support

Expectations

Not Implemented (requires Web Sockets Service)

  • Channels
  • Realtime
  • File.watch
  • Changes.watch (todo: integrate web sockets)

Renamed Functions

  • All Classes
    • 'get' -> use 'fetch' (to avoid conflict with Backbone.Model.get)
  • List
    • 'list' <-> 'fetch'

Bower

    bower install backbone.googleapis

Require.JS (AMD)

    define(["jquery", "underscore", "backbone", "backbone.googleapis"],
        function ($, _, Backbone) {
            var fileInstance = new Backbone.GoogleAPIs.Drive.File({});
            var otherFile = Backbone.GoogleAPIs.ModelFactory({ "kind": "drive#file" });
            var CustomModel = Backbone.GoogleAPIs.Model.extend({ });
        });

Plain HTML/Javascript

    <script type="text/javascript" src="//cdnjs.cloudflare.com/ajax/libs/jquery/2.1.0/jquery.min.js"></script>
    <script type="text/javascript" src="//cdnjs.cloudflare.com/ajax/libs/underscore.js/1.6.0/underscore-min.js"></script>
    <script type="text/javascript" src="//cdnjs.cloudflare.com/ajax/libs/backbone.js/1.1.2/backbone-min.js"></script>
    <script type="text/javascript" src="//rawgithub.com/hrovira/Backbone.GoogleAPIs/backbone.googleapis.js"></script>
    <script type="text/javascript">
        $( document ).ready(function() {
            var fileInstance = new Backbone.GoogleAPIs.Drive.File({});
            var otherFile = Backbone.GoogleAPIs.ModelFactory({ "kind": "drive#file" });
            var CustomModel = Backbone.GoogleAPIs.Model.extend({ });
        });
    </script>

Instantiation Modes

    // model instance by kind
    var model = Backbone.GoogleAPIs.ModelFactory({ "kind": "google#supported" });
    var list = Backbone.GoogleAPIs.ModelFactory({ "kind": "google#supportedList" });

    // model instance by class hierarcy
    var model = new Backbone.GoogleAPIs.Drive.File();
    var model = new Backbone.GoogleAPIs.Drive.ChangeList();

Releases

No releases published

Packages

No packages published