lib/reviewed/request.rb in reviewed-0.2.2 vs lib/reviewed/request.rb in reviewed-0.4.0
- old
+ new
@@ -1,18 +1,20 @@
module Reviewed
class Request
attr_accessor :client, :resource
- attr_reader :path
def initialize(opts={})
- if opts[:resource].kind_of?(Class)
- @resource = opts[:resource]
- @path = @resource.path
+ @resource = opts[:resource]
+ @scope = opts[:scope]
+ @client = opts[:client] || Reviewed::Client.new
+ end
+
+ def path
+ if @resource.respond_to? :to_path
+ @resource.to_path(@scope)
else
- @path = opts[:resource].to_s
+ @resource.to_s
end
-
- @client = opts[:client] || Reviewed::Client.new
end
# Get request on resource#show
def find(id, params={})
url_path = [path, CGI::escape(id.to_s)]