Class: IbmCloudResourceController::Common

Inherits:
Object
  • Object
show all
Defined in:
lib/ibm_cloud_resource_controller/common.rb

Overview

SDK Common class

Instance Method Summary collapse

Constructor Details

#initializeCommon

Returns a new instance of Common.



8
# File 'lib/ibm_cloud_resource_controller/common.rb', line 8

def initialize(*); end

Instance Method Details

#get_sdk_headers(service_name, service_version, operation_id) ⇒ Object



10
11
12
13
14
15
16
17
18
19
20
# File 'lib/ibm_cloud_resource_controller/common.rb', line 10

def get_sdk_headers(service_name, service_version, operation_id)
  headers = {}
  user_agent_string = "ibm_cloud_resource_controller-ruby-sdk-" + IbmCloudResourceController::VERSION + " #{RbConfig::CONFIG["host"]}"
  user_agent_string += " #{RbConfig::CONFIG["RUBY_BASE_NAME"]}-#{RbConfig::CONFIG["RUBY_PROGRAM_VERSION"]}"

  headers["User-Agent"] = user_agent_string
  return headers if service_name.nil? || service_version.nil? || operation_id.nil?

  headers["X-IBMCloud-SDK-Analytics"] = "service_name=#{service_name};service_version=#{service_version};operation_id=#{operation_id}"
  headers
end