move some code from client to lib

for better testing
test discover_registration_services.rb client