forked from this-sam/myFlock
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathASIS3BucketObject.m
61 lines (51 loc) · 1.48 KB
/
ASIS3BucketObject.m
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
//
// ASIS3BucketObject.m
// Part of ASIHTTPRequest -> http://allseeing-i.com/ASIHTTPRequest
//
// Created by Ben Copsey on 13/07/2009.
// Copyright 2009 All-Seeing Interactive. All rights reserved.
//
#import "ASIS3BucketObject.h"
#import "ASIS3Request.h"
@implementation ASIS3BucketObject
+ (id)objectWithBucket:(NSString *)bucket
{
ASIS3BucketObject *object = [[[self alloc] init] autorelease];
[object setBucket:bucket];
return object;
}
- (void)dealloc
{
[key release];
[lastModified release];
[ETag release];
[ownerID release];
[ownerName release];
[super dealloc];
}
- (ASIS3Request *)GETRequest
{
return [ASIS3Request requestWithBucket:[self bucket] path:[NSString stringWithFormat:@"/%@",[self key]]];
}
- (ASIS3Request *)PUTRequestWithFile:(NSString *)filePath
{
return [ASIS3Request PUTRequestForFile:filePath withBucket:[self bucket] path:[NSString stringWithFormat:@"/%@",[self key]]];
}
- (ASIS3Request *)DELETERequest
{
ASIS3Request *request = [ASIS3Request requestWithBucket:[self bucket] path:[NSString stringWithFormat:@"/%@",[self key]]];
[request setRequestMethod:@"DELETE"];
return request;
}
- (NSString *)description
{
return [NSString stringWithFormat:@"Key: %@ lastModified: %@ ETag: %@ size: %llu ownerID: %@ ownerName: %@",[self key],[self lastModified],[self ETag],[self size],[self ownerID],[self ownerName]];
}
@synthesize bucket;
@synthesize key;
@synthesize lastModified;
@synthesize ETag;
@synthesize size;
@synthesize ownerID;
@synthesize ownerName;
@end