Skip to content

Commit

Permalink
Fixed chaining to be on coordinator
Browse files Browse the repository at this point in the history
  • Loading branch information
dizzy42 committed Jun 12, 2012
1 parent 49a1734 commit 0f80c12
Showing 1 changed file with 26 additions and 7 deletions.
33 changes: 26 additions & 7 deletions lib/rest_resource/coordinator.rb
Original file line number Diff line number Diff line change
@@ -1,13 +1,6 @@
module RestResource
class Coordinator

delegate :where,
:from,
:limit,
:offset,
:select,
to: :query_interface

def initialize(klazz)
@klazz = klazz
end
Expand All @@ -16,6 +9,31 @@ def query_interface
@query_interface ||= RestResource::QueryInterface.new(@url)
end

def where(*args)
query_interface.where(*args)
self
end

def from(*args)
query_interface.from(args)
self
end

def limit(*args)
query_interface.limit(args)
self
end

def offset(*args)
query_interface.offset(args)
self
end

def select(*args)
query_interface.select(args)
self
end

def first
request = connection.get(query_interface.first_url, query_interface.params)
hydra.queue(request)
Expand All @@ -27,6 +45,7 @@ def all
request = connection.get(query_interface.all_url, query_interface.params)
hydra.queue(request)
hydra.run
p request
parse(request.response.body)
end

Expand Down

0 comments on commit 0f80c12

Please sign in to comment.