Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

Comparing changes

Choose two branches to see what's changed or to start a new pull request. If you need to, you can also compare across forks.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also compare across forks.
base fork: kylebrowning/drupal-ios-sdk
base: 1ff9d8954c
...
head fork: kylebrowning/drupal-ios-sdk
compare: c42dd295fd
Checking mergeability… Don't worry, you can still create the pull request.
  • 2 commits
  • 22 files changed
  • 0 commit comments
  • 2 contributors
Commits on Jan 30, 2014
Tom Kremer AFNetworking 2.0.x migration
Changes made to be compatible with AFNetworking 2.0.x
bac04e8
Commits on Jun 26, 2014
@kylebrowning Merge pull request #107 from TomKremer/master
AFNetworking 2.0.x migration
c42dd29
View
6 DIOSCSRFAFHTTPClient.h
@@ -6,11 +6,11 @@
// Copyright (c) 2013 Zoltán Váradi. All rights reserved.
//
-#import "AFHTTPClient.h"
+#import "AFHTTPRequestOperationManager.h"
-@interface DIOSCSRFAFHTTPClient : AFHTTPClient
+@interface DIOSCSRFAFHTTPClient : AFHTTPRequestOperationManager
- (NSString*)getCSRFToken;
-(void)getCSRFTokenWithSuccess:(void (^)(NSString *csrfToken))success
failure:(void (^)(AFHTTPRequestOperation *operation, NSError *error))failure;
-@end
+@end
View
26 DIOSCSRFAFHTTPClient.m
@@ -31,7 +31,7 @@ -(void)getCSRFTokenWithSuccess:(void (^)(NSString *csrfToken))success
} failure:^(AFHTTPRequestOperation *operation, NSError *error) {
failure(operation, error);
}];
- [self enqueueHTTPRequestOperation:operation];
+ [self.operationQueue addOperation:operation];
}
- (void)postPath:(NSString *)path
@@ -39,14 +39,14 @@ - (void)postPath:(NSString *)path
success:(void (^)(AFHTTPRequestOperation *operation, id responseObject))success
failure:(void (^)(AFHTTPRequestOperation *operation, NSError *error))failure {
[self getCSRFTokenWithSuccess:^(NSString *csrfToken) {
- NSMutableURLRequest *request = [self requestWithMethod:@"POST" path:path parameters:parameters];
+ NSMutableURLRequest *request = [self.requestSerializer requestWithMethod:@"POST" URLString:path parameters:parameters error:nil];
[request setValue: csrfToken forHTTPHeaderField:@"X-CSRF-Token"];
AFHTTPRequestOperation *operation = [self HTTPRequestOperationWithRequest:request success:success failure:failure];
- [self enqueueHTTPRequestOperation:operation];
+ [self.operationQueue addOperation:operation];
} failure:^(AFHTTPRequestOperation *csrfOperation, NSError *error) {
- NSURLRequest *request = [self requestWithMethod:@"POST" path:path parameters:parameters];
+ NSMutableURLRequest *request = [self.requestSerializer requestWithMethod:@"POST" URLString:path parameters:parameters error:nil];
AFHTTPRequestOperation *operation = [self HTTPRequestOperationWithRequest:request success:success failure:failure];
- [self enqueueHTTPRequestOperation:operation];
+ [self.operationQueue addOperation:operation];
}];
}
@@ -55,14 +55,14 @@ - (void)putPath:(NSString *)path
success:(void (^)(AFHTTPRequestOperation *operation, id responseObject))success
failure:(void (^)(AFHTTPRequestOperation *operation, NSError *error))failure {
[self getCSRFTokenWithSuccess:^(NSString *csrfToken) {
- NSMutableURLRequest *request = [self requestWithMethod:@"PUT" path:path parameters:parameters];
+ NSMutableURLRequest *request = [self.requestSerializer requestWithMethod:@"PUT" URLString:path parameters:parameters error:nil];
[request setValue: csrfToken forHTTPHeaderField:@"X-CSRF-Token"];
AFHTTPRequestOperation *operation = [self HTTPRequestOperationWithRequest:request success:success failure:failure];
- [self enqueueHTTPRequestOperation:operation];
+ [self.operationQueue addOperation:operation];
} failure:^(AFHTTPRequestOperation *csrfOperation, NSError *error) {
- NSURLRequest *request = [self requestWithMethod:@"PUT" path:path parameters:parameters];
+ NSMutableURLRequest *request = [self.requestSerializer requestWithMethod:@"PUT" URLString:path parameters:parameters error:nil];
AFHTTPRequestOperation *operation = [self HTTPRequestOperationWithRequest:request success:success failure:failure];
- [self enqueueHTTPRequestOperation:operation];
+ [self.operationQueue addOperation:operation];
}];
}
@@ -71,14 +71,14 @@ - (void)deletePath:(NSString *)path
success:(void (^)(AFHTTPRequestOperation *operation, id responseObject))success
failure:(void (^)(AFHTTPRequestOperation *operation, NSError *error))failure {
[self getCSRFTokenWithSuccess:^(NSString *csrfToken) {
- NSMutableURLRequest *request = [self requestWithMethod:@"DELETE" path:path parameters:parameters];
+ NSMutableURLRequest *request = [self.requestSerializer requestWithMethod:@"DELETE" URLString:path parameters:parameters error:nil];
[request setValue: csrfToken forHTTPHeaderField:@"X-CSRF-Token"];
AFHTTPRequestOperation *operation = [self HTTPRequestOperationWithRequest:request success:success failure:failure];
- [self enqueueHTTPRequestOperation:operation];
+ [self.operationQueue addOperation:operation];
} failure:^(AFHTTPRequestOperation *csrfOperation, NSError *error) {
- NSURLRequest *request = [self requestWithMethod:@"DELETE" path:path parameters:parameters];
+ NSMutableURLRequest *request = [self.requestSerializer requestWithMethod:@"DELETE" URLString:path parameters:parameters error:nil];
AFHTTPRequestOperation *operation = [self HTTPRequestOperationWithRequest:request success:success failure:failure];
- [self enqueueHTTPRequestOperation:operation];
+ [self.operationQueue addOperation:operation];
}];
}
View
2  DIOSComment.h
@@ -66,4 +66,4 @@
+ (void)commentIndex:(NSDictionary *)params
success:(void (^)(AFHTTPRequestOperation *operation, id responseObject)) success
failure:(void (^)(AFHTTPRequestOperation *operation, NSError *error)) failure;
-@end
+@end
View
26 DIOSComment.m
@@ -38,6 +38,7 @@
#import "DIOSComment.h"
#import "DIOSSession.h"
+
@implementation DIOSComment
@@ -55,10 +56,7 @@ + (void)commentGet:(NSDictionary *)comment
success:success
failure:failure];
} else {
- [[DIOSSession sharedSession] getPath:path
- parameters:nil
- success:success
- failure:failure];
+ [[DIOSSession sharedSession] GET:path parameters:nil success:success failure:failure];
}
}
@@ -76,10 +74,7 @@ + (void)commentSave:(NSDictionary *)comment
success:success
failure:failure];
} else {
- [[DIOSSession sharedSession] postPath:path
- parameters:comment
- success:success
- failure:failure];
+ [[DIOSSession sharedSession] POST:path parameters:comment success:success failure:failure];
}
}
@@ -97,10 +92,7 @@ + (void)commentUpdate:(NSDictionary *)comment
success:success
failure:failure];
} else {
- [[DIOSSession sharedSession] putPath:path
- parameters:comment
- success:success
- failure:failure];
+ [[DIOSSession sharedSession] PUT:path parameters:comment success:success failure:failure];
}
}
@@ -119,10 +111,7 @@ + (void)commentDelete:(NSDictionary *)comment
success:success
failure:failure];
} else {
- [[DIOSSession sharedSession] deletePath:path
- parameters:comment
- success:success
- failure:failure];
+ [[DIOSSession sharedSession] DELETE:path parameters:comment success:success failure:failure];
}
}
@@ -156,10 +145,7 @@ + (void)commentIndex:(NSDictionary *)params
success:success
failure:failure];
} else {
- [[DIOSSession sharedSession] getPath:path
- parameters:params
- success:success
- failure:failure];
+ [[DIOSSession sharedSession] GET:path parameters:params success:success failure:failure];
}
}
@end
View
2  DIOSEntity.h
@@ -61,4 +61,4 @@
eid:(NSString*)eId
success:(void (^)(AFHTTPRequestOperation *operation, id responseObject)) success
failure:(void (^)(AFHTTPRequestOperation *operation, NSError *error)) failure;
-@end
+@end
View
25 DIOSEntity.m
@@ -36,7 +36,8 @@
#import "DIOSEntity.h"
#import "DIOSSession.h"
-#import "AFJSONRequestOperation.h"
+#import "AFHTTPRequestOperation.h"
+
@implementation DIOSEntity
#pragma mark nodeGets
@@ -55,10 +56,7 @@ + (void)entityGet:(NSDictionary *)entity
success:success
failure:failure];
} else {
- [[DIOSSession sharedSession] getPath:path
- parameters:nil
- success:success
- failure:failure];
+ [[DIOSSession sharedSession] GET:path parameters:nil success:success failure:failure];
}
}
@@ -78,10 +76,7 @@ + (void)entitySave:(NSDictionary *)entity
failure:failure];
}
else {
- [[DIOSSession sharedSession] postPath:path
- parameters:entity
- success:success
- failure:failure];
+ [[DIOSSession sharedSession] POST:path parameters:entity success:success failure:failure];
}
}
@@ -102,10 +97,7 @@ + (void)entityUpdate:(NSDictionary *)entity
failure:failure];
}
else {
- [[DIOSSession sharedSession] putPath:path
- parameters:entity
- success:success
- failure:failure];
+ [[DIOSSession sharedSession] PUT:path parameters:entity success:success failure:failure];
}
}
@@ -126,10 +118,7 @@ + (void)entityDelete:(NSDictionary *)entity
success:success
failure:failure];
} else {
- [[DIOSSession sharedSession] deletePath:path
- parameters:entity
- success:success
- failure:failure];
+ [[DIOSSession sharedSession] DELETE:path parameters:entity success:success failure:failure];
}
}
-@end
+@end
View
1  DIOSFile.h
@@ -34,6 +34,7 @@
// file under either the MPL or the GPL.
//
// ***** END LICENSE BLOCK *****
+
#import "AFHTTPRequestOperation.h"
@interface DIOSFile : NSObject
View
13 DIOSFile.m
@@ -38,6 +38,7 @@
#import "DIOSFile.h"
#import "UIImageView+AFNetworking.h"
#import "DIOSSession.h"
+
@implementation DIOSFile
+ (void) fileGet:(NSDictionary *)params
@@ -52,10 +53,7 @@ + (void) fileGet:(NSDictionary *)params
success:success
failure:failure];
} else {
- [[DIOSSession sharedSession] getPath:path
- parameters:params
- success:success
- failure:failure];
+ [[DIOSSession sharedSession] GET:path parameters:params success:success failure:failure];
}
}
@@ -71,10 +69,7 @@ + (void)fileSave:(NSDictionary *)file
success:success
failure:failure];
} else {
- [[DIOSSession sharedSession] postPath:path
- parameters:file
- success:success
- failure:failure];
+ [[DIOSSession sharedSession] POST:path parameters:file success:success failure:failure];
}
}
+ (UIImageView *) getImageViewForFileImage:(NSDictionary *) file; {
@@ -83,4 +78,4 @@ + (UIImageView *) getImageViewForFileImage:(NSDictionary *) file; {
[remoteImage setImageWithURL:url];
return remoteImage;
}
-@end
+@end
View
2  DIOSNode.h
@@ -66,4 +66,4 @@
success:(void (^)(AFHTTPRequestOperation *operation, id responseObject)) success
failure:(void (^)(AFHTTPRequestOperation *operation, NSError *error)) failure;
-@end
+@end
View
30 DIOSNode.m
@@ -36,7 +36,8 @@
#import "DIOSNode.h"
#import "DIOSSession.h"
-#import "AFJSONRequestOperation.h"
+#import "AFHTTPRequestOperation.h"
+
@implementation DIOSNode
#pragma mark nodeGets
@@ -53,10 +54,7 @@ + (void)nodeGet:(NSDictionary *)node
success:success
failure:failure];
} else {
- [[DIOSSession sharedSession] getPath:path
- parameters:nil
- success:success
- failure:failure];
+ [[DIOSSession sharedSession] GET:path parameters:nil success:success failure:failure];
}
}
@@ -75,10 +73,7 @@ + (void)nodeSave:(NSDictionary *)node
failure:failure];
}
else {
- [[DIOSSession sharedSession] postPath:path
- parameters:node
- success:success
- failure:failure];
+ [[DIOSSession sharedSession] POST:path parameters:node success:success failure:failure];
}
}
@@ -97,10 +92,7 @@ + (void)nodeUpdate:(NSDictionary *)node
failure:failure];
}
else {
- [[DIOSSession sharedSession] putPath:path
- parameters:node
- success:success
- failure:failure];
+ [[DIOSSession sharedSession] PUT:path parameters:node success:success failure:failure];
}
}
@@ -119,10 +111,7 @@ + (void)nodeDelete:(NSDictionary *)node
success:success
failure:failure];
} else {
- [[DIOSSession sharedSession] deletePath:path
- parameters:node
- success:success
- failure:failure];
+ [[DIOSSession sharedSession] DELETE:path parameters:node success:success failure:failure];
}
}
#pragma mark nodeIndex
@@ -154,11 +143,8 @@ + (void)nodeIndex:(NSDictionary *)params
success:success
failure:failure];
} else {
- [[DIOSSession sharedSession] getPath:path
- parameters:params
- success:success
- failure:failure];
+ [[DIOSSession sharedSession] GET:path parameters:params success:success failure:failure];
}
}
-@end
+@end
View
12 DIOSSession.h
@@ -1,5 +1,5 @@
//
-// DIOSNode.h
+// DIOSSession.h
//
// ***** BEGIN LICENSE BLOCK *****
// Version: MPL 1.1/GPL 2.0
@@ -36,10 +36,10 @@
// ***** END LICENSE BLOCK *****
#import <Foundation/Foundation.h>
-#import "AFHTTPClient.h"
+#import "AFHTTPRequestOperationManager.h"
#import "Settings.h"
-@interface DIOSSession : AFHTTPClient {
+@interface DIOSSession : AFHTTPRequestOperationManager {
NSDictionary *user;
NSMutableDictionary *accessTokens;
NSString *consumerKey;
@@ -47,6 +47,7 @@
NSString *tokenIdentifier;
NSString *tokenSecret;
}
+
@property (strong, nonatomic) NSDictionary *user;
@property (nonatomic, retain) NSMutableDictionary *accessTokens;
@property (nonatomic) BOOL signRequests;
@@ -57,9 +58,11 @@
@property (nonatomic, retain) NSString *tokenIdentifier;
@property (nonatomic, retain) NSString *tokenSecret;
@property (readwrite, nonatomic, retain) NSURL *baseURL;
+
+ (DIOSSession *)sharedSession;
+ (DIOSSession *)sharedSessionWithURL:(NSString*)url;
+ (DIOSSession *)sharedOauthSessionWithURL:(NSString*)url consumerKey:(NSString *)aConsumerKey secret:(NSString *)aConsumerSecret;
+
+ (void) getRequestTokensWithSuccess:(void (^)(AFHTTPRequestOperation *operation, id responseObject))success
failure:(void (^)(AFHTTPRequestOperation *operation, NSError *error)) failure;
+ (void) getAccessTokensWithRequestTokens:(NSDictionary *)requesTokens
@@ -73,6 +76,7 @@
failure:(void (^)(AFHTTPRequestOperation *operation, NSError *error)) failure;
- (void) addHeaderValue:(NSString*)value forKey:(NSString*)key;
+
- (NSURLRequest *) signedRequestWithMethod:(NSString *)method
path:(NSString *)path
parameters:(NSDictionary *)parameters;
@@ -80,5 +84,5 @@
- (void) setAccessToken:(NSString *)accessToken secret:(NSString *)secret;
- (void) setConsumerKey:(NSString *)consumerKey secret:(NSString *)secret;
-@end
+@end
View
64 DIOSSession.m
@@ -1,5 +1,5 @@
//
-// DIOSNode.h
+// DIOSSession.m
//
// ***** BEGIN LICENSE BLOCK *****
// Version: MPL 1.1/GPL 2.0
@@ -36,10 +36,10 @@
// ***** END LICENSE BLOCK *****
#import "DIOSSession.h"
-#import "AFJSONRequestOperation.h"
-#import "AFPropertyListRequestOperation.h"
+#import "AFHTTPRequestOperation.h"
#include <sys/time.h>
#import <CommonCrypto/CommonHMAC.h>
+
static NSString* Base64EncodedStringFromData(NSData *data);
static NSString* URLEncodeString(NSString *string);
static const NSString *kOAuthSignatureMethodKey = @"oauth_signature_method";
@@ -52,6 +52,7 @@
static const NSString *kOAuthVersion1_0 = @"1.0";
static dispatch_once_t once;
static DIOSSession *sharedSession;
+
@interface DIOSSession()
- (id) initWithBaseURL:(NSURL *)url;
@@ -61,13 +62,14 @@ - (NSString *) authorizationHeaderValueForRequest:(NSURLRequest *)request;
@end
@implementation DIOSSession
+
@synthesize user, accessTokens, consumerKey, consumerSecret, tokenIdentifier, tokenSecret, baseURL,
realm, signRequests, threeLegged;
+ (DIOSSession *)sharedSession {
dispatch_once(&once, ^ {
sharedSession = [[self alloc] initWithBaseURL:[NSURL URLWithString:kDiosBaseUrl]];
- [sharedSession setParameterEncoding:AFJSONParameterEncoding];
+ sharedSession.requestSerializer = [AFJSONRequestSerializer serializer];
});
return sharedSession;
}
@@ -75,7 +77,7 @@ + (DIOSSession *)sharedSession {
+ (DIOSSession *)sharedSessionWithURL:(NSString*)url {
dispatch_once(&once, ^ {
sharedSession = [[self alloc] initWithBaseURL:[NSURL URLWithString:url]];
- [sharedSession setParameterEncoding:AFJSONParameterEncoding];
+ sharedSession.requestSerializer = [AFJSONRequestSerializer serializer];
});
[sharedSession setBaseURL:[NSURL URLWithString:url]];
return sharedSession;
@@ -84,37 +86,49 @@ + (DIOSSession *)sharedSessionWithURL:(NSString*)url {
+ (DIOSSession *)sharedOauthSessionWithURL:(NSString*)url consumerKey:(NSString *)aConsumerKey secret:(NSString *)aConsumerSecret {
dispatch_once(&once, ^ {
sharedSession = [[self alloc] initWithBaseURL:[NSURL URLWithString:url] consumerKey:aConsumerKey secret:aConsumerSecret];
- [sharedSession setParameterEncoding:AFJSONParameterEncoding];
+ sharedSession.requestSerializer = [AFJSONRequestSerializer serializer];
+
});
[sharedSession setBaseURL:[NSURL URLWithString:url]];
return sharedSession;
}
+
+ (void) getRequestTokensWithSuccess:(void (^)(AFHTTPRequestOperation *operation, id responseObject))success
failure:(void (^)(AFHTTPRequestOperation *operation, NSError *error)) failure {
DIOSSession *client = [[DIOSSession alloc] initWithBaseURL:[[DIOSSession sharedSession] baseURL]];
[client setConsumerKey:[[DIOSSession sharedSession] consumerKey] secret:[[DIOSSession sharedSession] consumerSecret]];
- [client registerHTTPOperationClass:[AFHTTPRequestOperation class]];
- [client setDefaultHeader:@"Accept" value:@"text/html"];
- [client setDefaultHeader:@"Content-Type" value:@"text/html"];
+
+ //[client registerHTTPOperationClass:[AFHTTPRequestOperation class]];
+
+ [sharedSession.requestSerializer setValue:@"text/html" forHTTPHeaderField:@"Accept"];
+ [sharedSession.requestSerializer setValue:@"text/html" forHTTPHeaderField:@"Content-Type"];
+
NSMutableDictionary *params = [NSMutableDictionary new];
[params setObject:[[DIOSSession sharedSession] consumerKey] forKey:kOAuthConsumerKey];
[params setObject:[[DIOSSession sharedSession] consumerSecret] forKey:kOAuthTokenIdentifier];
[client sendSignedRequestWithPath:@"/oauth/request_token" method:@"GET" params:params success:success failure:failure];
}
+
+
+ (void) getAccessTokensWithRequestTokens:(NSDictionary *)requestTokens
success:(void (^)(AFHTTPRequestOperation *operation, id responseObject))success
failure:(void (^)(AFHTTPRequestOperation *operation, NSError *error)) failure {
DIOSSession *client = [[DIOSSession alloc] initWithBaseURL:[[DIOSSession sharedSession] baseURL]];
[client setConsumerKey:[[DIOSSession sharedSession] consumerKey] secret:[[DIOSSession sharedSession] consumerSecret]];
- [client registerHTTPOperationClass:[AFHTTPRequestOperation class]];
- [client setDefaultHeader:@"Accept" value:@"text/html"];
- [client setDefaultHeader:@"Content-Type" value:@"text/html"];
+
+ //[client registerHTTPOperationClass:[AFHTTPRequestOperation class]];
+
+ [sharedSession.requestSerializer setValue:@"text/html" forHTTPHeaderField:@"Accept"];
+ [sharedSession.requestSerializer setValue:@"text/html" forHTTPHeaderField:@"Content-Type"];
+
[client setAccessToken:[requestTokens objectForKey:@"oauth_token"] secret:[requestTokens objectForKey:@"oauth_token_secret"]];
[client sendSignedRequestWithPath:@"/oauth/access_token" method:@"GET" params:requestTokens success:success failure:failure];
}
+
+
- (void) sendSignedRequestWithPath:(NSString*)path
method:(NSString*)method
params:(NSDictionary*)params
@@ -125,8 +139,8 @@ - (void) sendSignedRequestWithPath:(NSString*)path
NSLog(@"send signedrequest #######REQUEST######## :%@", request);
NSLog(@"params: %@", params);
- AFHTTPRequestOperation *operation = [self HTTPRequestOperationWithRequest:request success:success failure:failure];
- [self enqueueHTTPRequestOperation:operation];
+ AFHTTPRequestOperation *operation = [self HTTPRequestOperationWithRequest:request success:success failure:failure];
+ [self.operationQueue addOperation:operation];
}
- (id)initWithBaseURL:(NSURL *)url {
@@ -135,10 +149,11 @@ - (id)initWithBaseURL:(NSURL *)url {
return nil;
}
- [self registerHTTPOperationClass:[AFJSONRequestOperation class]];
+ //[self registerHTTPOperationClass:[AFJSONRequestOperation class]];
// Accept HTTP Header; see http://www.w3.org/Protocols/rfc2616/rfc2616-sec14.html#sec14.1
- [self setDefaultHeader:@"Accept" value:@"application/json"];
- [self setDefaultHeader:@"Content-Type" value:@"application/json"];
+
+ [sharedSession.requestSerializer setValue:@"application/json" forHTTPHeaderField:@"Accept"];
+ [sharedSession.requestSerializer setValue:@"application/json" forHTTPHeaderField:@"Content-Type"];
return self;
}
@@ -151,16 +166,17 @@ - (id) initWithBaseURL:(NSURL *)url consumerKey:(NSString *)aConsumerKey secret:
self.consumerKey = aConsumerKey;
self.consumerSecret = aConsumerSecret;
- [self registerHTTPOperationClass:[AFJSONRequestOperation class]];
+ //[self registerHTTPOperationClass:[AFJSONRequestOperation class]];
// Accept HTTP Header; see http://www.w3.org/Protocols/rfc2616/rfc2616-sec14.html#sec14.1
- [self setDefaultHeader:@"Accept" value:@"application/json"];
- [self setDefaultHeader:@"Content-Type" value:@"application/json"];
+
+ [sharedSession.requestSerializer setValue:@"application/json" forHTTPHeaderField:@"Accept"];
+ [sharedSession.requestSerializer setValue:@"application/json" forHTTPHeaderField:@"Content-Type"];
}
return self;
}
- (NSURLRequest *) signedRequestWithMethod:(NSString *)method path:(NSString *)path parameters:(NSDictionary *)parameters {
- NSMutableURLRequest *request = [super requestWithMethod:method path:path parameters:parameters];
+ NSMutableURLRequest *request = [self.requestSerializer requestWithMethod:method URLString:path parameters:parameters error:nil];
NSString *authorizationHeader = [self authorizationHeaderValueForRequest:request];
[request setValue:authorizationHeader forHTTPHeaderField:@"Authorization"];
@@ -171,7 +187,7 @@ - (NSMutableURLRequest *) requestWithMethod:(NSString *)method
path:(NSString *)path
parameters:(NSDictionary *)parameters {
- NSMutableURLRequest *request = [super requestWithMethod:method path:path parameters:parameters];
+ NSMutableURLRequest *request = [self.requestSerializer requestWithMethod:method URLString:path parameters:parameters error:nil];
if (self.signRequests) {
NSString *authorizationHeader = [self authorizationHeaderValueForRequest:request];
@@ -182,7 +198,7 @@ - (NSMutableURLRequest *) requestWithMethod:(NSString *)method
}
- (NSURLRequest *) unsignedRequestWithMethod:(NSString *)method path:(NSString *)path parameters:(NSDictionary *)parameters {
- NSMutableURLRequest *request = [super requestWithMethod:method path:path parameters:parameters];
+ NSMutableURLRequest *request = [self.requestSerializer requestWithMethod:method URLString:path parameters:parameters error:nil];
return request;
}
@@ -198,7 +214,7 @@ - (void) setConsumerKey:(NSString *)aConsumerKey secret:(NSString *)secret {
self.consumerSecret = secret;
}
- (void) addHeaderValue:(NSString*)value forKey:(NSString*)key {
- [self setDefaultHeader:key value:value];
+ [sharedSession.requestSerializer setValue:value forHTTPHeaderField:key];
}
- (NSMutableDictionary *) mutableDictionaryWithOAuthInitialData {
View
2  DIOSSystem.h
@@ -43,4 +43,4 @@
+ (void)systemConnectwithSuccess: (void (^)(AFHTTPRequestOperation *operation, id responseObject)) success
failure:(void (^)(AFHTTPRequestOperation *operation, NSError *error)) failure;
-@end
+@end
View
7 DIOSSystem.m
@@ -47,10 +47,7 @@ @implementation DIOSSystem
+ (void)systemConnectwithSuccess: (void (^)(AFHTTPRequestOperation *operation, id responseObject)) success
failure:(void (^)(AFHTTPRequestOperation *operation, NSError *error)) failure {
- [[DIOSSession sharedSession] postPath:[NSString stringWithFormat:@"%@/system/connect", kDiosEndpoint]
- parameters:nil
- success:success
- failure:failure];
+ [[DIOSSession sharedSession] POST:[NSString stringWithFormat:@"%@/system/connect", kDiosEndpoint] parameters:nil success:success failure:failure];
}
-@end
+@end
View
21 DIOSTaxonomy.m
@@ -37,6 +37,7 @@
#import "DIOSTaxonomy.h"
#import "DIOSSession.h"
+
@implementation DIOSTaxonomy
@@ -64,13 +65,11 @@ + (void)getTreeWithParams:(NSDictionary *)params
success:success
failure:failure];
} else {
- [[DIOSSession sharedSession] postPath:path
- parameters:params
- success:success
- failure:failure];
+ [[DIOSSession sharedSession] POST:path parameters:params success:success failure:failure];
}
}
+
+ (void)selectNodesWithTid:(NSString *)tid
andLimit:(NSString *)limit
andPager:(NSString *)pager
@@ -85,6 +84,7 @@ + (void)selectNodesWithTid:(NSString *)tid
[params setValue:order forKey:@"prder"];
[self selectNodesWithParams:params success:success failure:failure];
}
+
+ (void)selectNodesWithParams:(NSDictionary *)params
success:(void (^)(AFHTTPRequestOperation *operation, id responseObject)) success
failure:(void (^)(AFHTTPRequestOperation *operation, NSError *error)) failure {
@@ -98,12 +98,10 @@ + (void)selectNodesWithParams:(NSDictionary *)params
success:success
failure:failure];
} else {
- [[DIOSSession sharedSession] postPath:path
- parameters:params
- success:success
- failure:failure];
+ [[DIOSSession sharedSession] POST:path parameters:params success:success failure:failure];
}
}
+
+ (void)getTermWithTid:(NSString *)tid
success:(void (^)(AFHTTPRequestOperation *operation, id responseObject)) success
failure:(void (^)(AFHTTPRequestOperation *operation, NSError *error)) failure {
@@ -117,10 +115,7 @@ + (void)getTermWithTid:(NSString *)tid
success:success
failure:failure];
} else {
- [[DIOSSession sharedSession] getPath:path
- parameters:nil
- success:success
- failure:failure];
+ [[DIOSSession sharedSession] GET:path parameters:nil success:success failure:failure];
}
}
-@end
+@end
View
3  DIOSUser.h
@@ -37,7 +37,6 @@
#import "AFHTTPRequestOperation.h"
-static NSUInteger USERNAME_MAX_LENGTH = 60;
@interface DIOSUser : NSObject
@@ -100,4 +99,4 @@ static NSUInteger USERNAME_MAX_LENGTH = 60;
+ (BOOL)userValidateUserEmail:(NSString*)email error:(NSError**)error;
-@end
+@end
View
46 DIOSUser.m
@@ -42,6 +42,7 @@
@implementation DIOSUser
static NSInteger anonymous_user = 0;
+static NSUInteger USERNAME_MAX_LENGTH = 60;
#pragma mark UserGets
+ (void)userGet:(NSDictionary *)user
@@ -58,10 +59,7 @@ + (void)userGet:(NSDictionary *)user
failure:failure];
}
else {
- [[DIOSSession sharedSession] getPath:path
- parameters:user
- success:success
- failure:failure];
+ [[DIOSSession sharedSession] GET:path parameters:user success:success failure:failure];
}
}
@@ -81,10 +79,7 @@ + (void)userSave:(NSDictionary *)user
failure:failure];
}
else {
- [[DIOSSession sharedSession] postPath:path
- parameters:user
- success:success
- failure:failure];
+ [[DIOSSession sharedSession] POST:path parameters:user success:success failure:failure];
}
}
@@ -103,10 +98,7 @@ + (void)userRegister:(NSDictionary *)user
failure:failure];
}
else {
- [[DIOSSession sharedSession] postPath:path
- parameters:user
- success:success
- failure:failure];
+ [[DIOSSession sharedSession] POST:path parameters:user success:success failure:failure];
}
}
@@ -125,10 +117,7 @@ + (void)userUpdate:(NSDictionary *)user
failure:failure];
}
else {
- [[DIOSSession sharedSession] putPath:path
- parameters:user
- success:success
- failure:failure];
+ [[DIOSSession sharedSession] PUT:path parameters:user success:success failure:failure];
}
}
@@ -151,10 +140,7 @@ + (void)userDelete:(NSDictionary *)user
failure:failure];
}
else {
- [[DIOSSession sharedSession] deletePath:path
- parameters:user
- success:success
- failure:failure];
+ [[DIOSSession sharedSession] DELETE:path parameters:user success:success failure:failure];
}
}
@@ -189,10 +175,7 @@ + (void)userIndex:(NSDictionary *)params
failure:failure];
}
else {
- [[DIOSSession sharedSession] getPath:path
- parameters:params
- success:success
- failure:failure];
+ [[DIOSSession sharedSession] GET:path parameters:params success:success failure:failure];
}
}
@@ -213,10 +196,7 @@ + (void)userLoginWithUsername:(NSString *)username andPassword:(NSString *)passw
failure:failure];
}
else {
- [[DIOSSession sharedSession] postPath:path
- parameters:params
- success:success
- failure:failure];
+ [[DIOSSession sharedSession] POST:path parameters:params success:success failure:failure];
}
}
+ (void)userLogin:(NSDictionary *)user
@@ -269,10 +249,7 @@ + (void)userLogoutWithSuccessBlock:(void (^)(AFHTTPRequestOperation *operation,
failure:failure];
}
else {
- [[DIOSSession sharedSession] postPath:path
- parameters:nil
- success:success
- failure:failure];
+ [[DIOSSession sharedSession] POST:path parameters:nil success:success failure:failure];
}
}
@@ -307,10 +284,7 @@ + (void)userSendPasswordRecoveryEmailWithEmailAddress: (NSString*) email
failure:failure];
}
else {
- [[DIOSSession sharedSession] postPath:path
- parameters:nil
- success:success
- failure:failure];
+ [[DIOSSession sharedSession] POST:path parameters:nil success:success failure:failure];
}
View
3  DIOSView.h
@@ -1,4 +1,4 @@
-// DIOSNode.m
+// DIOSView.h
//
// ***** BEGIN LICENSE BLOCK *****
// Version: MPL 1.1/GPL 2.0
@@ -33,6 +33,7 @@
// file under either the MPL or the GPL.
//
// ***** END LICENSE BLOCK *****
+
#import "AFHTTPRequestOperation.h"
@interface DIOSView : NSObject
View
9 DIOSView.m
@@ -1,4 +1,4 @@
-// DIOSNode.m
+// DIOSView.m
//
// ***** BEGIN LICENSE BLOCK *****
// Version: MPL 1.1/GPL 2.0
@@ -33,8 +33,10 @@
// file under either the MPL or the GPL.
//
// ***** END LICENSE BLOCK *****
+
#import "DIOSView.h"
#import "DIOSSession.h"
+
@implementation DIOSView
+ (void)viewGet:(NSDictionary *)params
success:(void (^)(AFHTTPRequestOperation *operation, id responseObject))success
@@ -65,10 +67,7 @@ + (void)viewGet:(NSDictionary *)params
failure:failure];
}
else {
- [[DIOSSession sharedSession] getPath:path
- parameters:nil
- success:success
- failure:failure];
+ [[DIOSSession sharedSession] GET:path parameters:nil success:success failure:failure];
}
}
@end
View
4 README.md
@@ -1,6 +1,6 @@
Drupal iOS SDK - Connect your iOS/OS X app to Drupal
================================
-##### Sponsored by [http://workhabit.com](http://workhabit.com) built by [Kyle Browning](http://kylebrowning.com)
+##### built by [Kyle Browning](http://kylebrowning.com) and modified by Tom Kremer to be AFNetworking 2.0.X compatible.
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.
@@ -146,4 +146,4 @@ Use the issue queue here on github if you have questions. An addon library is [h
Questions
----------
Checkout the Issue queue, or email me
-Email kylebrowning@me.com
+Email tomkremer@me.com
View
9 Settings.h
@@ -1,4 +1,11 @@
-#define kDiosBaseUrl @"http://d7.workhabit.com"
+#warning Adapt constants to your needs
+
+#ifdef DEBUG
+#define kDiosBaseUrl @"http://192.168.178.45/drupal"
+#else
+#define kDiosBaseUrl @"http://www.drupal.com"
+#endif
+
#define kDiosEndpoint @"test"
#define kDiosBaseNode @"node"
#define kDiosBaseComment @"comment"
View
10 drupal-ios-sdk.podspec
@@ -3,13 +3,13 @@ Pod::Spec.new do |s|
s.version = "2.0.4"
s.summary = "A framework for communicating to Drupal via an iPhone."
s.homepage = "https://github.com/workhabitinc/drupal-ios-sdk"
- s.author = { "Kyle Browning" => "kylebrowning@me.com" }
- s.source = { :git => "https://github.com/workhabitinc/drupal-ios-sdk.git", :tag => "2.0.4" }
+ s.author = { "Kyle Browning" => "kylebrowning@me.com",
+ "Tom Kremer" => "tomkremer@me.com" }
+ s.source = { :git => "https://github.com/tomkremer/drupal-ios-sdk.git", :tag => "2.0.4" }
s.source_files = "*.{h,m}"
s.requires_arc = true
- s.ios.deployment_target = '5.0'
+ s.ios.deployment_target = '7.0'
s.license = 'MPL 1.1/GPL 2.0'
- s.dependency 'AFNetworking', '~> 1.3.0'
- s.dependency 'JSONKit', '~> 1.4'
+ s.dependency 'AFNetworking', '~> 2.0.0'
end

No commit comments for this range

Something went wrong with that request. Please try again.