JDBC-style URL?
The pg gem, which is the main PostgreSQL interface for Ruby, supports URLs for specifying the database to connect to. That's because it's just a wrapper around PostgreSQL's libpq, and libpq supports three ways to specify connections:
Individual settings for host, password, etc, passed to the library;
A PostgreSQL "connection string" like dbname=mydb user=fred password=d00rmat host=localhost port=5432 sslmode=require; or
A JDBC-style URL, like jdbc:postgresql://fred:d00rmat@localhost:5432/mydb?sslmode=require
so you don't need to do anything special. It's already supported by pg via libpq.
Web-service-style queries?
Now, if what you actually want is to query a PostgreSQL database like a web service API, e.g.
http://my-postgresql-server/q?query="SELECT * FROM users;"
and get responses like:
[
{"id":1, "name":"fred", ...},
...
]
... that's not supported directly by PostgreSQL. You'll need a mid-layer tool to expose the web-service API and broker for PostgreSQL. Think very hard about the security implications of allowing client apps to send arbitrary SQL; this is usually an extremely bad design, and you should instead write a proper web service API with request methods like:
http://my-appserver/api/1.0/fetchAllUsers