diff options
| author | mo <mo@mokhan.ca> | 2018-05-07 14:45:08 -0600 |
|---|---|---|
| committer | mo <mo@mokhan.ca> | 2018-05-07 14:45:08 -0600 |
| commit | f66d272a243508ba665996a0c6cc78fcf23cb046 (patch) | |
| tree | 8f3de1553a6c35652d78e2c3229da42f36f693b9 | |
| parent | 7bd5698c3fe2d56dad04db0a6ee9d685673d4a3d (diff) | |
extract mapper method.
| -rw-r--r-- | lib/net/hippie/client.rb | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/lib/net/hippie/client.rb b/lib/net/hippie/client.rb index 5aeef9a..d36de5d 100644 --- a/lib/net/hippie/client.rb +++ b/lib/net/hippie/client.rb @@ -63,9 +63,13 @@ module Net def request_for(type, uri, headers: {}, body: {}) type.new(uri, default_headers.merge(headers)).tap do |x| - x.body = JSON.generate(body) unless body.empty? + x.body = map_from(body) unless body.empty? end end + + def map_from(hash) + JSON.generate(hash) + end end end end |
