Sha256: 998c6b3541b4c02a9a454787c656c513e9fe8eea8e2a33abf145056e45732a3b

Contents?: true

Size: 377 Bytes

Versions: 4

Compression:

Stored size: 377 Bytes

Contents

require 'json'
module Inquisitio
  class Document

    attr_reader :type, :id, :version, :fields

    def initialize(type, id, version, fields)
      @type = type
      @id = id
      @version = version
      @fields = fields.reject { |_, v| v.nil? }
    end

    def to_sdf
      "{ \"type\": \"#{type}\", \"id\": \"#{id}\", \"fields\": #{fields.to_json} }"
    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
inquisitio-2.1.2 lib/inquisitio/document.rb
inquisitio-2.1.1 lib/inquisitio/document.rb
inquisitio-2.1.0 lib/inquisitio/document.rb
inquisitio-2.0.0 lib/inquisitio/document.rb