teamcity-ruby-client
teamcity-ruby-client copied to clipboard
Consistent method arguments
I wanted to start a conversation around consistent method arguments and get opinions on what flavor folks like best. I'll list a few to start, suggestions are welcome.
Any methods that only require one argument should be using a hash, see example
Hash parameters
method(id: 'value', param2: 'value')
single parameters
method(id, param2)
Parameters using blocks
method do |options|
options.id = 'value'
options.param2 = 'value'
end
Sorry I was unclear, I meant just for building the request string to send to the get method. I totally agree that sending the complete hash to the method is appropriate.
@myanaros - thanks for your response, I will probably review all places that aren't using the hash approach and convert them over, this will probably be a major version upgrade since it will break anyone using the old api. I may support both as a way to allow folks to migrate over. I hope this hasn't caused too much confusion =)
It all makes sense, this gem has saved me more time than I can imagine. I look forward to the new version!
Thanks, glad to hear the gem has been helping you out.
@myanaros - Just released 0.4.0