Skip to content

Instantly share code, notes, and snippets.

View kborchers's full-sized avatar

Kris Borchers kborchers

  • GM Financial
  • Dallas, TX
  • 08:52 (UTC -05:00)
View GitHub Profile
// All taken from https://github.com/aerogear/aerogear-js/blob/master/src/pipeline/adapters/rest.js
// When creating a new REST based pipe, a recordId can be configured
// An app using the lib can then use what ever record identifier it wants
aerogear.pipeline.adapters.rest = function( pipeName, recordId, settings ) { ... }
// Then during a save, I can check for a value assigned to that id to determine the request type
type = data[ this.recordId ] ? "PUT" : "POST";
// After that we get into whether or not data sync is happening, etc. but I do not rely on a particular record identifier
$.fn.serializeJSON = function() {
var o = {};
var a = this.serializeArray();
$.each(a, function() {
if (o[this.name]) {
if (!o[this.name].push) {
o[this.name] = [o[this.name]];
}
o[this.name].push(this.value || '');
} else {
diff --git a/src/authentication/adapters/rest.js b/src/authentication/adapters/rest.js
index 680e000..41e4b19 100644
--- a/src/authentication/adapters/rest.js
+++ b/src/authentication/adapters/rest.js
@@ -6,196 +6,232 @@
*
**/
aerogear.auth.adapters.rest = function( moduleName, settings ) {
- var endPoints = settings && settings.endPoints || {};
+ // Allow instantiation without using new
@kborchers
kborchers / gist:3833435
Created October 4, 2012 13:11 — forked from matzew/gist:3832056
FAQ or Wiki or ...
  • What is a pipeline ?

A pipeline represents a set of n connections to a server. The pipeline class offers some simple 'management' APIs to work with containing 'pipe' objects. Basically it allows you to add or remove new connections to the pipeline.

  • What is a pipe ?

A pipe represents one connection to a server. The pipe API is basically an abstraction layer for any server side connection, which all allows you to simply 'read' from, or 'write' to a server connection. However, technical details like RESTful APIs (e.g. HTTP PUT or HTTT GET) are not exposed on the pipeline and pipe APIs. In the future you can have different type of pipe objects (-> connections). The default (and CURRENTLY only supported) type is a REST connection.

Below is an example from our JavaScript lib:

this.getData = function() {
return data;
};
this.setData = function( newData ) {
data = newData;
};
this.addDataRecord = function( record ) {
data.push( record );
};
this.removeDataRecord = function( record ) {
module PDoc
module Generators
module Html
module Helpers
module BaseHelper
def content_tag(tag_name, content, attributes = {})
"<#{tag_name}#{attributes_to_html(attributes)}>#{content}</#{tag_name}>"
end
def img_tag(filename, attributes = {})

Title

Mobile App Development for the Enterprise

Abstract

This session will start with a brief intro to mobile apps including everything from HTML5 to Hybrid to Native and some of the reasons developers choose one over the other. We'll then touch on some of the concerns enterprise developers need to be aware of when selecting one of those technologies. Then we'll dive into some demos and code from the AeroGear project, a JBoss Community project, and show how this set of tools currently can and plans to meet the needs of those enterprise and non-enterprise app developers.

#AeroGear.AutoConfig

The idea of this utility is to provide a method to automatically configure the client side connections to server resources (Pipeline) via a request for the JSON config to the server from an AeroGear client.

Currently, to set up and use a single connection to the server (pipe) you can use the following:

// Set up a pipeline which contains one pipe using the default REST adapter
var userPipeline = AeroGear.Pipeline( "users" ),
	users = userPipeline.pipes.users;
var pipeline = AeroGear.Pipeline({
name:"capitals",
recordId: "name",
settings:{
baseURL:'/rs/'
}
});
var capitals = pipeline.pipes['capitals'];
$(function() {
var progressbar = $( "#progressbar" ),
progressLabel = $( ".progress-label" );
progressbar.progressbar({
value: false,
change: function() {
progressLabel.text( progressbar.progressbar( "value" ) + "%" );
},
complete: function() {