Module: Neography::Rest::Constraints

Includes:
Helpers
Included in:
Neography::Rest
Defined in:
lib/neography/rest/constraints.rb

Instance Method Summary collapse

Methods included from Helpers

#encode, #escape, #get_id, #json_content_type, #parse_depth, #parse_direction, #parse_order, #parse_type, #parse_uniqueness

Instance Method Details

#create_unique_constraint(label, property) ⇒ Object



26
27
28
29
30
31
32
33
34
# File 'lib/neography/rest/constraints.rb', line 26

def create_unique_constraint(label, property)
  options = {
    :body => {
      :property_keys => [property]
    }.to_json,
    :headers => json_content_type
  }
  @connection.post("/schema/constraint/%{label}/uniqueness/" % {:label => label}, options)
end

#drop_constraint(label, property) ⇒ Object



6
7
8
# File 'lib/neography/rest/constraints.rb', line 6

def drop_constraint(label, property)
  @connection.delete("/schema/constraint/%{label}/uniqueness/%{property}" % {:label => label, :property => property})
end

#get_constraints(label = nil) ⇒ Object



10
11
12
13
14
15
16
# File 'lib/neography/rest/constraints.rb', line 10

def get_constraints(label=nil)
  #if label.nil?
  #  @connection.get(base_path)          
  #else
    @connection.get("/schema/constraint/%{label}" % {:label => label})
  #end
end

#get_unique_constraint(label, property) ⇒ Object



22
23
24
# File 'lib/neography/rest/constraints.rb', line 22

def get_unique_constraint(label, property)
  @connection.get("/schema/constraint/%{label}/uniqueness/%{property}" % {:label => label, :property => property})
end

#get_uniqueness(label) ⇒ Object



18
19
20
# File 'lib/neography/rest/constraints.rb', line 18

def get_uniqueness(label)
  @connection.get("/schema/constraint/%{label}/uniqueness/" % {:label => label})
end