FFCStorage 0.1.0

FFCStorage 0.1.0

TestsTested
LangLanguage Obj-CObjective C
License MIT
ReleasedLast Release May 2015

Maintained by Fabian Canas.



 
Depends on:
SafeCast~> 1.1.1
FXKeychain~> 1.5.2
 

Auth and Network handling so you can store models in a RESTful API.

// Configure a network client
FFCNetworkClient *networkClient = [[FFCNetworkClient alloc] initWithHost:@"api.example.com" path:@"v1"];
[networkClient makeDefaultClient];

// Get some models
FFCNetworkStore *networkStore = [[FFCNetworkStore alloc] init];
[networkStore getClass:[Foo class] completion:^(NSArray *foos, NSError *error) {
    // we have foos
}];

Model classes that can be CRUDed just need to implement a simple protocol:

@protocol FFCStoreModel <NSObject>

@property (nonatomic, assign) NSInteger id; // remote id

- (NSString *)route; // route for instance
+ (NSString *)route; // route for class

- (NSDictionary *)asJSON; // Serialize into dictionary if class is POST/PUTable
@end