Skip to content

Instantly share code, notes, and snippets.

@kevinejohn
Created July 17, 2012 17:47
Show Gist options
  • Save kevinejohn/3130793 to your computer and use it in GitHub Desktop.
Save kevinejohn/3130793 to your computer and use it in GitHub Desktop.
Restkit Post object with RootKeyPath and return object without RootKeyPath
RKObjectMapping* merchantSignupMapping = [RKObjectMapping mappingForClass:[WLMerchantSignup class]];
[merchantSignupMapping mapKeyPathsToAttributes:
nil];
[paymentProcessorObjectManager.mappingProvider addObjectMapping:merchantSignupMapping];
//[paymentProcessorObjectManager.mappingProvider setMapping:merchantSignupMapping forKeyPath:@""];
[paymentProcessorObjectManager.mappingProvider setSerializationMapping:[merchantSignupMapping inverseMapping] forClass:[WLMerchantSignup class]];
[paymentProcessorObjectManager.router routeClass:[WLMerchantSignup class] toResourcePath:SERVER_WLMERCHANTSIGNUP];
//[paymentProcessorObjectManager.mappingProvider registerObjectMapping:merchantSignupMapping withRootKeyPath:@"merchant"];
[[RKObjectManager sharedManager] postObject:merchant usingBlock:^(RKObjectLoader * loader) {
loader.objectMapping = [appdelegate.paymentProcessorObjectManager.mappingProvider objectMappingForClass:[WLMerchantSignup class]];
//loader.targetObject = nil;
[loader.serializationMapping setRootKeyPath:@"merchant"];
loader.delegate = self;
}];
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment