Class: IbmCloudActivityTracker::Common
- Inherits:
-
Object
- Object
- IbmCloudActivityTracker::Common
- Defined in:
- lib/ibm_cloud_activity_tracker/common.rb
Overview
SDK Common class
Instance Method Summary collapse
- #get_sdk_headers(service_name, service_version, operation_id, service_key) ⇒ Object
-
#initialize ⇒ Common
constructor
A new instance of Common.
Constructor Details
#initialize ⇒ Common
Returns a new instance of Common.
8 |
# File 'lib/ibm_cloud_activity_tracker/common.rb', line 8 def initialize(*); end |
Instance Method Details
#get_sdk_headers(service_name, service_version, operation_id, service_key) ⇒ Object
10 11 12 13 14 15 16 17 18 19 20 21 22 |
# File 'lib/ibm_cloud_activity_tracker/common.rb', line 10 def get_sdk_headers(service_name, service_version, operation_id, service_key) headers = {} user_agent_string = "ibm_cloud_activity_tracker-ruby-sdk-" + IbmCloudActivityTracker::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["servicekey"] = service_key headers["X-IBMCloud-SDK-Analytics"] = "service_name=#{service_name};service_version=#{service_version};operation_id=#{operation_id}" headers end |