Update Code Climate badge.
Little refactor in api handler.

Extract EventHandler instance to a var in order to make the code
a little clearer.