/FSKit/Source/Common/FSKTempleService.m
Objective C | 74 lines | 36 code | 12 blank | 26 comment | 0 complexity | 4b27105c266caac4293caf93f9df9bc9 MD5 | raw file
Possible License(s): BSD-3-Clause
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 9#import "FSKTempleService.h" 10#import "FSKConnection.h" 11 12 13@implementation FSKTempleService 14 15+(FSKTempleService *)templeServiceWithConnection:(FSKConnection *)connection 16{ 17 return [[[FSKTempleService alloc] initWithConnection:connection] autorelease]; 18} 19 20-(id)initWithConnection:(FSKConnection *)familySearchConnection 21{ 22 self = [super init]; 23 moduleName = @"temple"; 24 versionString = @"v1"; 25 26 connection = familySearchConnection; 27 28 return self; 29} 30 31- (NSArray *)fetchTempleList{ 32 NSURL *myURL = [NSURL URLWithString:[NSString stringWithFormat:@"%@/temple/v1/temple/%@", [connection baseURLString], @""]]; 33 NSLog(@"url: %@", myURL); 34 NSError* err = nil; 35// NSXMLDocument *doc=[[NSXMLDocument alloc] initWithContentsOfURL:myURL options:0 error:&err]; 36// if (err) { 37// NSLog(@"Error: %@", err); 38// } 39// NSLog(@"\n%@",[doc XMLStringWithOptions:NSXMLNodePrettyPrint]); 40// NSLog(@"temple nodes: %@", [doc nodesForXPath:@"//temples/temple" error:&err]); 41// if (err) { 42// NSLog(@"Error: %@", err); 43// } 44// 45// return [doc nodesForXPath:@"//temples/temple" error:nil]; 46 return [NSArray arrayWithObjects:@"first", @"second", nil]; 47} 48- (FSTEMPLEV1Temple *)fetchTempleWithCode:(NSString *)code { 49 NSURL *myURL = [NSURL URLWithString:[NSString stringWithFormat:@"%@/temple/v1/temple/%@", [connection baseURLString], code]]; 50 NSLog(@"url: %@", myURL); 51 NSError* err = nil; 52// NSXMLDocument *doc=[[NSXMLDocument alloc] initWithContentsOfURL:myURL options:0 error:&err]; 53// if (err) { 54// NSLog(@"Error: %@", err); 55// } 56// NSLog(@"\n%@",[doc XMLStringWithOptions:NSXMLNodePrettyPrint]); 57// 58// return [[doc nodesForXPath:@"//temples/temple" error:nil] lastObject]; 59// // return [NSArray arrayWithObjects:@"first", @"second", nil]; 60 return nil;//[[FSTEMPLEV1TempleRootElement readFromXML:data]; 61} 62 63-(void) requestFinished:(id <EnunciateXML>)response 64{ 65 NSLog(@"%s %@", __PRETTY_FUNCTION__, response); 66} 67 68-(void) requestFailed:(NSError *)error 69{ 70 NSLog(@"%s %@", __PRETTY_FUNCTION__, error); 71} 72 73 74@end