Class: Neography::Rest::AutoIndexes
- Inherits:
-
Object
- Object
- Neography::Rest::AutoIndexes
show all
- Includes:
- Helpers
- Defined in:
- lib/neography/rest/auto_indexes.rb
Instance Method Summary
collapse
Methods included from Helpers
#get_id, #json_content_type, #parse_direction
Constructor Details
#initialize(connection) ⇒ AutoIndexes
Returns a new instance of AutoIndexes.
6
7
8
|
# File 'lib/neography/rest/auto_indexes.rb', line 6
def initialize(connection)
@connection = connection
end
|
Instance Method Details
#add_property(property) ⇒ Object
50
51
52
53
54
55
56
|
# File 'lib/neography/rest/auto_indexes.rb', line 50
def add_property(property)
options = {
:body => property,
:headers => json_content_type
}
@connection.post(index_properties_path, options)
end
|
#find(key, value) ⇒ Object
26
27
28
|
# File 'lib/neography/rest/auto_indexes.rb', line 26
def find(key, value)
@connection.get(key_value_path(:key => key, :value => value)) || []
end
|
#find_or_query(key_or_query, value = nil) ⇒ Object
16
17
18
19
20
21
22
23
24
|
# File 'lib/neography/rest/auto_indexes.rb', line 16
def find_or_query(key_or_query, value = nil)
if value
index = find(key_or_query, value)
else
index = query(key_or_query)
end
return nil if index.empty?
index
end
|
#get(key, value) ⇒ Object
10
11
12
13
14
|
# File 'lib/neography/rest/auto_indexes.rb', line 10
def get(key, value)
index = @connection.get(key_value_path(:key => key, :value => value)) || []
return nil if index.empty?
index
end
|
#properties ⇒ Object
46
47
48
|
# File 'lib/neography/rest/auto_indexes.rb', line 46
def properties
@connection.get(index_properties_path)
end
|
#query(query_expression) ⇒ Object
30
31
32
|
# File 'lib/neography/rest/auto_indexes.rb', line 30
def query(query_expression)
@connection.get(query_index_path(:query => query_expression)) || []
end
|
#remove_property(property) ⇒ Object
58
59
60
|
# File 'lib/neography/rest/auto_indexes.rb', line 58
def remove_property(property)
@connection.delete(index_property_path(:property => property))
end
|
#status ⇒ Object
34
35
36
|
# File 'lib/neography/rest/auto_indexes.rb', line 34
def status
@connection.get(index_status_path)
end
|
#status=(value) ⇒ Object
38
39
40
41
42
43
44
|
# File 'lib/neography/rest/auto_indexes.rb', line 38
def status=(value)
options = {
:body => value.to_json,
:headers => json_content_type
}
@connection.put(index_status_path, options)
end
|