module S3Search::API::Documents

Public Instance Methods

create(data, options={}) click to toggle source
# File lib/s3search/api/documents.rb, line 7
def create data, options={}
  raise 'use create_many for multiple documents' if data.is_a?(Array)
  _post('/v1/documents.json', {data: data, options: options})
end
create_many(data, options={}) click to toggle source
# File lib/s3search/api/documents.rb, line 12
def create_many data, options={}
  response = _post('/v1/documents.json', {data: [data].flatten}, options: options)
  response.results
end
delete(id) click to toggle source
# File lib/s3search/api/documents.rb, line 17
def delete id
  _delete "/v1/documents/#{id}.json"
end
get(id) click to toggle source
# File lib/s3search/api/documents.rb, line 21
def get id
  _get "/v1/documents/#{id}.json"
end
get_all(options={}) click to toggle source
# File lib/s3search/api/documents.rb, line 29
def get_all options={}
  options[:page] ||= 1
  options[:per_page] ||= 25
  response = _get("/v1/documents.json", options)
  S3Search::ResultPage.new(response, self)
end
update(id, attributes) click to toggle source
# File lib/s3search/api/documents.rb, line 25
def update id, attributes
  _put("/v1/documents/#{id}.json", {document: attributes})
end