Revision 78624c54

b/asi-http-request-with-pithos/Classes/Pithos/ASIPithosAccount.h
38 38

  
39 39
@interface ASIPithosAccount : NSObject {
40 40
	NSString *name;
41
    NSUInteger count;
41 42
	NSDate *lastModified;
43
    NSUInteger bytes;
42 44
}
43 45

  
44 46
@property (retain) NSString *name;
47
@property (assign) NSUInteger count;
45 48
@property (retain) NSDate *lastModified;
49
@property (assign) NSUInteger bytes;
46 50

  
47 51
+ (id)account;
48 52

  
b/asi-http-request-with-pithos/Classes/Pithos/ASIPithosAccount.m
37 37
#import "ASIPithosAccount.h"
38 38

  
39 39
@implementation ASIPithosAccount
40
@synthesize name, lastModified;
40
@synthesize name, count, lastModified, bytes;
41 41

  
42 42
+ (id)account {
43 43
	ASIPithosAccount *account = [[[self alloc] init] autorelease];
......
45 45
}
46 46

  
47 47
- (NSString *)description {
48
    return [NSString stringWithFormat:@"name: %@, lastModified: %@", name, lastModified];
48
    return [NSString stringWithFormat:@"name: %@, count: %lu, lastModified: %@, bytes: %lu", 
49
            name, count, lastModified, bytes];
49 50
}
50 51

  
51 52
-(void) dealloc {
b/asi-http-request-with-pithos/Classes/Pithos/ASIPithosContainerRequest.m
405 405
        if (currentObject.metadata == nil)
406 406
            currentObject.metadata = [NSMutableDictionary dictionary];
407 407
        [currentObject.metadata setObject:currentContent forKey:[elementName substringFromIndex:14]];
408
	} else if ([elementName isEqualToString:@"x_object_allowed_to"]) {
409
        currentObject.allowedTo = currentContent;
408 410
	} else if ([elementName isEqualToString:@"object"]) {
409 411
		[objects addObject:currentObject];
410 412
        self.currentObject = nil;
b/asi-http-request-with-pithos/Classes/Pithos/ASIPithosObject.h
54 54
    NSString *sharedBy;
55 55
    NSString *publicURI;
56 56
    NSMutableDictionary *metadata;
57
    NSString *allowedTo;
57 58
    
58 59
    NSData *data;
59 60
}
......
75 76
@property (retain) NSString *sharedBy;
76 77
@property (retain) NSString *publicURI;
77 78
@property (retain) NSMutableDictionary *metadata;
79
@property (retain) NSString *allowedTo;
78 80
@property (retain) NSData *data;
79 81

  
80 82
+ (id)object;
b/asi-http-request-with-pithos/Classes/Pithos/ASIPithosObject.m
39 39
@implementation ASIPithosObject
40 40
@synthesize subdir;
41 41
@synthesize name, hash, bytes, contentType, contentEncoding, contentDisposition, lastModified, 
42
version, versionTimestamp, modifiedBy, manifest, sharing, sharedBy, publicURI, metadata, data;
42
version, versionTimestamp, modifiedBy, manifest, sharing, sharedBy, publicURI, metadata, allowedTo, 
43
data;
43 44

  
44 45
+ (id)object {
45 46
	ASIPithosObject *object = [[[self alloc] init] autorelease];
......
57 58
- (NSString *)description {
58 59
    if (subdir)
59 60
        return [NSString stringWithFormat:@"subdir name: %@", name];
60
    return [NSString stringWithFormat:@"name: %@, hash: %@, bytes: %lu, contentType: %@, contentEncoding: %@, contentDisposition: %@, lastModified: %@, version: %@, versionTimestamp: %@, modifiedBy: %@, manifest: %@, sharing: %@, sharedBy: %@, publicURI: %@, metadata: %@", 
61
            name, hash, bytes, contentType, contentEncoding, contentDisposition, lastModified, version, versionTimestamp, modifiedBy, manifest, sharing, sharedBy, publicURI, metadata];
61
    return [NSString stringWithFormat:@"name: %@, hash: %@, bytes: %lu, contentType: %@, contentEncoding: %@, contentDisposition: %@, lastModified: %@, version: %@, versionTimestamp: %@, modifiedBy: %@, manifest: %@, sharing: %@, sharedBy: %@, publicURI: %@, metadata: %@, allowedTo: %@", 
62
            name, hash, bytes, contentType, contentEncoding, contentDisposition, lastModified, version, versionTimestamp, modifiedBy, manifest, sharing, sharedBy, publicURI, metadata, allowedTo];
62 63
}
63 64

  
64 65
-(void) dealloc {
65 66
    [data release];
67
    [allowedTo release];
66 68
    [metadata release];
67 69
    [publicURI release];
68 70
    [sharedBy release];
b/asi-http-request-with-pithos/Classes/Pithos/ASIPithosObjectRequest.h
109 109
- (NSString *)sharedBy;
110 110
- (NSString *)publicURI;
111 111
- (NSDictionary *)metadata;
112

  
113 112
- (NSString *)allowedTo;
114 113

  
115 114
- (ASIPithosObject *)object;
b/asi-http-request-with-pithos/Classes/Pithos/ASIPithosObjectRequest.m
281 281
    object.sharedBy = [self sharedBy];
282 282
    object.publicURI = [self publicURI];
283 283
    object.metadata = (NSMutableDictionary *)[self metadata];
284
    object.allowedTo = [self allowedTo];
284 285
    
285 286
    if (objectRequestType == ASIPithosObjectRequestData) {
286 287
        object.bytes = [self objectContentLength];
b/asi-http-request-with-pithos/Classes/Pithos/ASIPithosRequest.h
63 63
// GET authURL
64 64
+ (id)listSharingAccountsRequest;
65 65
// GET authURL?[limit=limit]&[marker=marker]
66
+ (id)listSharingAccountsRequestWith:(NSUInteger)limit marker:(NSString *)marker;
66
+ (id)listSharingAccountsRequestWithLimit:(NSUInteger)limit marker:(NSString *)marker;
67

  
68
- (NSArray *)sharingAccounts;
67 69

  
68 70
+ (NSString *)authURL;
69 71
+ (void)setAuthURL:(NSString *)newAuthURL;
b/asi-http-request-with-pithos/Classes/Pithos/ASIPithosRequest.m
214 214
}
215 215

  
216 216
// GET authURL?[limit=limit]&[marker=marker]
217
+ (id)listSharingAccountsRequestWith:(NSUInteger)limit marker:(NSString *)marker {
217
+ (id)listSharingAccountsRequestWithLimit:(NSUInteger)limit marker:(NSString *)marker {
218 218
    NSString *queryString = @"?format=xml";
219 219
	if (limit && (limit > 0))
220 220
		queryString = [queryString stringByAppendingString:[NSString stringWithFormat:@"&limit=%lu", limit]];
......
253 253
- (void)parser:(NSXMLParser *)parser didEndElement:(NSString *)elementName namespaceURI:(NSString *)namespaceURI qualifiedName:(NSString *)qName {
254 254
	if ([elementName isEqualToString:@"name"]) {
255 255
        currentAccount.name = currentContent;
256
	} else if ([elementName isEqualToString:@"count"]) {
257
        currentAccount.count = [currentContent intValue];
256 258
    } else if ([elementName isEqualToString:@"last_modified"]) {
257 259
        currentAccount.lastModified = [[self dateFormatterWithFormatId:0] dateFromString:
258 260
                                       [currentContent stringByReplacingOccurrencesOfString:@":" 
259 261
                                                                                 withString:@"" 
260 262
                                                                                    options:NSBackwardsSearch 
261 263
                                                                                      range:NSMakeRange(([currentContent length] - 3), 1)]];
264
	} else if ([elementName isEqualToString:@"bytes"]) {
265
        currentAccount.bytes = [currentContent intValue];
262 266
	} else if ([elementName isEqualToString:@"account"]) {
263 267
		[sharingAccounts addObject:currentAccount];
264 268
        self.currentAccount = nil;
......
283 287
	if (dateFormatter == nil) {
284 288
        switch (formatId) {
285 289
            case 0:
286
                // date format: 2009-11-04T19:46:20.19+0000
290
                // date format: 2009-11-04T19:46:20.123456+0000
287 291
                // Needed for last_modified
288 292
                dateFormatter = [[[NSDateFormatter alloc] init] autorelease];
289 293
                [dateFormatter setLocale:[[[NSLocale alloc] initWithLocaleIdentifier:@"en_US_POSIX"] autorelease]];
290
                [dateFormatter setDateFormat:@"yyyy-MM-dd'T'HH:mm:ssZ"];
294
                [dateFormatter setDateFormat:@"yyyy-MM-dd'T'HH:mm:ss.SSSSSSZ"];
291 295
                [threadDict setObject:dateFormatter forKey:dateFormatterKey];
292 296
                break;
293 297
            case 1:

Also available in: Unified diff