SmartlingFileApi.sendRequest contains too many conditions. Splitting of this method was discussed couple times in reviews 162 and 163. Probably we could leave it as is, but i see code becames more complex after each commit 81de044. No one even thinks how to test this method. We put too many responsibilities on the single method:
- Decide how to prepare query according to http method (GET\POST\DELETE)
- Validate parameters
- Make a decision what is inside API response (file body or JSON with stats)
- Decide how to parse API response
- Error handling
We have fixed number API calls. We always know input parameters and what will be returned. We must group API calls and use appropriate implementation of sendRequest for each group.
DoD: SmartlingFileApi.sendRequest is rewritten by couple methods without over responsibility and low cyclomatic complexity
SmartlingFileApi.sendRequestcontains too many conditions. Splitting of this method was discussed couple times in reviews 162 and 163. Probably we could leave it as is, but i see code becames more complex after each commit 81de044. No one even thinks how to test this method. We put too many responsibilities on the single method:We have fixed number API calls. We always know input parameters and what will be returned. We must group API calls and use appropriate implementation of
sendRequestfor each group.DoD:
SmartlingFileApi.sendRequestis rewritten by couple methods without over responsibility and low cyclomatic complexity