Maremma: a Ruby library for simplified network calls¶ ↑
Ruby utility library for network requests. Based on Faraday and Excon, provides a wrapper for XML/JSON parsing and error handling. All successful responses are returned as hash with key data
, all errors in a JSONAPI-friendly hash with key errors
.
Installation¶ ↑
The usual way with Bundler: add the following to your Gemfile
to install the current version of the gem:
gem 'maremma'
Then run bundle install
to install into your environment.
You can also install the gem system-wide in the usual way:
gem install maremma
Usage¶ ↑
Maremma.get 'https://dlm.datacite.org/heartbeat' => { "data" => { "services"=>{ "mysql"=>"OK", "memcached"=>"OK", "redis"=>"OK", "sidekiq"=>"OK", "postfix"=>"failed" }, "version"=>"4.3", "status"=>"failed" }} Maremma.post 'http://example.com', data: { 'foo' => 'baz' }