Major refactor and fix #2

Hey @remen 
Can you please take a look?
I've refactored/moved the classes a little bit to promote a bigger separation of concerns and also added the rubocop gem to ensure a consistent coding throughout the project.
Also I've implemented the timeout on the wait function and added tests.

Next steps would be adding a travis ci build, badges, possibly a coverage report, refactor the specs a little bit...
Do you have any other ideas or feature requests?

C&C are welcomed.

Thanks for reviewing,