48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
|
# File 'lib/delphix/client.rb', line 48
def self.internal_request(request, timeout)
HTTP_HEADERS.each { |key, value| request.(key, value) }
response = nil
begin
case request.method
when :get
response = RestClient::Request.execute(
method: :get,
url: request.url,
headers: request.,
timeout: timeout
)
when :post
response = RestClient::Request.execute(
method: :post,
url: request.url,
payload: request.body,
headers: request.,
timeout: timeout
)
when :delete
response = RestClient::Request.execute(
method: :delete,
url: request.url,
payload: request.body,
headers: request.,
timeout: timeout
)
end
rescue RestClient::RequestTimeout
raise 'Request Timeout'
rescue RestClient::Exception => e
response = e.response
end
Delphix::Response.new(response)
end
|