/FSKit/Source/Common/FSKTempleService.m

http://fskit.googlecode.com/ · Objective C · 74 lines · 36 code · 12 blank · 26 comment · 0 complexity · 4b27105c266caac4293caf93f9df9bc9 MD5 · raw file

  1. //
  2. // TempleService.m
  3. // FSKit
  4. //
  5. // Created by Logan Allred on 9/16/07.
  6. // Copyright 2008 Logan Allred. All rights reserved.
  7. //
  8. #import "FSKTempleService.h"
  9. #import "FSKConnection.h"
  10. @implementation FSKTempleService
  11. +(FSKTempleService *)templeServiceWithConnection:(FSKConnection *)connection
  12. {
  13. return [[[FSKTempleService alloc] initWithConnection:connection] autorelease];
  14. }
  15. -(id)initWithConnection:(FSKConnection *)familySearchConnection
  16. {
  17. self = [super init];
  18. moduleName = @"temple";
  19. versionString = @"v1";
  20. connection = familySearchConnection;
  21. return self;
  22. }
  23. - (NSArray *)fetchTempleList{
  24. NSURL *myURL = [NSURL URLWithString:[NSString stringWithFormat:@"%@/temple/v1/temple/%@", [connection baseURLString], @""]];
  25. NSLog(@"url: %@", myURL);
  26. NSError* err = nil;
  27. // NSXMLDocument *doc=[[NSXMLDocument alloc] initWithContentsOfURL:myURL options:0 error:&err];
  28. // if (err) {
  29. // NSLog(@"Error: %@", err);
  30. // }
  31. // NSLog(@"\n%@",[doc XMLStringWithOptions:NSXMLNodePrettyPrint]);
  32. // NSLog(@"temple nodes: %@", [doc nodesForXPath:@"//temples/temple" error:&err]);
  33. // if (err) {
  34. // NSLog(@"Error: %@", err);
  35. // }
  36. //
  37. // return [doc nodesForXPath:@"//temples/temple" error:nil];
  38. return [NSArray arrayWithObjects:@"first", @"second", nil];
  39. }
  40. - (FSTEMPLEV1Temple *)fetchTempleWithCode:(NSString *)code {
  41. NSURL *myURL = [NSURL URLWithString:[NSString stringWithFormat:@"%@/temple/v1/temple/%@", [connection baseURLString], code]];
  42. NSLog(@"url: %@", myURL);
  43. NSError* err = nil;
  44. // NSXMLDocument *doc=[[NSXMLDocument alloc] initWithContentsOfURL:myURL options:0 error:&err];
  45. // if (err) {
  46. // NSLog(@"Error: %@", err);
  47. // }
  48. // NSLog(@"\n%@",[doc XMLStringWithOptions:NSXMLNodePrettyPrint]);
  49. //
  50. // return [[doc nodesForXPath:@"//temples/temple" error:nil] lastObject];
  51. // // return [NSArray arrayWithObjects:@"first", @"second", nil];
  52. return nil;//[[FSTEMPLEV1TempleRootElement readFromXML:data];
  53. }
  54. -(void) requestFinished:(id <EnunciateXML>)response
  55. {
  56. NSLog(@"%s %@", __PRETTY_FUNCTION__, response);
  57. }
  58. -(void) requestFailed:(NSError *)error
  59. {
  60. NSLog(@"%s %@", __PRETTY_FUNCTION__, error);
  61. }
  62. @end