+(void) getFPConPolicy
{
RKLogConfigureByName("RestKit", RKLogLevelWarning);
RKLogConfigureByName("RestKit/ObjectMapping", RKLogLevelTrace);
RKLogConfigureByName("RestKit/Network", RKLogLevelTrace);
NSMutableURLRequest *request = [[HESMAXHttpClient sharedClient] requestWithMethod:@"GET" path:@"/api/RemoteCheck/GetFpConPolicy" parameters:nil];
RKObjectManager *manager = [RKObjectManager sharedManager];
manager.requestSerializationMIMEType = RKMIMETypeJSON;
NSIndexSet *statusCodes = RKStatusCodeIndexSetForClass(RKStatusCodeClassSuccessful);
RKObjectMapping* responseMapping = [RKObjectMapping mappingForClass:[HESFpConPolicy class]];
[responseMapping addAttributeMappingsFromArray: @[@"FP_LEVEL",@"DBIDS_ALLOWED",@"MAX_BRIDGE",@"CAC_SCAN",@"STATE_ID",@"PIV_ENABLED",@"CAC_ENABLED",@"TWIC_ENABLED",@"PIN_REQUIRED",@"FP_REQUIRED",@"MANUAL_ALLOWED"]];
[responseMapping addAttributeMappingsFromDictionary:@{@"fpconresults.FP_LEVEL" : @"FpConLevel",
@"fpconresults.DBIDS_ALLOWED" : @"DbidsAllowed",
@"fpconresults.MAX_BRIDGE" : @"MaxIdScanAllowed" ,
@"fpconresults.CAC_SCAN" : @"CacScanAllowed" ,
@"fpconresults.STATE_ID" : @"StateIdScanAllowed",
@"fpconresults.PIV_ENABLED" : @"PivReadAllowed",
@"fpconresults.CAC_ENABLED" : @"CacReadAllowed",
@"fpconresults.TWIC_ENABLED" : @"TwicReadAllowed",
@"fpconresults.PIN_REQUIRED" : @"PinRequired",
@"fpconresults.FP_REQUIRED" : @"FingerPrintRequired",
@"fpconresults.MANUAL_ALLOWED":@"ManualAllowed"
}];
RKResponseDescriptor *responseDescriptor =
[RKResponseDescriptor responseDescriptorWithMapping:responseMapping
method:RKRequestMethodGET
pathPattern:@"/api/RemoteCheck/GetFpConPolicy"
keyPath:@"fpconresults"
statusCodes:statusCodes];
[manager addResponseDescriptor:responseDescriptor];
RKObjectRequestOperation *operation = [manager objectRequestOperationWithRequest:request success:nil failure:nil];
[operation start];
[operation waitUntilFinished];
if (operation.error == nil)
{
NSError *error;
RKMappingResult *mappingResult = operation.mappingResult;
HESFpConPolicy * model = mappingResult.array[0];
if (error != nil)
{
RKLogError(@"Failure calling GetFpConPolicy");
}
else
{
RKLogInfo(@"Good Return from GetFpConPolicy");
[self setFpConPolicyValues: model];
}
}
else
{
RKLogError(@"Failure calling GetFpConPolicy");
[self setFPConPolicyValuesError];
}
}
Here's the declaration of HESFpConPolicy:
@interface HESFpConPolicy : NSObject
@property (nonatomic, strong) NSString *CacScanAllowed;
@property (nonatomic, strong) NSString *StateIdScanAllowed;
@property (nonatomic, strong) NSString *MaxIdScanAllowed;
@property (nonatomic, strong) NSString *CacReadAllowed;
@property (nonatomic, strong) NSString *PivReadAllowed;
@property (nonatomic, strong) NSString *TwicReadAllowed;
@property (nonatomic, strong) NSString *PinRequired;
@property (nonatomic, strong) NSString *FingerPrintRequired;
@property (nonatomic, strong) NSString *DbidsAllowed;
@property (nonatomic, strong) NSString *FpConLevel;
@property (nonatomic, strong) NSString *ManualAllowed;
@end
I can't provide the URL we're hitting publicly, but I'll be happy to provide it to you in a private email. When the call is made, the following is the JSON data return:
in the above code, mappingResult always comes back with 0 objects.