Object
# File lib/chef_zero/rest_request.rb, line 11 def base_uri @base_uri ||= "#{env['rack.url_scheme']}://#{env['HTTP_HOST']}#{env['SCRIPT_NAME']}" end
# File lib/chef_zero/rest_request.rb, line 27 def body @body ||= env['rack.input'].read end
# File lib/chef_zero/rest_request.rb, line 23 def body=(body) @body = body end
# File lib/chef_zero/rest_request.rb, line 15 def method @env['REQUEST_METHOD'] end
# File lib/chef_zero/rest_request.rb, line 31 def query_params @query_params ||= begin params = Rack::Request.new(env).GET params.keys.each do |key| params[key] = URI.unescape(params[key]) end params end end
# File lib/chef_zero/rest_request.rb, line 19 def rest_path @rest_path ||= env['PATH_INFO'].split('/').select { |part| part != "" } end
# File lib/chef_zero/rest_request.rb, line 41 def to_s result = "#{method} #{rest_path.join('/')}" if query_params.size > 0 result << "?#{query_params.map { |k,v| "#{k}=#{v}" }.join('&') }" end if body.chomp != '' result << "\n--- #{method} BODY ---\n" result << body result << "\n" if !body.end_with?("\n") result << "--- END #{method} BODY ---" end result end
Generated with the Darkfish Rdoc Generator 2.