Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Merge pull request #59 from workhabitinc/master

merge master to dev.
  • Loading branch information...
commit ccf02145039eb65cca90f1ad8925360dd044ae17 2 parents fb8e8bc + e154dd4
@kylebrowning authored
View
12 DIOSComment.h
@@ -40,30 +40,30 @@
@interface DIOSComment : NSObject
-- (void)commentGet:(NSDictionary *)comment
++ (void)commentGet:(NSDictionary *)comment
success:(void (^)(AFHTTPRequestOperation *operation, id responseObject)) success
failure:(void (^)(AFHTTPRequestOperation *operation, NSError *error)) failure;
-- (void)commentSave:(NSDictionary *)comment
++ (void)commentSave:(NSDictionary *)comment
success:(void (^)(AFHTTPRequestOperation *operation, id responseObject)) success
failure:(void (^)(AFHTTPRequestOperation *operation, NSError *error)) failure;
-- (void)commentUpdate:(NSDictionary *)comment
++ (void)commentUpdate:(NSDictionary *)comment
success:(void (^)(AFHTTPRequestOperation *operation, id responseObject)) success
failure:(void (^)(AFHTTPRequestOperation *operation, NSError *error)) failure;
-- (void)commentDelete:(NSDictionary *)comment
++ (void)commentDelete:(NSDictionary *)comment
success:(void (^)(AFHTTPRequestOperation *operation, id responseObject)) success
failure:(void (^)(AFHTTPRequestOperation *operation, NSError *error)) failure;
-- (void)commentIndexWithPage:(NSString *)page
++ (void)commentIndexWithPage:(NSString *)page
fields:(NSString *)fields
parameters:(NSArray *)parameteres
pageSize:(NSString *)pageSize
success:(void (^)(AFHTTPRequestOperation *operation, id responseObject)) success
failure:(void (^)(AFHTTPRequestOperation *operation, NSError *error)) failure;
-- (void)commentIndex:(NSDictionary *)params
++ (void)commentIndex:(NSDictionary *)params
success:(void (^)(AFHTTPRequestOperation *operation, id responseObject)) success
failure:(void (^)(AFHTTPRequestOperation *operation, NSError *error)) failure;
@end
View
12 DIOSComment.m
@@ -42,7 +42,7 @@ @implementation DIOSComment
#pragma mark CommentGet
-- (void)commentGet:(NSDictionary *)comment
++ (void)commentGet:(NSDictionary *)comment
success:(void (^)(AFHTTPRequestOperation *operation, id responseObject)) success
failure:(void (^)(AFHTTPRequestOperation *operation, NSError *error)) failure {
@@ -53,7 +53,7 @@ - (void)commentGet:(NSDictionary *)comment
}
#pragma mark commentSave
-- (void)commentSave:(NSDictionary *)comment
++ (void)commentSave:(NSDictionary *)comment
success:(void (^)(AFHTTPRequestOperation *operation, id responseObject)) success
failure:(void (^)(AFHTTPRequestOperation *operation, NSError *error)) failure {
[[DIOSSession sharedSession] postPath:[NSString stringWithFormat:@"%@/%@", kDiosEndpoint, kDiosBaseComment]
@@ -63,7 +63,7 @@ - (void)commentSave:(NSDictionary *)comment
}
#pragma mark commentUpdate
-- (void)commentUpdate:(NSDictionary *)comment
++ (void)commentUpdate:(NSDictionary *)comment
success:(void (^)(AFHTTPRequestOperation *operation, id responseObject)) success
failure:(void (^)(AFHTTPRequestOperation *operation, NSError *error)) failure {
[[DIOSSession sharedSession] putPath:[NSString stringWithFormat:@"%@/%@/%@", kDiosEndpoint, kDiosBaseComment, [comment objectForKey:@"cid"]]
@@ -73,7 +73,7 @@ - (void)commentUpdate:(NSDictionary *)comment
}
#pragma mark CommentDelete
-- (void)commentDelete:(NSDictionary *)comment
++ (void)commentDelete:(NSDictionary *)comment
success:(void (^)(AFHTTPRequestOperation *operation, id responseObject)) success
failure:(void (^)(AFHTTPRequestOperation *operation, NSError *error)) failure; {
[[DIOSSession sharedSession] deletePath:[NSString stringWithFormat:@"%@/%@/%@", kDiosEndpoint, kDiosBaseComment, [comment objectForKey:@"cid"]] parameters:comment success:success failure:failure];
@@ -81,7 +81,7 @@ - (void)commentDelete:(NSDictionary *)comment
#pragma mark commentIndex
//Simpler method if you didnt want to build the params :)
-- (void)commentIndexWithPage:(NSString *)page
++ (void)commentIndexWithPage:(NSString *)page
fields:(NSString *)fields
parameters:(NSArray *)parameteres
pageSize:(NSString *)pageSize
@@ -96,7 +96,7 @@ - (void)commentIndexWithPage:(NSString *)page
[self commentIndex:commentIndexDict success:success failure:failure];
}
-- (void)commentIndex:(NSDictionary *)params
++ (void)commentIndex:(NSDictionary *)params
success:(void (^)(AFHTTPRequestOperation *operation, id responseObject)) success
failure:(void (^)(AFHTTPRequestOperation *operation, NSError *error)) failure; {
View
8 DIOSFile.h
@@ -37,9 +37,11 @@
#import "AFHTTPRequestOperation.h"
@interface DIOSFile : NSObject
-- (void) fileGet:(NSDictionary *)params
++ (void) fileGet:(NSDictionary *)params
success:(void (^)(AFHTTPRequestOperation *operation, id responseObject)) success
failure:(void (^)(AFHTTPRequestOperation *operation, NSError *error)) failure;
-
-- (UIImageView *) getImageViewForFileImage:(NSDictionary *) file;
++ (void) fileSave:(NSDictionary *)params
+ success:(void (^)(AFHTTPRequestOperation *operation, id responseObject)) success
+ failure:(void (^)(AFHTTPRequestOperation *operation, NSError *error)) failure;
++ (UIImageView *) getImageViewForFileImage:(NSDictionary *) file;
@end
View
14 DIOSFile.m
@@ -40,7 +40,7 @@
#import "DIOSSession.h"
@implementation DIOSFile
-- (void) fileGet:(NSDictionary *)params
++ (void) fileGet:(NSDictionary *)params
success:(void (^)(AFHTTPRequestOperation *operation, id responseObject)) success
failure:(void (^)(AFHTTPRequestOperation *operation, NSError *error)) failure {
@@ -50,10 +50,16 @@ - (void) fileGet:(NSDictionary *)params
failure:failure];
}
-- (void) fileSave:(NSDictionary *)params {
- //currently doesnt work :(
++ (void)fileSave:(NSDictionary *)file
+ success:(void (^)(AFHTTPRequestOperation *operation, id responseObject)) success
+ failure:(void (^)(AFHTTPRequestOperation *operation, NSError *error)) failure {
+
+ [[DIOSSession sharedSession] postPath:[NSString stringWithFormat:@"%@/%@", kDiosEndpoint, kDiosBaseFile]
+ parameters:file
+ success:success
+ failure:failure];
}
-- (UIImageView *) getImageViewForFileImage:(NSDictionary *) file; {
++ (UIImageView *) getImageViewForFileImage:(NSDictionary *) file; {
NSURL *url = [NSURL URLWithString:[file objectForKey:@"uri_full"]];
UIImageView *remoteImage = [[UIImageView alloc] initWithFrame:CGRectMake(0, 0, 100, 100)];
[remoteImage setImageWithURL:url];
View
14 DIOSNode.h
@@ -39,31 +39,31 @@
@interface DIOSNode : NSObject {
}
-- (void)nodeGet:(NSDictionary *)node
++ (void)nodeGet:(NSDictionary *)node
success:(void (^)(AFHTTPRequestOperation *operation, id responseObject)) success
failure:(void (^)(AFHTTPRequestOperation *operation, NSError *error)) failure;
-- (void)nodeSave:(NSDictionary *)node
++ (void)nodeSave:(NSDictionary *)node
success:(void (^)(AFHTTPRequestOperation *operation, id responseObject)) success
failure:(void (^)(AFHTTPRequestOperation *operation, NSError *error)) failure;
-- (void)nodeUpdate:(NSDictionary *)node
++ (void)nodeUpdate:(NSDictionary *)node
success:(void (^)(AFHTTPRequestOperation *operation, id responseObject)) success
failure:(void (^)(AFHTTPRequestOperation *operation, NSError *error)) failure;
-- (void)nodeDelete:(NSDictionary *)node
++ (void)nodeDelete:(NSDictionary *)node
success:(void (^)(AFHTTPRequestOperation *operation, id responseObject)) success
failure:(void (^)(AFHTTPRequestOperation *operation, NSError *error)) failure;
-- (void)nodeIndexWithPage:(NSString *)page fields:(NSString *)fields parameters:(NSArray *)parameteres pageSize:(NSString *)pageSize
++ (void)nodeIndexWithPage:(NSString *)page fields:(NSString *)fields parameters:(NSArray *)parameteres pageSize:(NSString *)pageSize
success:(void (^)(AFHTTPRequestOperation *operation, id responseObject)) success
failure:(void (^)(AFHTTPRequestOperation *operation, NSError *error)) failure;
-- (void)nodeIndex:(NSDictionary *)params
++ (void)nodeIndex:(NSDictionary *)params
success:(void (^)(AFHTTPRequestOperation *operation, id responseObject)) success
failure:(void (^)(AFHTTPRequestOperation *operation, NSError *error)) failure;
-- (void)nodeAttachFile:(NSDictionary *)params
++ (void)nodeAttachFile:(NSDictionary *)params
success:(void (^)(AFHTTPRequestOperation *operation, id responseObject)) success
failure:(void (^)(AFHTTPRequestOperation *operation, NSError *error)) failure;
@end
View
23 DIOSNode.m
@@ -40,7 +40,7 @@
@implementation DIOSNode
#pragma mark nodeGets
-- (void)nodeGet:(NSDictionary *)node
++ (void)nodeGet:(NSDictionary *)node
success:(void (^)(AFHTTPRequestOperation *operation, id responseObject)) success
failure:(void (^)(AFHTTPRequestOperation *operation, NSError *error)) failure {
@@ -51,7 +51,7 @@ - (void)nodeGet:(NSDictionary *)node
}
#pragma mark nodeSave
- - (void)nodeSave:(NSDictionary *)node
++ (void)nodeSave:(NSDictionary *)node
success:(void (^)(AFHTTPRequestOperation *operation, id responseObject)) success
failure:(void (^)(AFHTTPRequestOperation *operation, NSError *error)) failure {
@@ -62,29 +62,29 @@ - (void)nodeSave:(NSDictionary *)node
}
#pragma mark nodeUpdate
-- (void)nodeUpdate:(NSDictionary *)node
++ (void)nodeUpdate:(NSDictionary *)node
success:(void (^)(AFHTTPRequestOperation *operation, id responseObject)) success
failure:(void (^)(AFHTTPRequestOperation *operation, NSError *error)) failure {
- [[DIOSSession sharedSession] putPath:[NSString stringWithFormat:@"%@/%@/%@", kDiosEndpoint, kDiosBaseNode, [node objectForKey:@"cid"]]
+ [[DIOSSession sharedSession] putPath:[NSString stringWithFormat:@"%@/%@/%@", kDiosEndpoint, kDiosBaseNode, [node objectForKey:@"nid"]]
parameters:node
success:success
failure:failure];
}
#pragma mark nodeDelete
-- (void)nodeDelete:(NSDictionary *)node
++ (void)nodeDelete:(NSDictionary *)node
success:(void (^)(AFHTTPRequestOperation *operation, id responseObject)) success
failure:(void (^)(AFHTTPRequestOperation *operation, NSError *error)) failure {
- [[DIOSSession sharedSession] deletePath:[NSString stringWithFormat:@"%@/%@/%@", kDiosEndpoint, kDiosBaseNode, [node objectForKey:@"cid"]]
+ [[DIOSSession sharedSession] deletePath:[NSString stringWithFormat:@"%@/%@/%@", kDiosEndpoint, kDiosBaseNode, [node objectForKey:@"nid"]]
parameters:node
success:success
failure:failure];
}
#pragma mark nodeIndex
//Simpler method if you didnt want to build the params :)
-- (void)nodeIndexWithPage:(NSString *)page fields:(NSString *)fields parameters:(NSArray *)parameteres pageSize:(NSString *)pageSize
++ (void)nodeIndexWithPage:(NSString *)page fields:(NSString *)fields parameters:(NSArray *)parameteres pageSize:(NSString *)pageSize
success:(void (^)(AFHTTPRequestOperation *operation, id responseObject)) success
failure:(void (^)(AFHTTPRequestOperation *operation, NSError *error)) failure {
NSMutableDictionary *nodeIndexDict = [NSMutableDictionary new];
@@ -95,7 +95,7 @@ - (void)nodeIndexWithPage:(NSString *)page fields:(NSString *)fields parameters:
[self nodeIndex:nodeIndexDict success:success failure:failure];
}
-- (void)nodeIndex:(NSDictionary *)params
++ (void)nodeIndex:(NSDictionary *)params
success:(void (^)(AFHTTPRequestOperation *operation, id responseObject)) success
failure:(void (^)(AFHTTPRequestOperation *operation, NSError *error)) failure {
@@ -103,7 +103,7 @@ - (void)nodeIndex:(NSDictionary *)params
}
#pragma mark nodeAttachFile
-- (void)nodeAttachFile:(NSDictionary *)params
++ (void)nodeAttachFile:(NSDictionary *)params
success:(void (^)(AFHTTPRequestOperation *operation, id responseObject)) success
failure:(void (^)(AFHTTPRequestOperation *operation, NSError *error)) failure {
NSMutableURLRequest *request = [[DIOSSession sharedSession] multipartFormRequestWithMethod:@"POST" path:[NSString stringWithFormat:@"%@/%@/%@/attach_file?field_name=%@", kDiosEndpoint, kDiosBaseNode, [params objectForKey:@"nid"], [params objectForKey:@"field_name"]] parameters:params constructingBodyWithBlock: ^(id <AFMultipartFormData>formData) {
@@ -111,9 +111,10 @@ - (void)nodeAttachFile:(NSDictionary *)params
}];
AFHTTPRequestOperation *operation = [[AFHTTPRequestOperation alloc] initWithRequest:request];
- [operation setUploadProgressBlock:^(NSInteger bytesWritten, NSInteger totalBytesWritten, NSInteger totalBytesExpectedToWrite) {
- NSLog(@"Sent %d of %d bytes", totalBytesWritten, totalBytesExpectedToWrite);
+ [operation setUploadProgressBlock:^(NSUInteger bytesWritten, long long totalBytesWritten, long long totalBytesExpectedToWrite) {
+ NSLog(@"Sent %lld of %lld bytes", totalBytesWritten, totalBytesExpectedToWrite);
}];
+
[operation setCompletionBlockWithSuccess:success failure:failure];
[operation start];
}
View
2  DIOSSystem.h
@@ -40,7 +40,7 @@
@interface DIOSSystem : NSObject
-- (void)systemConnectwithSuccess: (void (^)(AFHTTPRequestOperation *operation, id responseObject)) success
++ (void)systemConnectwithSuccess: (void (^)(AFHTTPRequestOperation *operation, id responseObject)) success
failure:(void (^)(AFHTTPRequestOperation *operation, NSError *error)) failure;
@end
View
2  DIOSSystem.m
@@ -44,7 +44,7 @@
@implementation DIOSSystem
#pragma mark UserGets
-- (void)systemConnectwithSuccess: (void (^)(AFHTTPRequestOperation *operation, id responseObject)) success
++ (void)systemConnectwithSuccess: (void (^)(AFHTTPRequestOperation *operation, id responseObject)) success
failure:(void (^)(AFHTTPRequestOperation *operation, NSError *error)) failure {
[[DIOSSession sharedSession] postPath:[NSString stringWithFormat:@"%@/system/connect", kDiosEndpoint]
View
10 DIOSTaxonomy.h
@@ -39,28 +39,28 @@
@interface DIOSTaxonomy : NSObject
-- (void)getTreeWithParams:(NSDictionary *)params
++ (void)getTreeWithParams:(NSDictionary *)params
success:(void (^)(AFHTTPRequestOperation *operation, id responseObject)) success
failure:(void (^)(AFHTTPRequestOperation *operation, NSError *error)) failure;
-- (void)getTreeWithVid:(NSString *)vid
++ (void)getTreeWithVid:(NSString *)vid
withParent:(NSString *)parent
andMaxDepth:(NSString *)maxDepth
success:(void (^)(AFHTTPRequestOperation *operation, id responseObject)) success
failure:(void (^)(AFHTTPRequestOperation *operation, NSError *error)) failure;
-- (void)selectNodesWithParams:(NSDictionary *)params
++ (void)selectNodesWithParams:(NSDictionary *)params
success:(void (^)(AFHTTPRequestOperation *operation, id responseObject)) success
failure:(void (^)(AFHTTPRequestOperation *operation, NSError *error)) failure;
-- (void)selectNodesWithTid:(NSString *)tid
++ (void)selectNodesWithTid:(NSString *)tid
andLimit:(NSString *)limit
andPager:(NSString *)pager
andOrder:(NSString *)order
success:(void (^)(AFHTTPRequestOperation *operation, id responseObject)) success
failure:(void (^)(AFHTTPRequestOperation *operation, NSError *error)) failure;
-- (void)getTermWithTid:(NSString *)tid
++ (void)getTermWithTid:(NSString *)tid
success:(void (^)(AFHTTPRequestOperation *operation, id responseObject)) success
failure:(void (^)(AFHTTPRequestOperation *operation, NSError *error)) failure;
@end
View
10 DIOSTaxonomy.m
@@ -40,7 +40,7 @@
@implementation DIOSTaxonomy
-- (void)getTreeWithVid:(NSString *)vid
++ (void)getTreeWithVid:(NSString *)vid
withParent:(NSString *)parent
andMaxDepth:(NSString *)maxDepth
success:(void (^)(AFHTTPRequestOperation *operation, id responseObject)) success
@@ -51,7 +51,7 @@ - (void)getTreeWithVid:(NSString *)vid
[params setValue:maxDepth forKey:@"max_depth"];
[self getTreeWithParams:params success:success failure:failure];
}
-- (void)getTreeWithParams:(NSDictionary *)params
++ (void)getTreeWithParams:(NSDictionary *)params
success:(void (^)(AFHTTPRequestOperation *operation, id responseObject)) success
failure:(void (^)(AFHTTPRequestOperation *operation, NSError *error)) failure {
@@ -60,7 +60,7 @@ - (void)getTreeWithParams:(NSDictionary *)params
success:success
failure:failure];
}
-- (void)selectNodesWithTid:(NSString *)tid
++ (void)selectNodesWithTid:(NSString *)tid
andLimit:(NSString *)limit
andPager:(NSString *)pager
andOrder:(NSString *)order
@@ -74,7 +74,7 @@ - (void)selectNodesWithTid:(NSString *)tid
[params setValue:order forKey:@"prder"];
[self selectNodesWithParams:params success:success failure:failure];
}
-- (void)selectNodesWithParams:(NSDictionary *)params
++ (void)selectNodesWithParams:(NSDictionary *)params
success:(void (^)(AFHTTPRequestOperation *operation, id responseObject)) success
failure:(void (^)(AFHTTPRequestOperation *operation, NSError *error)) failure {
@@ -83,7 +83,7 @@ - (void)selectNodesWithParams:(NSDictionary *)params
success:success
failure:failure];
}
-- (void)getTermWithTid:(NSString *)tid
++ (void)getTermWithTid:(NSString *)tid
success:(void (^)(AFHTTPRequestOperation *operation, id responseObject)) success
failure:(void (^)(AFHTTPRequestOperation *operation, NSError *error)) failure {
[[DIOSSession sharedSession] getPath:[NSString stringWithFormat:@"%@/%@/%@", kDiosEndpoint, kDiosBaseTaxonmyTerm, tid]
View
20 DIOSUser.h
@@ -38,45 +38,45 @@
#import "AFHTTPRequestOperation.h"
@interface DIOSUser : NSObject
-- (void)userGet:(NSDictionary *)user
++ (void)userGet:(NSDictionary *)user
success:(void (^)(AFHTTPRequestOperation *operation, id responseObject)) success
failure:(void (^)(AFHTTPRequestOperation *operation, NSError *error)) failure;
-- (void)userSave:(NSDictionary *)user
++ (void)userSave:(NSDictionary *)user
success:(void (^)(AFHTTPRequestOperation *operation, id responseObject)) success
failure:(void (^)(AFHTTPRequestOperation *operation, NSError *error)) failure;
-- (void)userRegister:(NSDictionary *)user
++ (void)userRegister:(NSDictionary *)user
success:(void (^)(AFHTTPRequestOperation *operation, id responseObject)) success
failure:(void (^)(AFHTTPRequestOperation *operation, NSError *error)) failure;
-- (void)userUpdate:(NSDictionary *)user
++ (void)userUpdate:(NSDictionary *)user
success:(void (^)(AFHTTPRequestOperation *operation, id responseObject)) success
failure:(void (^)(AFHTTPRequestOperation *operation, NSError *error)) failure;
-- (void)userDelete:(NSDictionary *)user
++ (void)userDelete:(NSDictionary *)user
success:(void (^)(AFHTTPRequestOperation *operation, id responseObject)) success
failure:(void (^)(AFHTTPRequestOperation *operation, NSError *error)) failure;
-- (void)userIndexWithPage:(NSString *)page
++ (void)userIndexWithPage:(NSString *)page
fields:(NSString *)fields
parameters:(NSArray *)parameteres
pageSize:(NSString *)pageSize
success:(void (^)(AFHTTPRequestOperation *operation, id responseObject)) success
failure:(void (^)(AFHTTPRequestOperation *operation, NSError *error)) failure;
-- (void)userIndex:(NSDictionary *)params
++ (void)userIndex:(NSDictionary *)params
success:(void (^)(AFHTTPRequestOperation *operation, id responseObject)) success
failure:(void (^)(AFHTTPRequestOperation *operation, NSError *error)) failure;
-- (void)userLogin:(NSDictionary *)user
++ (void)userLogin:(NSDictionary *)user
success:(void (^)(AFHTTPRequestOperation *operation, id responseObject)) success
failure:(void (^)(AFHTTPRequestOperation *operation, NSError *error)) failure;
-- (void)userLoginWithUsername:(NSString *)username andPassword:(NSString *)password
++ (void)userLoginWithUsername:(NSString *)username andPassword:(NSString *)password
success:(void (^)(AFHTTPRequestOperation *operation, id responseObject)) success
failure:(void (^)(AFHTTPRequestOperation *operation, NSError *error)) failure;
-- (void)userLogoutWithSuccessBlock:(void (^)(AFHTTPRequestOperation *operation, id responseObject)) success
++ (void)userLogoutWithSuccessBlock:(void (^)(AFHTTPRequestOperation *operation, id responseObject)) success
failure:(void (^)(AFHTTPRequestOperation *operation, NSError *error)) failure;
@end
View
20 DIOSUser.m
@@ -41,7 +41,7 @@ @implementation DIOSUser
#pragma mark UserGets
-- (void)userGet:(NSDictionary *)user
++ (void)userGet:(NSDictionary *)user
success:(void (^)(AFHTTPRequestOperation *operation, id responseObject)) success
failure:(void (^)(AFHTTPRequestOperation *operation, NSError *error)) failure {
@@ -53,7 +53,7 @@ - (void)userGet:(NSDictionary *)user
#pragma mark userSaves
-- (void)userSave:(NSDictionary *)user
++ (void)userSave:(NSDictionary *)user
success:(void (^)(AFHTTPRequestOperation *operation, id responseObject)) success
failure:(void (^)(AFHTTPRequestOperation *operation, NSError *error)) failure {
@@ -64,7 +64,7 @@ - (void)userSave:(NSDictionary *)user
}
#pragma mark userRegister
-- (void)userRegister:(NSDictionary *)user
++ (void)userRegister:(NSDictionary *)user
success:(void (^)(AFHTTPRequestOperation *operation, id responseObject)) success
failure:(void (^)(AFHTTPRequestOperation *operation, NSError *error)) failure {
@@ -75,7 +75,7 @@ - (void)userRegister:(NSDictionary *)user
}
#pragma mark userUpdate
-- (void)userUpdate:(NSDictionary *)user
++ (void)userUpdate:(NSDictionary *)user
success:(void (^)(AFHTTPRequestOperation *operation, id responseObject)) success
failure:(void (^)(AFHTTPRequestOperation *operation, NSError *error)) failure {
@@ -86,7 +86,7 @@ - (void)userUpdate:(NSDictionary *)user
}
#pragma mark UserDelete
-- (void)userDelete:(NSDictionary *)user
++ (void)userDelete:(NSDictionary *)user
success:(void (^)(AFHTTPRequestOperation *operation, id responseObject)) success
failure:(void (^)(AFHTTPRequestOperation *operation, NSError *error)) failure {
@@ -99,7 +99,7 @@ - (void)userDelete:(NSDictionary *)user
#pragma mark userIndex
//Simpler method if you didnt want to build the params :)
-- (void)userIndexWithPage:(NSString *)page
++ (void)userIndexWithPage:(NSString *)page
fields:(NSString *)fields
parameters:(NSArray *)parameteres
pageSize:(NSString *)pageSize
@@ -113,7 +113,7 @@ - (void)userIndexWithPage:(NSString *)page
[self userIndex:userIndexDict success:success failure:failure];
}
-- (void)userIndex:(NSDictionary *)params
++ (void)userIndex:(NSDictionary *)params
success:(void (^)(AFHTTPRequestOperation *operation, id responseObject)) success
failure:(void (^)(AFHTTPRequestOperation *operation, NSError *error)) failure {
[[DIOSSession sharedSession] getPath:[NSString stringWithFormat:@"%@/%@", kDiosEndpoint, kDiosBaseUser]
@@ -123,7 +123,7 @@ - (void)userIndex:(NSDictionary *)params
}
#pragma mark userLogin
-- (void)userLoginWithUsername:(NSString *)username andPassword:(NSString *)password
++ (void)userLoginWithUsername:(NSString *)username andPassword:(NSString *)password
success:(void (^)(AFHTTPRequestOperation *operation, id responseObject)) success
failure:(void (^)(AFHTTPRequestOperation *operation, NSError *error)) failure {
@@ -133,14 +133,14 @@ - (void)userLoginWithUsername:(NSString *)username andPassword:(NSString *)passw
success:success
failure:failure];
}
-- (void)userLogin:(NSDictionary *)user
++ (void)userLogin:(NSDictionary *)user
success:(void (^)(AFHTTPRequestOperation *operation, id responseObject)) success
failure:(void (^)(AFHTTPRequestOperation *operation, NSError *error)) failure {
[self userLoginWithUsername:[user objectForKey:@"name"] andPassword:[user objectForKey:@"pass"] success:success failure:failure];
}
#pragma mark userLogout
-- (void)userLogoutWithSuccessBlock:(void (^)(AFHTTPRequestOperation *operation, id responseObject)) success
++ (void)userLogoutWithSuccessBlock:(void (^)(AFHTTPRequestOperation *operation, id responseObject)) success
failure:(void (^)(AFHTTPRequestOperation *operation, NSError *error)) failure {
[[DIOSSession sharedSession] postPath:[NSString stringWithFormat:@"%@/%@/logout", kDiosEndpoint, kDiosBaseUser]
parameters:nil
View
2  DIOSView.h
@@ -44,6 +44,6 @@
@param failure The block to be executed on the completion of an unsuccessful request. This block has no return value and takes two arguments: the receiver operation and the error that occured during the request.
*/
-- (void)viewGet:(NSDictionary *)params success:(void (^)(AFHTTPRequestOperation *operation, id responseObject))success
++ (void)viewGet:(NSDictionary *)params success:(void (^)(AFHTTPRequestOperation *operation, id responseObject))success
failure:(void (^)(AFHTTPRequestOperation *operation, NSError *error)) failure;
@end
View
2  DIOSView.m
@@ -36,7 +36,7 @@
#import "DIOSView.h"
#import "DIOSSession.h"
@implementation DIOSView
-- (void)viewGet:(NSDictionary *)params success:(void (^)(AFHTTPRequestOperation *operation, id responseObject))success
++ (void)viewGet:(NSDictionary *)params success:(void (^)(AFHTTPRequestOperation *operation, id responseObject))success
failure:(void (^)(AFHTTPRequestOperation *operation, NSError *error)) failure {
NSMutableString *path = [NSMutableString stringWithFormat:@"%@/%@/%@?", kDiosEndpoint, kDiosBaseView, [params objectForKey:@"view_name"]];
for (NSString *key in params) {
View
26 README.md
@@ -3,20 +3,20 @@ Drupal iOS SDK - Connect your iOS/OS X app to Drupal
What you need to know
================================
The Drupal iOS SDK is a standard set of libraries for communicating to Drupal from any iOS device. Its extremely simple.
-If you wanted to get a node you can do so by instantiating a DIOSNode Object, creating an
-NSDictionairy and running the nodeGet method. Heres an example:
+If you wanted to get some nodes in a view you can do so by calling class methods on the DIOSView Object.
+Heres an example:
```obj-c
- DIOSNode *node = [[DIOSNode alloc] init];
- NSMutableDictionary *nodeData = [NSMutableDictionary new];
- [nodeData setValue:@"12" forKey:@"nid"];
- [node nodeGet:nodeData success:^(AFHTTPRequestOperation *operation, id responseObject) {
- //Do Something with the responseObject
- NSLog(@"%@", responseObject);
- } failure:^(AFHTTPRequestOperation *operation, NSError *error) {
- //we failed, uh-oh lets error log this.
- NSLog(@"%@, %@", [error localizedDescription], [operation responseString]);
- }];
+ NSDictionary *params = [[NSDictionary alloc] initWithObjects:[NSArray arrayWithObjects:@"articles", nid, nil] forKeys:[NSArray arrayWithObjects:@"view_name", @"args", nil]];
+ [DIOSView viewGet:params success:^(AFHTTPRequestOperation *operation, id responseObject) {
+ [self set_sites:responseObject];
+ [self.tableView reloadData];
+ [self stopLoading];
+ } failure:^(AFHTTPRequestOperation *operation, NSError *error) {
+ #warning We should let the user know rather than dumping a log
+ [self stopLoading];
+ NSLog(@"Something went wrong: %@", [error localizedDescription]);
+ }];
```
For every DIOS Object you make, any method calls that are available to you use blocks.
@@ -27,7 +27,7 @@ If the request was successful the result would be something like this:
However if it failed, the error might look like this:
- Expected status code in (200-299), got 404, "Node 5 could not be found"
+ Expected status code in (200-299), got 404, "View does not exist"
What you need to get started
================================
Please sign in to comment.
Something went wrong with that request. Please try again.