Module: Vra::Http
- Defined in:
- lib/vra/http.rb
Defined Under Namespace
Classes: Error, Request, Response
Class Method Summary
collapse
Class Method Details
.error(response) ⇒ Object
21
22
23
|
# File 'lib/vra/http.rb', line 21
def self.error(response)
Error.from_response(response)
end
|
.execute(params) ⇒ Object
7
8
9
10
11
12
13
14
15
16
17
18
19
|
# File 'lib/vra/http.rb', line 7
def self.execute(params)
request = Request.new(params)
response = request.call
response = response.forward(request).call until response.final?
if ENV["VRA_HTTP_TRACE"]
puts "#{request.params[:method].upcase} #{request.params[:url]}" unless request.params.nil?
puts ">>>>> #{JSON.parse(request.params[:payload]).to_json.gsub(/\"password\":\"(.+)\",/, '"password":"********",' )}" unless request.params[:payload].nil?
puts "<<<<< #{JSON.parse(response.body).to_json}" unless response.body.nil?
end
raise error(response) unless response.success?
response
end
|