Sha256: d5d9e09b386a1c767ae01269ebb3203aa210f5aae49d8e53fd6fd0a3d7bc4496

Contents?: true

Size: 328 Bytes

Versions: 3

Compression:

Stored size: 328 Bytes

Contents

# frozen_string_literal: true

module Net
  module Hippie
    # Converts a ruby hash into a JSON string
    class ContentTypeMapper
      def map_from(headers, body)
        content_type = headers['Content-Type'] || ''
        return JSON.generate(body) if content_type.include?('json')
        body
      end
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
net-hippie-0.1.9 lib/net/hippie/content_type_mapper.rb
net-hippie-0.1.8 lib/net/hippie/content_type_mapper.rb
net-hippie-0.1.7 lib/net/hippie/content_type_mapper.rb