Changeset 11864 for lang/objective-c
- Timestamp:
- 05/18/08 13:16:13 (6 months ago)
- Location:
- lang/objective-c/HatebuCoreData
- Files:
-
- 2 added
- 4 modified
-
AuthTest.m (modified) (4 diffs)
-
HatebuCoreData.xcodeproj/project.pbxproj (modified) (5 diffs)
-
HatenaBookmark.h (modified) (1 diff)
-
HatenaBookmark.m (modified) (2 diffs)
-
HatenaBookmarkTest.h (added)
-
HatenaBookmarkTest.m (added)
Legend:
- Unmodified
- Added
- Removed
-
lang/objective-c/HatebuCoreData/AuthTest.m
r11839 r11864 10 10 #import "AuthPrivate.h" 11 11 12 13 12 @implementation AuthTest 14 13 … … 16 15 NSString *cred = WSSE_credentials(@"user", @"pass"); 17 16 STAssertNotNil(cred, @"credential", cred); 18 NSLog(@"testWSSE: cred: %@", cred);19 17 } 20 18 … … 42 40 STAssertNotNil(data, @"Failed to create data"); 43 41 NSString *str = [[NSString alloc] initWithData:data encoding:NSUTF8StringEncoding]; 44 NSLog(@"str: %@", str);45 42 46 43 NSHTTPURLResponse* http = (NSHTTPURLResponse*) resp; … … 50 47 } 51 48 52 53 49 @end -
lang/objective-c/HatebuCoreData/HatebuCoreData.xcodeproj/project.pbxproj
r11839 r11864 29 29 86FD397E0DDF42F50016EAA6 /* AuthTest.m in Sources */ = {isa = PBXBuildFile; fileRef = 86FD397D0DDF42F50016EAA6 /* AuthTest.m */; }; 30 30 86FD397F0DDF42F50016EAA6 /* AuthTest.m in Sources */ = {isa = PBXBuildFile; fileRef = 86FD397D0DDF42F50016EAA6 /* AuthTest.m */; }; 31 86FD39C80DDFBA7B0016EAA6 /* HatenaBookmarkTest.m in Sources */ = {isa = PBXBuildFile; fileRef = 86FD39C70DDFBA7B0016EAA6 /* HatenaBookmarkTest.m */; }; 32 86FD39C90DDFBA7B0016EAA6 /* HatenaBookmarkTest.m in Sources */ = {isa = PBXBuildFile; fileRef = 86FD39C70DDFBA7B0016EAA6 /* HatenaBookmarkTest.m */; }; 33 86FD39CC0DDFD3780016EAA6 /* HatenaBookmark.m in Sources */ = {isa = PBXBuildFile; fileRef = 86FD383B0DDE073A0016EAA6 /* HatenaBookmark.m */; }; 31 34 8D11072B0486CEB800E47090 /* InfoPlist.strings in Resources */ = {isa = PBXBuildFile; fileRef = 089C165CFE840E0CC02AAC07 /* InfoPlist.strings */; }; 32 35 8D11072D0486CEB800E47090 /* main.m in Sources */ = {isa = PBXBuildFile; fileRef = 29B97316FDCFA39411CA2CEA /* main.m */; settings = {ATTRIBUTES = (); }; }; … … 70 73 86FD397D0DDF42F50016EAA6 /* AuthTest.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = AuthTest.m; sourceTree = "<group>"; }; 71 74 86FD39C00DDF4BAE0016EAA6 /* AuthPrivate.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = AuthPrivate.h; sourceTree = "<group>"; }; 75 86FD39C60DDFBA7B0016EAA6 /* HatenaBookmarkTest.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = HatenaBookmarkTest.h; sourceTree = "<group>"; }; 76 86FD39C70DDFBA7B0016EAA6 /* HatenaBookmarkTest.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = HatenaBookmarkTest.m; sourceTree = "<group>"; }; 72 77 8D1107310486CEB800E47090 /* Info.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist; path = Info.plist; sourceTree = "<group>"; }; 73 78 8D1107320486CEB800E47090 /* HatebuCoreData.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = HatebuCoreData.app; sourceTree = BUILT_PRODUCTS_DIR; }; … … 206 211 86FD397C0DDF42F50016EAA6 /* AuthTest.h */, 207 212 86FD397D0DDF42F50016EAA6 /* AuthTest.m */, 213 86FD39C60DDFBA7B0016EAA6 /* HatenaBookmarkTest.h */, 214 86FD39C70DDFBA7B0016EAA6 /* HatenaBookmarkTest.m */, 208 215 ); 209 216 name = "Test Cases"; … … 317 324 86FD396D0DDF40800016EAA6 /* WSSE.m in Sources */, 318 325 86FD397E0DDF42F50016EAA6 /* AuthTest.m in Sources */, 326 86FD39C80DDFBA7B0016EAA6 /* HatenaBookmarkTest.m in Sources */, 327 86FD39CC0DDFD3780016EAA6 /* HatenaBookmark.m in Sources */, 319 328 ); 320 329 runOnlyForDeploymentPostprocessing = 0; … … 334 343 86FD396E0DDF40800016EAA6 /* WSSE.m in Sources */, 335 344 86FD397F0DDF42F50016EAA6 /* AuthTest.m in Sources */, 345 86FD39C90DDFBA7B0016EAA6 /* HatenaBookmarkTest.m in Sources */, 336 346 ); 337 347 runOnlyForDeploymentPostprocessing = 0; -
lang/objective-c/HatebuCoreData/HatenaBookmark.h
r11714 r11864 11 11 @interface Bookmark (Hatena) 12 12 13 +(NSURLRequest *) makeRequest:(NSURL *)url withFields:(NSDictionary *)fields; 14 +(NSString *) sendRequest:(NSURLRequest *)request; 15 16 +(NSURL *) baseURL; 17 +(NSURL *) editURL:(NSString *)resource; 18 +(NSURL *) feedURL; 19 20 13 21 @end 22 // vim:set ft=objc: -
lang/objective-c/HatebuCoreData/HatenaBookmark.m
r11810 r11864 6 6 // Copyright 2008 deadbeaf.org. All rights reserved. 7 7 // 8 // for API detail, see 9 // http://d.hatena.ne.jp/keyword/%A4%CF%A4%C6%A4%CA%A5%D6%A5%C3%A5%AF%A5%DE%A1%BC%A5%AFAtomAPI 8 10 9 11 #import "HatenaBookmark.h" 10 12 13 @implementation Bookmark (Hatena) 11 14 12 @implementation Bookmark (Hatena) 15 +(NSURL *) baseURL { 16 return [NSURL URLWithString:@"http://b.hatena.ne.jp/atom"]; 17 } 18 19 +(NSURL *) editURL:(NSString *)resource { 20 return [NSURL URLWithString:[NSString stringWithFormat:@"%@/edit/%@", [[self baseURL] absoluteString], resource]]; 21 } 22 23 +(NSURL *) feedURL { 24 return [NSURL URLWithString:[NSString stringWithFormat:@"%@/feed", [[self baseURL] absoluteString]]]; 25 } 13 26 14 27 -(void) update { … … 16 29 } 17 30 31 +(NSURLRequest *) makeRequest:(NSURL *)url withFields:(NSDictionary *)fields { 32 NSMutableURLRequest* req = [NSMutableURLRequest 33 requestWithURL: url 34 cachePolicy: NSURLRequestReloadIgnoringCacheData 35 timeoutInterval: 60]; 36 [req setHTTPShouldHandleCookies: NO]; 37 [req setValue: @"gzip" forHTTPHeaderField: @"Accept-Encoding"]; 38 39 for (id key in fields) { 40 [req setValue: [fields objectForKey:key] forHTTPHeaderField: key]; 41 } 42 43 return req; 44 } 45 46 +(NSString *) sendRequest:(NSURLRequest *)request { 47 // send request 48 NSURLResponse* resp; 49 NSError* error; 50 NSData* data = [NSURLConnection sendSynchronousRequest: request 51 returningResponse: &resp 52 error: &error]; 53 54 if (nil == data) { 55 NSException *e = [NSException exceptionWithName:@"RequestSendException" 56 reason:@"sendSynchronousRequest dit not retrieve any data" userInfo:nil]; 57 @throw e; 58 } 59 60 return [[NSString alloc] initWithData:data encoding:NSUTF8StringEncoding]; 61 } 62 18 63 @end 64 // vim:set ft=objc:
![(please configure the [header_logo] section in trac.ini)](/share/chrome/site/your_project_logo.png)