Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove duplication between Windows::ServiceBase and Online::ServiceBase #8

Open
mcmire opened this issue Oct 11, 2013 · 0 comments
Open

Comments

@mcmire
Copy link

mcmire commented Oct 11, 2013

Making requests and parsing responses from the API is very similar between QBD and QBO. These similarities should be extracted. For instance, here is the general process for making a request:

  • Perform an HTTP request, building parameters if necessary
  • Check the response. If the response is anything but a 200, throw an error
  • If a 200, parse the response data into objects

This similarity (and simplicity) is not reflected in the individual ServiceBases for each service type.

Furthermore, the code to create requests and parse responses is not very well tested. There are some tests, but these methods are contained in a superclass and are private methods, and as such, testing them as they are doesn't feel right. We should extract this code to Request and Response objects so that they can be tested in isolation.

Because there are differences between the different service types for building parameters and parsing response data, there should be individual Request and Response classes for each service type, but they should delegate to "parent" Request and Response classes (which should be tested on their own).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

No branches or pull requests

1 participant