lib/restly/connection.rb in restly-0.0.1.alpha.19 vs lib/restly/connection.rb in restly-0.0.1.alpha.22
- old
+ new
@@ -1,10 +1,10 @@
class Restly::Connection < OAuth2::AccessToken
attr_accessor :cache, :cache_options
- delegate :resource, :resource_name, to: :client
+ delegate :resource, :resource_name, :base_path, to: :client
# TODO: Refactor with subclasses that have their own tokenize methods.
def self.tokenize(client, object)
if object.is_a?(Hash)
@@ -62,9 +62,12 @@
end
alias_method :forced_request, :request
def request(verb, path, opts={}, &block)
+ path = [base_path, path.gsub(/^\/?/, '')].join('/')
+ puts path.blue
+
if cache && !opts[:force]
request_log("Restly::CacheRequest", path, verb) do
cached_request(verb, path, opts, &block)
end
else
\ No newline at end of file