Conversation
|
@mapuo +1 |
|
I don't like the solution. If the first argument is JSON object - you will not be able to pass it at all. |
|
What is the exact case? Can you provide an example? :) |
|
|
|
I've added a test for that case and it is passing, is this ok with you? :) |
|
No, I mean that my hash is not named params, but just the first parameter of the method. In your implementation we cannot do this anymore. |
|
Agrh! You are right, of course, but that don't leaves us with a lot of choices. |
|
Is that refactoring better now in your opinion? |
|
Hey, I was wondering did you had time to see the latest refactoring and will you merge them? |
lib/jsonrpc/client.rb
Outdated
There was a problem hiding this comment.
You need to check for the args.size == 1, because it can be [{foo: 'bar'}, 2]
|
Hi, I've got an API I'm attempting to use jsonrpc-client for and it requires named parameters and will explicitly reject requests that are nested inside an array. Will there be any further progress on this PR? |
|
It's trivial to build an RPC client using faraday and a simple middleware: |
|
@romanbsd Thank's for the suggestion, that looks perfect for my needs as a very basic client. |
|
@mattikus I added a usage example in a comment there |
We should have support for named parameters when making JSON RPC calls, this patch makes it possible to do just that with minimal modifications.
When the user asks for
client.foo(1)orclient.bar(1,2)we should make an array, so the resultingparamskey should have[1]or[1,2]respectively.When the user asks for
client.foo(:bar => 'foo')we should pass them directly, so the resultingparamskey should be{"bar": "foo"}.