def request(opts = {})
method = opts.delete(:_method)
path = opts.delete(:_path)
headers = opts.delete(:_headers)
opts.delete_if { |key, _| key.to_s =~ /^_/ }
if method == :options
request.headers.merge!(headers) if headers
response = @connection.run_request method, path, opts, headers
else
response = @connection.send method do |request|
request.headers.merge!(headers) if headers
if method == :get
request.url path, opts
else
request.url path
request.body = opts
end
end
end
{ :parsed_data => response.env[:body], :response => response }
end