lib/apidiesel/request.rb in apidiesel-0.9 vs lib/apidiesel/request.rb in apidiesel-0.10
- old
+ new
@@ -11,10 +11,20 @@
@action = action
@parameters = parameters
@metadata = metadata
end
+ def url
+ @url ||=
+ case action.url
+ when Proc
+ action.url.call(action.base_url, self)
+ when URI
+ action.url
+ end
+ end
+
def response_body
@response_body || http_response.try(:body)
end
def process_response
@@ -29,10 +39,10 @@
def to_s
[
"Apidiesel::Request",
action.http_method.to_s.upcase,
- action.url.try(:to_s),
+ url.try(:to_s),
action.endpoint,
parameters.collect { |key, value| "#{key}: #{value}"}.join(',')
].join(' ')
end
end