Module: Neography::Rest::RelationshipAutoIndexes

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

Instance Method Summary collapse

Instance Method Details

#add_relationship_auto_index_property(property) ⇒ Object



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

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

#find_relationship_auto_index(key_or_query, value = nil) ⇒ Object



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

def find_relationship_auto_index(key_or_query, value = nil)
  if value
    index = find_relationship_auto_index_by_value(key_or_query, value)
  else
    index = query_relationship_auto_index(key_or_query)
  end
  return nil if index.empty?
  index
end

#find_relationship_auto_index_by_value(key, value) ⇒ Object



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

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

#get_relationship_auto_index(key, value) ⇒ Object



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

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

#get_relationship_auto_index_propertiesObject



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

def get_relationship_auto_index_properties
  @connection.get("/index/auto/relationship/properties")
end

#get_relationship_auto_index_statusObject



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

def get_relationship_auto_index_status
  @connection.get("/index/auto/relationship/status")
end

#query_relationship_auto_index(query_expression) ⇒ Object



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

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

#remove_relationship_auto_index_property(property) ⇒ Object



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

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

#set_relationship_auto_index_status(value = true) ⇒ Object



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

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