Sha256: 3541e022f0e2672e385a0f8155e790f458f1c082b56827762c1a840a2148eca6

Contents?: true

Size: 410 Bytes

Versions: 10

Compression:

Stored size: 410 Bytes

Contents

module Mrkt
  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
end

Version data entries

10 entries across 10 versions & 1 rubygems

Version Path
mrkt-1.2.2 lib/mrkt/concerns/crud_helpers.rb
mrkt-1.2.1 lib/mrkt/concerns/crud_helpers.rb
mrkt-1.2.0 lib/mrkt/concerns/crud_helpers.rb
mrkt-1.1.1 lib/mrkt/concerns/crud_helpers.rb
mrkt-1.1.0 lib/mrkt/concerns/crud_helpers.rb
mrkt-1.0.1 lib/mrkt/concerns/crud_helpers.rb
mrkt-1.0.0 lib/mrkt/concerns/crud_helpers.rb
mrkt-0.11.1 lib/mrkt/concerns/crud_helpers.rb
mrkt-0.11.0 lib/mrkt/concerns/crud_helpers.rb
mrkt-0.10.0 lib/mrkt/concerns/crud_helpers.rb