Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Newer
Older
100644 120 lines (78 sloc) 1.98 kb
96b2053 @mattgemmell MGTwitterEngine re-import.
authored
1 //
2 // MGTwitterHTTPURLConnection.m
3 // MGTwitterEngine
4 //
5 // Created by Matt Gemmell on 16/02/2008.
6 // Copyright 2008 Instinctive Code.
7 //
8
9 #import "MGTwitterHTTPURLConnection.h"
10 #import "NSString+UUID.h"
11
12
38d2f2f Cleaned up use of OAMutableURLRequest's prepare method
Steve Streza authored
13
14 @interface NSURLRequest (OAuthExtensions)
15 -(void)prepare;
16 @end
17
18 @implementation NSURLRequest (OAuthExtensions)
19
20 -(void)prepare{
21 // do nothing
22 }
23
24 @end
25
26
27
96b2053 @mattgemmell MGTwitterEngine re-import.
authored
28 @implementation MGTwitterHTTPURLConnection
29
30
c1d314e @jabley #39 Changes to MGTwitterEngine to provide fuller error messages.
jabley authored
31 @synthesize response = _response;
32
96b2053 @mattgemmell MGTwitterEngine re-import.
authored
33 #pragma mark Initializer
34
35
36 - (id)initWithRequest:(NSURLRequest *)request delegate:(id)delegate
37 requestType:(MGTwitterRequestType)requestType responseType:(MGTwitterResponseType)responseType
38 {
38d2f2f Cleaned up use of OAMutableURLRequest's prepare method
Steve Streza authored
39 // OAuth requests need to have -prepare called on them first. handle that case before the NSURLConnection sends it
40 [request prepare];
41
149aa99 @richardbuckle Made assignments in if() explicit, by more parens.
richardbuckle authored
42 if ((self = [super initWithRequest:request delegate:delegate])) {
96b2053 @mattgemmell MGTwitterEngine re-import.
authored
43 _data = [[NSMutableData alloc] initWithCapacity:0];
44 _identifier = [[NSString stringWithNewUUID] retain];
45 _requestType = requestType;
46 _responseType = responseType;
47 _URL = [[request URL] retain];
48 }
49
50 return self;
51 }
52
53
54 - (void)dealloc
55 {
c1d314e @jabley #39 Changes to MGTwitterEngine to provide fuller error messages.
jabley authored
56 [_response release];
96b2053 @mattgemmell MGTwitterEngine re-import.
authored
57 [_data release];
58 [_identifier release];
59 [_URL release];
60 [super dealloc];
61 }
62
63
64 #pragma mark Data helper methods
65
66
67 - (void)resetDataLength
68 {
69 [_data setLength:0];
70 }
71
72
73 - (void)appendData:(NSData *)data
74 {
75 [_data appendData:data];
76 }
77
78
79 #pragma mark Accessors
80
81
82 - (NSString *)identifier
83 {
84 return [[_identifier retain] autorelease];
85 }
86
87
88 - (NSData *)data
89 {
90 return [[_data retain] autorelease];
91 }
92
93
94 - (NSURL *)URL
95 {
96 return [[_URL retain] autorelease];
97 }
98
99
100 - (MGTwitterRequestType)requestType
101 {
102 return _requestType;
103 }
104
105
106 - (MGTwitterResponseType)responseType
107 {
108 return _responseType;
109 }
110
111
112 - (NSString *)description
113 {
114 NSString *description = [super description];
115
c8ba147 Removed -getFollowedTimelineFor:* methods since they are no longer su…
Craig Hockenberry authored
116 return [description stringByAppendingFormat:@" (requestType = %d, identifier = %@)", _requestType, _identifier];
96b2053 @mattgemmell MGTwitterEngine re-import.
authored
117 }
118
119 @end
Something went wrong with that request. Please try again.