Skip to content

Instantly share code, notes, and snippets.

@matzew
Created November 14, 2012 13:38
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save matzew/4072105 to your computer and use it in GitHub Desktop.
Save matzew/4072105 to your computer and use it in GitHub Desktop.
DEV RELEASE (Nov 13th, 2012)

Dev Release from November 13th, 2012

Highlights are a more fluent API to create pipes,stores and authModules as well as using configuration objects!

Get it from the CocoaPods repo!

Pipe creation

// NSURL object:
NSURL* serverURL = [NSURL URLWithString:@"http://todo-aerogear.rhcloud.com/todo-server/"];

// create the 'todo' pipeline, which points to the baseURL of the REST application
AGPipeline* todo = [AGPipeline pipeline:serverURL];

// Add a REST pipe for the 'projects' endpoint
id<AGPipe> projects = [pipeline pipe:^(id<AGPipeConfig> config) {
    [config name:@"projects"];
    [config type:@"REST"];
}];

Store creation

// create the datamanager
AGDataManager* dm = [AGDataManager manager];
// add a new (default) store object:
id<AGStore> myStore = [dm store:^(id<AGStoreConfig> config) {
    [config name:@"tasks"];
    [config TYPE:@"MEMORY"];
}];

AuthModule creation

// create an authenticator object
AGAuthenticator* authenticator = [AGAuthenticator authenticator];

// add a new auth module and the required 'base url':
NSURL* baseURL = [NSURL URLWithString:@"https://todoauth-aerogear.rhcloud.com/todo-server/"];
id<AGAuthenticationModule> myMod = [authenticator auth:^(id<AGAuthConfig> config) {
    [config name:@"authMod"];
    [config baseURL:baseURL];
}];
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment