Bitcoin-ruby returns "nil" value for bitcoin-cli calls
The above code is only using RPC to Bitcoin Core and bitcoin-ruby is not used.

The problem is the body parameter name when sending the request.
Change param key to params as follow.

request.body = {method: method, params: param, id: 'jsonrpc'}.to_json