Expand the env with more properties, without overriding existing ones. Useful for applying request params after restoring a marshalled Response.
# File lib/faraday/response.rb, line 93 def apply_request(request_env) raise "response didn't finish yet" unless finished? @env = request_env.merge @env return self end
# File lib/faraday/response.rb, line 51 def body finished? ? env[:body] : nil end
# File lib/faraday/response.rb, line 68 def finish(env) raise "response already finished" if finished? @env = env @on_complete_callbacks.each { |callback| callback.call(env) } return self end
# File lib/faraday/response.rb, line 46 def headers finished? ? env[:response_headers] : {} end
because @on_complete_callbacks cannot be marshalled
# File lib/faraday/response.rb, line 80 def marshal_dump !finished? ? nil : { :status => @env[:status], :body => @env[:body], :response_headers => @env[:response_headers] } end
# File lib/faraday/response.rb, line 87 def marshal_load(env) @env = env end
# File lib/faraday/response.rb, line 59 def on_complete if not finished? @on_complete_callbacks << Proc.new else yield env end return self end
Generated with the Darkfish Rdoc Generator 2.