0.04
Low commit activity in last 3 years
No release in over a year
Simple JSON-RPC 2.0 client implementation
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
 Dependencies

Development

>= 0
>= 0

Runtime

>= 1.1.0
 Project Readme

JSONRPC::Client

Simple JSON-RPC 2.0 client implementation. See the specification.

Installation

Add this line to your application's Gemfile:

gem 'jsonrpc-client'

And then execute:

$ bundle

Or install it yourself as:

$ gem install jsonrpc-client

Usage

client = JSONRPC::Client.new('http://example.com')
client.add_numbers(1, 2, 3)

Passing a customized connection

By default, the client uses a plain Faraday connection with Faraday's default adapter to connect to the JSON-RPC endpoint. If you wish to customize this connection, you can pass your own Faraday object into the constructor. In this example, SSL verification is disabled and HTTP Basic Authentication is used:

connection = Faraday.new { |connection|
  connection.adapter Faraday.default_adapter
  connection.ssl.verify = false  # This is a baaaad idea!
  connection.basic_auth('username', 'password')
}
client = JSONRPC::Client.new("http://example.com", { connection: connection })

More information about Faraday is available at that project's GitHub page.

Contributing

  1. Fork it
  2. Create your feature branch (git checkout -b my-new-feature)
  3. Commit your changes (git commit -am 'Add some feature')
  4. Push to the branch (git push origin my-new-feature)
  5. Create new Pull Request