lib/restful_resource/base.rb in restful_resource-0.0.10 vs lib/restful_resource/base.rb in restful_resource-0.0.11

- old
+ new

@@ -3,28 +3,30 @@ def self.url=(url) @url = url end def self.processed_url_and_params(params={}) - url = @url + uri = URI(@url) + path = uri.path other_params = params.clone missing_params = [] - url_params = url.scan(/:([A-Za-z][^\/]*)/).flatten - url_params.each do |key| + path_params = path.scan(/:([A-Za-z][^\/]*)/).flatten + path_params.each do |key| value = other_params.delete(key.to_sym) if value.nil? missing_params << key else - url = url.gsub(':'+key.to_s, value.to_s) + path = path.gsub(':'+key.to_s, value.to_s) end end if missing_params.any? raise ParameterMissingError.new(missing_params) end - - [url, other_params] + + uri.path = path + [uri.to_s, other_params] end def self.url(params={}) processed_url_and_params(params).first end