'Implements the callable interface that discovery.build() expects
of requestBuilder, which is to build an object compatible with
HttpRequest.execute(). See that method for the description of the
parameters and the expected response.'

def __call__(self, http, postproc, uri, method='GET', body=None, headers=None, methodId=None, resumable=None):

    if (methodId in self.responses):
        response = self.responses[methodId]
        (resp, content) = response[:2]
        if (len(response) > 2):
            expected_body = response[2]
            if (bool(expected_body) != bool(body)):
                raise UnexpectedBodyError(expected_body, body)
            if isinstance(expected_body, str):
                expected_body = json.loads(expected_body)
            body = json.loads(body)
            if (body != expected_body):
                raise UnexpectedBodyError(expected_body, body)
        return HttpRequestMock(resp, content, postproc)
    elif self.check_unexpected:
        raise UnexpectedMethodError(methodId=methodId)
    else:
        model = JsonModel(False)
        return HttpRequestMock(None, '{}', model.response)
