diff options
| author | mo <mo@mokhan.ca> | 2018-05-07 14:55:40 -0600 |
|---|---|---|
| committer | mo <mo@mokhan.ca> | 2018-05-07 14:55:40 -0600 |
| commit | 8fa9c4e921b87c6d7b3b8d34a4506653ad5117c9 (patch) | |
| tree | 6c8841d23808e0d27f89c10492192915ea41893d /README.md | |
| parent | 9014e187ce3591a3faf1075efac830893f023e0d (diff) | |
support a passphrase.v0.1.0
Diffstat (limited to 'README.md')
| -rw-r--r-- | README.md | 40 |
1 files changed, 35 insertions, 5 deletions
@@ -1,8 +1,7 @@ # Net::Hippie -Welcome to your new gem! In this directory, you'll find the files you need to be able to package up your Ruby library into a gem. Put your Ruby code in the file `lib/net/hippie`. To experiment with that code, run `bin/console` for an interactive prompt. - -TODO: Delete this and the text above, and describe your gem +Net::Hippie is a light weight wrapper around `net/http` that defaults to +sending JSON messages. ## Installation @@ -22,7 +21,38 @@ Or install it yourself as: ## Usage -TODO: Write usage instructions here +```ruby +require 'net/hippie' + +Net::Hippie.logger = Rails.logger + +client = Net::Hippie::Client.new(headers: { + 'Accept' => 'application/vnd.haveibeenpwned.v2+json' +}) + +response = client.get(URI.parse('https://haveibeenpwned.com/api/breaches')) + +puts JSON.parse(response.body) +``` + +Net::Hippie also supports TLS with client authentication. + +```ruby +client = Net::Hippie::Client.new( + certificate: ENV['CLIENT_CERTFICIATE'], + key: ENV['CLIENT_KEY'] +) +``` + +If your private key is encrypted you may include a passphrase to decrypt it. + +```ruby +client = Net::Hippie::Client.new( + certificate: ENV['CLIENT_CERTFICIATE'], + key: ENV['CLIENT_KEY'], + passphrase: ENV['CLIENT_KEY_PASSPHRASE'] +) +``` ## Development @@ -32,7 +62,7 @@ To install this gem onto your local machine, run `bundle exec rake install`. To ## Contributing -Bug reports and pull requests are welcome on GitHub at https://github.com/[USERNAME]/net-hippie. +Bug reports and pull requests are welcome on GitHub at https://github.com/mokhan/net-hippie. ## License |
