Update REST/Client.pm

Enhancement. Changed according to Abstract factory pattern.
This should save about 150 lines of code.
NB: The interface have changed