From bebb28e0ccb2c66d428fcc90630eff753ae24ccf Mon Sep 17 00:00:00 2001 From: Max De Marzi Date: Wed, 26 Mar 2014 23:43:31 -0500 Subject: [PATCH] starting with relationship types --- lib/neography/rest.rb | 8 +------- lib/neography/rest/relationship_types.rb | 15 ++++----------- spec/unit/rest/relationship_types_spec.rb | 7 +++---- 3 files changed, 8 insertions(+), 22 deletions(-) diff --git a/lib/neography/rest.rb b/lib/neography/rest.rb index 8e2f8e1..9feff94 100644 --- a/lib/neography/rest.rb +++ b/lib/neography/rest.rb @@ -39,6 +39,7 @@ module Neography class Rest include Helpers + include RelationshipTypes extend Forwardable attr_reader :connection @@ -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) @@ -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 diff --git a/lib/neography/rest/relationship_types.rb b/lib/neography/rest/relationship_types.rb index 46a6a17..f4546c2 100644 --- a/lib/neography/rest/relationship_types.rb +++ b/lib/neography/rest/relationship_types.rb @@ -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 diff --git a/spec/unit/rest/relationship_types_spec.rb b/spec/unit/rest/relationship_types_spec.rb index fc7fb9b..4bb1e3d 100644 --- a/spec/unit/rest/relationship_types_spec.rb +++ b/spec/unit/rest/relationship_types_spec.rb @@ -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