Permalink
Browse files

Merge pull request #59 from workhabitinc/master

merge master to dev.
  • Loading branch information...
2 parents fb8e8bc + e154dd4 commit ccf02145039eb65cca90f1ad8925360dd044ae17 @kylebrowning committed Sep 26, 2012
Showing with 93 additions and 84 deletions.
  1. +6 −6 DIOSComment.h
  2. +6 −6 DIOSComment.m
  3. +5 −3 DIOSFile.h
  4. +10 −4 DIOSFile.m
  5. +7 −7 DIOSNode.h
  6. +12 −11 DIOSNode.m
  7. +1 −1 DIOSSystem.h
  8. +1 −1 DIOSSystem.m
  9. +5 −5 DIOSTaxonomy.h
  10. +5 −5 DIOSTaxonomy.m
  11. +10 −10 DIOSUser.h
  12. +10 −10 DIOSUser.m
  13. +1 −1 DIOSView.h
  14. +1 −1 DIOSView.m
  15. +13 −13 README.md
View
@@ -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
@@ -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,15 +73,15 @@ - (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];
}
#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
@@ -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
@@ -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
@@ -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
@@ -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,25 +95,26 @@ - (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 {
[[DIOSSession sharedSession] getPath:[NSString stringWithFormat:@"%@/%@", kDiosEndpoint, kDiosBaseNode] parameters:params success:success failure:failure];
}
#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) {
[formData appendPartWithFileData:[params objectForKey:@"fileData"] name:[params objectForKey:@"name"] fileName:[params objectForKey:@"fileName"] mimeType:[params objectForKey:@"mimetype"]];
}];
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
@@ -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
@@ -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
@@ -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
@@ -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]
Oops, something went wrong.

0 comments on commit ccf0214

Please sign in to comment.