Skip to content
This repository has been archived by the owner on Jul 30, 2019. It is now read-only.

Normalize parameters #57

Open
ruyrocha opened this issue Nov 5, 2013 · 3 comments
Open

Normalize parameters #57

ruyrocha opened this issue Nov 5, 2013 · 3 comments

Comments

@ruyrocha
Copy link
Contributor

ruyrocha commented Nov 5, 2013

Cpanel parameters are case sensitive - like FOO and foo are completely different things. The crazy part here is that you can make an API or function call with both params versions and only one will succeed, e.g:

  • call modifyacct with rs param to change an account's theme. Request will succeed but the account won't be modified
  • make the same call but use RS instead of rs. Request will succeed and account's theme will be changed

What if we normalize parameters? Lumberg should make the right request regardless of params' case.

@itspriddle
Copy link
Contributor

👍 here.

Snuggie is another example of an API that makes awful decisions when it comes to naming parameters. For that, we allow the normal, yet ugly params that match the upstream API credentials. Then we allow convenience params that Snuggie converts.

So, for your example above, something like:

def blah(params = {})
  params[:RS] = params.delete(:rs) if params.has_key?(:rs)
  ...
end

An example from Snuggie

@mzahir
Copy link
Contributor

mzahir commented Nov 6, 2013

👍

1 similar comment
@drichert
Copy link
Contributor

drichert commented Nov 6, 2013

👍

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants