Michael Mayo

cleanup

... ... @@ -44,7 +44,6 @@
// DELETE /<api version>/<account>/<container>
+ (id)deleteContainerRequest:(NSString *)containerName;
- (NSUInteger)containerCount;
- (NSUInteger)bytesUsed;
- (NSArray *)containers;
... ...
... ... @@ -5,7 +5,7 @@
// Created by Michael Mayo on 22/12/09.
// Copyright 2009 All-Seeing Interactive. All rights reserved.
//
// A (basic) class for accessing data stored on Rackspace's Cloud Files Service
// A class for accessing data stored on the Rackspace Cloud Files Service
// http://www.rackspacecloud.com/cloud_hosting_products/files
//
// Cloud Files Developer Guide:
... ... @@ -24,19 +24,15 @@
#pragma mark Rackspace Cloud Authentication
+ (id)authenticationRequest;
+ (void)authenticate;
+ (NSString *)username;
+ (void)setUsername:(NSString *)username;
+ (NSString *)apiKey;
+ (void)setApiKey:(NSString *)apiKey;
// helper to parse dates in the format returned by Cloud Files
-(NSDate *)dateFromString:(NSString *)dateString;
#pragma mark Constructors
+ (id)authenticationRequest;
+ (id)storageRequest;
+ (id)cdnRequest;
@end
... ...
... ... @@ -5,7 +5,7 @@
// Created by Michael Mayo on 22/12/09.
// Copyright 2009 All-Seeing Interactive. All rights reserved.
//
// A (basic) class for accessing data stored on Rackspace's Cloud Files Service
// A class for accessing data stored on Rackspace's Cloud Files Service
// http://www.rackspacecloud.com/cloud_hosting_products/files
//
// Cloud Files Developer Guide:
... ... @@ -36,30 +36,13 @@ static NSString *rackspaceCloudAuthURL = @"https://auth.api.rackspacecloud.com/v
+ (id)authenticationRequest {
ASIHTTPRequest *request = [[ASIHTTPRequest alloc] initWithURL:[NSURL URLWithString:rackspaceCloudAuthURL]];
//[request addRequestHeader:[ASICloudFilesRequest authToken] value:@"X-Auth-Token"];
//[request addRequestHeader:[ASICloudFilesRequest authToken] value:@"X-Auth-Token"];
NSMutableDictionary *headers = [[NSMutableDictionary alloc] initWithCapacity:2];
[headers setObject:username forKey:@"X-Auth-User"];
[headers setObject:apiKey forKey:@"X-Auth-Key"];
[request setRequestHeaders:headers];
[headers release];
return request;
}
+ (id)storageRequest {
ASIHTTPRequest *request = [[ASIHTTPRequest alloc] initWithURL:[NSURL URLWithString:storageURL]];
return request;
}
+ (id)cdnRequest {
ASIHTTPRequest *request = [[ASIHTTPRequest alloc] initWithURL:[NSURL URLWithString:cdnManagementURL]];
[request addRequestHeader:@"X-Auth-User" value:username];
[request addRequestHeader:@"X-Auth-Key" value:apiKey];
return request;
}
+ (void)authenticate {
ASIHTTPRequest *request = [ASICloudFilesRequest authenticationRequest];
[request start];
if (![request error]) {
... ... @@ -67,8 +50,6 @@ static NSString *rackspaceCloudAuthURL = @"https://auth.api.rackspacecloud.com/v
authToken = [responseHeaders objectForKey:@"X-Auth-Token"];
storageURL = [responseHeaders objectForKey:@"X-Storage-Url"];
cdnManagementURL = [responseHeaders objectForKey:@"X-Cdn-Management-Url"];
} else {
NSLog(@"%@",[[request error] localizedDescription]);
}
}
... ... @@ -103,6 +84,4 @@ static NSString *rackspaceCloudAuthURL = @"https://auth.api.rackspacecloud.com/v
return date;
}
@end
... ...
... ... @@ -21,7 +21,7 @@
#import "ASIInputStream.h"
// Automatically set on build
NSString *ASIHTTPRequestVersion = @"v1.2-31 2010-01-10";
NSString *ASIHTTPRequestVersion = @"v1.2-33 2010-01-10";
// We use our own custom run loop mode as CoreAnimation seems to want to hijack our threads otherwise
static CFStringRef ASIHTTPRequestRunMode = CFSTR("ASIHTTPRequest");
... ...
... ... @@ -12,7 +12,6 @@
#import "ASICloudFilesAccount.h"
#import "ASICloudFilesContainer.h"
#import "ASICloudFilesObject.h"
#import "ASICloudFilesUIImage.h"
// requests
#import "ASICloudFilesRequest.h"
... ...