Sha256: eb67aff0e5f9b75d959ccd068b41eb1f421fa1d2cfef4eba663f352496b4b63e
Contents?: true
Size: 835 Bytes
Versions: 9
Compression:
Stored size: 835 Bytes
Contents
require 'poms/api/client' module Poms module Api # The JsonClient module is a wrapper around the regular Client module. It # requests and responses to handle JSON-formatted bodies. module JsonClient DEFAULT_HEADERS = { 'Content-Type' => 'application/json', 'Accept' => 'application/json' }.freeze module_function def get(uri, credentials, headers = {}) response = Client.get( uri, credentials, DEFAULT_HEADERS.merge(headers) ) JSON.parse(response.body) end def post(uri, body, credentials, headers = {}) response = Client.post( uri, body.to_json, credentials, DEFAULT_HEADERS.merge(headers) ) JSON.parse(response.body) end end end end
Version data entries
9 entries across 9 versions & 1 rubygems