Module: Neography::Rest::NodeAutoIndexes

Included in:
Neography::Rest
Defined in:
lib/neography/rest/node_auto_indexes.rb

Instance Method Summary collapse

Instance Method Details

#add_node_auto_index_property(property) ⇒ Object



45
46
47
48
49
50
51
# File 'lib/neography/rest/node_auto_indexes.rb', line 45

def add_node_auto_index_property(property)
  options = {
    :body => property,
    :headers => json_content_type
  }
  @connection.post("/index/auto/node/properties", options)
end

#find_node_auto_index(key_or_query, value = nil) ⇒ Object



11
12
13
14
15
16
17
18
19
# File 'lib/neography/rest/node_auto_indexes.rb', line 11

def find_node_auto_index(key_or_query, value = nil)
  if value
    index = find_node_auto_index_by_value(key_or_query, value)
  else
    index = query_node_auto_index(key_or_query)
  end
  return nil if index.empty?
  index
end

#find_node_auto_index_by_value(key, value) ⇒ Object



21
22
23
# File 'lib/neography/rest/node_auto_indexes.rb', line 21

def find_node_auto_index_by_value(key, value)
  @connection.get("/index/auto/node/%{key}/%{value}" % {:key => key, :value => encode(value)}) || []
end

#get_node_auto_index(key, value) ⇒ Object



5
6
7
8
9
# File 'lib/neography/rest/node_auto_indexes.rb', line 5

def get_node_auto_index(key, value)
  index = @connection.get("/index/auto/node/%{key}/%{value}" % {:key => key, :value => encode(value)}) || []
  return nil if index.empty?
  index
end

#get_node_auto_index_propertiesObject



41
42
43
# File 'lib/neography/rest/node_auto_indexes.rb', line 41

def get_node_auto_index_properties
  @connection.get("/index/auto/node/properties")
end

#get_node_auto_index_statusObject



29
30
31
# File 'lib/neography/rest/node_auto_indexes.rb', line 29

def get_node_auto_index_status
  @connection.get("/index/auto/node/status")
end

#query_node_auto_index(query_expression) ⇒ Object



25
26
27
# File 'lib/neography/rest/node_auto_indexes.rb', line 25

def query_node_auto_index(query_expression)
  @connection.get("/index/auto/node/?query=%{query}" % {:query => encode(query_expression)}) || []
end

#remove_node_auto_index_property(property) ⇒ Object



53
54
55
# File 'lib/neography/rest/node_auto_indexes.rb', line 53

def remove_node_auto_index_property(property)
  @connection.delete("/index/auto/node/properties/%{property}" % {:property => property})
end

#set_node_auto_index_status(value = true) ⇒ Object



33
34
35
36
37
38
39
# File 'lib/neography/rest/node_auto_indexes.rb', line 33

def set_node_auto_index_status(value = true)
  options = {
    :body => value.to_json,
    :headers => json_content_type
  }
  @connection.put("/index/auto/node/status", options)
end