Skip to content

Latest commit

 

History

History
48 lines (31 loc) · 1.36 KB

README.md

File metadata and controls

48 lines (31 loc) · 1.36 KB

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