lib/mrkt/concerns/crud_helpers.rb in mrkt-0.9.0 vs lib/mrkt/concerns/crud_helpers.rb in mrkt-0.10.0

- old
+ new

@@ -2,9 +2,16 @@ module CrudHelpers def map_lead_ids(lead_ids) lead_ids.map { |id| { id: id } } end + def post_json(url) + post(url) do |req| + payload = block_given? ? yield(req) : {} + json_payload(req, payload) + end + end + def json_payload(req, payload) req.headers[:content_type] = 'application/json' req.body = JSON.generate(payload) end end