/FSKit/Source/iPhone/Common/FSKPedigreeRequest.m

http://fskit.googlecode.com/ · Objective C · 41 lines · 28 code · 6 blank · 7 comment · 0 complexity · 20a065170b480e495e623a8e7b8f24f9 MD5 · raw file

  1. //
  2. // FSKPedigreeRequest.m
  3. // FSKit
  4. //
  5. // Created by Logan Allred on 3/3/09.
  6. // Copyright 2009 RedBugz Software. All rights reserved.
  7. //
  8. #import "FSKPedigreeRequest.h"
  9. #import "FSKPedigreeResponse.h"
  10. @implementation FSKPedigreeRequest
  11. + (void)fetchPedigreeForId:(NSString *)personId
  12. ancestors:(int)ancestors
  13. descendants:(int)descendants
  14. connection:aFamilySearchConnection
  15. delegate:(id)aDelegate
  16. selector:(SEL)aSelector
  17. {
  18. FSKPedigreeRequest *request = [[FSKPedigreeRequest alloc] initWithFamilySearchConnection:aFamilySearchConnection delegate:aDelegate selector:aSelector];
  19. [request sendPedigreeRequestWithId:personId ancestors:ancestors descendants:descendants];
  20. }
  21. - (void)sendPedigreeRequestWithId:(NSString *)personId
  22. ancestors:(int)ancestors
  23. descendants:(int)descendants
  24. {
  25. [self fetchFamilySearchDataAtEndpoint:@"familytree/v2/pedigree" WithIds:[NSSet setWithObject:personId]
  26. parameters:[NSDictionary dictionaryWithObjectsAndKeys:[[NSNumber numberWithInt:ancestors] stringValue], @"ancestors", [[NSNumber numberWithInt:descendants] stringValue], @"descendants", nil]];
  27. }
  28. - (FSKPedigreeResponse *)responseWithData:(NSData *)data
  29. {
  30. NSLog(@"%s", __PRETTY_FUNCTION__);
  31. FSKPedigreeResponse *response = [[FSKPedigreeResponse alloc] initWithData:data];
  32. NSLog(@"response code: %d message: %@", [response statusCode], [response statusMessage]);
  33. return [response autorelease];
  34. }
  35. @end