The impl code:

-(void) read:(id)value
     success:(void (^)(id responseObject))success
     failure:(void (^)(NSError *error))failure {
    
    if (value == nil || [value isKindOfClass:[NSNull class]]) {
        [self raiseError:@"read" msg:@"read id value was nil" failure:failure];
        // do nothing
        return;
    }
    
    // try to add auth.token:
    [self applyAuthToken];

    // TODO: move to function:
    NSString* objectKey;
    if ([value isKindOfClass:[NSString class]]) {
        objectKey = value;
    } else {
        objectKey = [value stringValue];
    }

    [_restClient getPath:[self appendObjectPath:objectKey] parameters:nil success:^(AFHTTPRequestOperation *operation, id responseObject) {
        
        if (success) {
            //TODO: NSLog(@"Invoking successblock....");
            success(responseObject);
        }
    } failure:^(AFHTTPRequestOperation *operation, NSError *error) {
        
        if (failure) {
            //TODO: NSLog(@"Invoking failure block....");
            failure(error);
        }
    }];
}

More todo:

  • move the string value fu into a function (there are other places in the class, that do the same....)
  • Since the unit test passes... we also need an integration test (on the integration test app)
    • read with string:
      [_tasks read:@"72" success:^(id responseObject) {........
      
    • read with number:
      [_tasks read:@72 success:^(id responseObject) {........
      
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira