Toggle navigation
Toggle navigation
This project
Loading...
Sign in
iOS
/
asi-http-request
Go to a project
Toggle navigation
Toggle navigation pinning
Projects
Groups
Snippets
Help
Project
Activity
Repository
Pipelines
Graphs
Issues
0
Merge Requests
0
Wiki
Network
Create a new issue
Builds
Commits
Authored by
Michael Mayo
2010-01-10 16:16:03 -0800
Browse Files
Options
Browse Files
Download
Email Patches
Plain Diff
Commit
f5e668acf3ca6c87518026f4801f0e24d1b738ca
f5e668ac
1 parent
1167e0e7
cleanup
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
7 additions
and
34 deletions
Classes/ASICloudFilesContainerRequest.h
Classes/ASICloudFilesRequest.h
Classes/ASICloudFilesRequest.m
Classes/ASIHTTPRequest.m
Classes/Tests/ASICloudFilesRequestTests.m
Classes/ASICloudFilesContainerRequest.h
View file @
f5e668a
...
...
@@ -44,7 +44,6 @@
// DELETE /<api version>/<account>/<container>
+
(
id
)
deleteContainerRequest
:(
NSString
*
)
containerName
;
-
(
NSUInteger
)
containerCount
;
-
(
NSUInteger
)
bytesUsed
;
-
(
NSArray
*
)
containers
;
...
...
Classes/ASICloudFilesRequest.h
View file @
f5e668a
...
...
@@ -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
...
...
Classes/ASICloudFilesRequest.m
View file @
f5e668a
...
...
@@ -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
...
...
Classes/ASIHTTPRequest.m
View file @
f5e668a
...
...
@@ -21,7 +21,7 @@
#import "ASIInputStream.h"
// Automatically set on build
NSString
*
ASIHTTPRequestVersion
=
@"v1.2-3
1
2010-01-10"
;
NSString
*
ASIHTTPRequestVersion
=
@"v1.2-3
3
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"
);
...
...
Classes/Tests/ASICloudFilesRequestTests.m
View file @
f5e668a
...
...
@@ -12,7 +12,6 @@
#import "ASICloudFilesAccount.h"
#import "ASICloudFilesContainer.h"
#import "ASICloudFilesObject.h"
#import "ASICloudFilesUIImage.h"
// requests
#import "ASICloudFilesRequest.h"
...
...
Please
register
or
login
to post a comment