I am trying to implement a library that provides an unified way to
communicate to a server which is changing its API calls from version to
version. I plan to implement it that way:
when ‘4.0’ then return Connect4.new(params)
when ‘5.0’ then return Connect5.new(params)
else ‘Version not supported.’
# Code for v4.
# Code for v5.
conn = Connect.getConn(:version => ‘4.0’)
I think it would work, but i’m still new to ruby and there might be
issues i’m not considering. Is there any best practice to handle these
kind of ‘challenge’?