Class: GdsApi::Rummager::V2

Inherits:
SimpleDelegator
  • Object
show all
Defined in:
lib/gds_api/rummager.rb

Defined Under Namespace

Classes: InvalidIndex

Instance Method Summary collapse

Instance Method Details

#add_document(id, document, index_name) ⇒ Object

Raises:


31
32
33
34
35
36
37
38
39
# File 'lib/gds_api/rummager.rb', line 31

def add_document(id, document, index_name)
  raise(InvalidIndex, index_name) unless index_name == 'metasearch'
  post_json(
    "#{base_url}/v2/metasearch/documents",
    document.merge(
      _id: id,
    )
  )
end

#delete_document(id, index_name) ⇒ Object

Raises:


41
42
43
44
# File 'lib/gds_api/rummager.rb', line 41

def delete_document(id, index_name)
  raise(InvalidIndex, index_name) unless index_name == 'metasearch'
  delete_json("#{base_url}/v2/metasearch/documents/#{id}")
end