Class: MmJsonClient::JsonRpcHttp::Client
- Inherits:
-
Object
- Object
- MmJsonClient::JsonRpcHttp::Client
- Defined in:
- lib/mm_json_client/json_rpc_http/client.rb
Overview
A helper client for doing JSON-RPC calls over http.
Instance Method Summary collapse
-
#initialize(base_url, options = {}) ⇒ Client
constructor
A new instance of Client.
-
#request(method, params = nil, id = false) ⇒ Object
id defaults to false to detect if was specified.
Constructor Details
#initialize(base_url, options = {}) ⇒ Client
Returns a new instance of Client.
9 10 11 12 13 |
# File 'lib/mm_json_client/json_rpc_http/client.rb', line 9 def initialize(base_url, = {}) @http_client = MmJsonClient::HttpClient::Client.new(base_url, [:endpoint], ()) end |
Instance Method Details
#request(method, params = nil, id = false) ⇒ Object
id defaults to false to detect if was specified. Null is a valid value according to the spec.
17 18 19 20 |
# File 'lib/mm_json_client/json_rpc_http/client.rb', line 17 def request(method, params = nil, id = false) http_response = @http_client.post((method, params, id)) MmJsonClient::JsonRpcHttp::Response.new(http_response.body) end |