Skip to content

Commit

Permalink
starting with relationship types
Browse files Browse the repository at this point in the history
  • Loading branch information
maxdemarzi committed Mar 27, 2014
1 parent 5150fde commit bebb28e
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 22 deletions.
8 changes: 1 addition & 7 deletions lib/neography/rest.rb
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ module Neography

class Rest
include Helpers
include RelationshipTypes
extend Forwardable

attr_reader :connection
Expand All @@ -63,7 +64,6 @@ def initialize(options = ENV['NEO4J_URL'] || {})
@relationship_properties ||= RelationshipProperties.new(@connection)
@relationship_indexes ||= RelationshipIndexes.new(@connection)
@relationship_auto_indexes ||= RelationshipAutoIndexes.new(@connection)
@relationship_types ||= RelationshipTypes.new(@connection)

@cypher ||= Cypher.new(@connection)
@gremlin ||= Gremlin.new(@connection)
Expand All @@ -74,12 +74,6 @@ def initialize(options = ENV['NEO4J_URL'] || {})
@spatial ||= Spatial.new(@connection)
@constraints ||= Constraints.new(@connection)
end

# meta-data

def list_relationship_types
@relationship_types.list
end

# labels

Expand Down
15 changes: 4 additions & 11 deletions lib/neography/rest/relationship_types.rb
Original file line number Diff line number Diff line change
@@ -1,16 +1,9 @@
module Neography
class Rest
class RelationshipTypes
extend Neography::Rest::Paths

add_path :all, "/relationship/types"

def initialize(connection)
@connection ||= connection
end

def list
@connection.get(all_path)
module RelationshipTypes

def list_relationship_types
@connection.get("/relationship/types")
end

end
Expand Down
7 changes: 3 additions & 4 deletions spec/unit/rest/relationship_types_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,11 @@ module Neography
class Rest
describe RelationshipTypes do

let(:connection) { double(:configuration => "http://configuration") }
subject { RelationshipTypes.new(connection) }
subject { Neography::Rest.new }

it "lists all relationship types" do
connection.should_receive(:get).with("/relationship/types")
subject.list
subject.connection.should_receive(:get).with("/relationship/types")
subject.list_relationship_types
end
end
end
Expand Down

0 comments on commit bebb28e

Please sign in to comment.