Module: ForemanRhCloud::CloudRequest

Extended by:
ActiveSupport::Concern
Included in:
CertAuth, ForemanRhCloud::CloudPingService::CertPing, CloudPresence, CloudRequestForwarder
Defined in:
app/services/foreman_rh_cloud/cloud_request.rb

Instance Method Summary collapse

Instance Method Details

#execute_cloud_request(params) ⇒ Object



5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
# File 'app/services/foreman_rh_cloud/cloud_request.rb', line 5

def execute_cloud_request(params)
  final_params = {
    verify_ssl: ForemanRhCloud.verify_ssl_method,
    proxy: ForemanRhCloud.transformed_http_proxy_string(logger: logger),
  }.deep_merge(params)

  response = RestClient::Request.execute(final_params)

  logger.debug("Response headers for request url #{final_params[:url]} are: #{response.headers}")

  response
rescue RestClient::Exception => ex
  logger.debug("Failed response with code #{ex.http_code} headers for request url #{final_params[:url]} are: #{ex.http_headers} and body: #{ex.http_body}")
  raise ex
end