adwords_api/lib/adwords_api/report_header_handler.rb
def headers(url, cid)
      override = (cid.nil?) ? nil : {:client_customer_id => cid}
      credentials = @credential_handler.credentials(override)
      headers = {
          'Content-Type' => 'application/x-www-form-urlencoded',
          'Authorization' => @auth_handler.auth_string(credentials),
          'User-Agent' => @credential_handler.generate_user_agent(),
          'clientCustomerId' => credentials[:client_customer_id].to_s,
          'developerToken' => credentials[:developer_token]
      }
      skip_report_header = @config.read('library.skip_report_header')
      unless skip_report_header.nil?
        headers['skipReportHeader'] = skip_report_header.to_s
      end
      skip_report_summary = @config.read('library.skip_report_summary')
      unless skip_report_summary.nil?
        headers['skipReportSummary'] = skip_report_summary.to_s
      end
      skip_column_header = @config.read('library.skip_column_header')
      unless skip_column_header.nil?
        headers['skipColumnHeader'] = skip_column_header.to_s
      end
      include_zero_impressions =
          @config.read('library.include_zero_impressions')
      unless include_zero_impressions.nil?
        headers['includeZeroImpressions'] = include_zero_impressions.to_s
      end
      use_raw_enum_values =
          @config.read('library.use_raw_enum_values')
      unless use_raw_enum_values.nil?
        headers['useRawEnumValues'] = use_raw_enum_values.to_s
      end
      return headers
    end
def headers(url, cid)
      override = (cid.nil?) ? nil : {:client_customer_id => cid}
      credentials = @credential_handler.credentials(override)
      headers = {
          'Content-Type' => 'application/x-www-form-urlencoded',
          'Authorization' => @auth_handler.auth_string(credentials),
          'User-Agent' => @credential_handler.generate_user_agent(),
          'clientCustomerId' => credentials[:client_customer_id].to_s,
          'developerToken' => credentials[:developer_token]
      }
      skip_report_header = @config.read('library.skip_report_header')
      unless skip_report_header.nil?
        headers['skipReportHeader'] = skip_report_header.to_s
      end
      skip_report_summary = @config.read('library.skip_report_summary')
      unless skip_report_summary.nil?
        headers['skipReportSummary'] = skip_report_summary.to_s
      end
      skip_column_header = @config.read('library.skip_column_header')
      unless skip_column_header.nil?
        headers['skipColumnHeader'] = skip_column_header.to_s
      end
      include_zero_impressions =
          @config.read('library.include_zero_impressions')
      unless include_zero_impressions.nil?
        headers['includeZeroImpressions'] = include_zero_impressions.to_s
      end
      use_raw_enum_values =
          @config.read('library.use_raw_enum_values')
      unless use_raw_enum_values.nil?
        headers['useRawEnumValues'] = use_raw_enum_values.to_s
      end
      return headers
    end
def headers ( url , cid ) override = ( cid . nil? ) ? nil : { :client_customer_id => cid } credentials = @credential_handler . credentials ( override ) headers = { 'Content-Type' => 'application/x-www-form-urlencoded' , 'Authorization' => @auth_handler . auth_string ( credentials ) , 'User-Agent' => @credential_handler . generate_user_agent ( ) , 'clientCustomerId' => credentials [ :client_customer_id ] . to_s , 'developerToken' => credentials [ :developer_token ] } skip_report_header = @config . read ( 'library.skip_report_header' ) unless skip_report_header . nil? headers [ 'skipReportHeader' ] = skip_report_header . to_s end skip_report_summary = @config . read ( 'library.skip_report_summary' ) unless skip_report_summary . nil? headers [ 'skipReportSummary' ] = skip_report_summary . to_s end skip_column_header = @config . read ( 'library.skip_column_header' ) unless skip_column_header . nil? headers [ 'skipColumnHeader' ] = skip_column_header . to_s end include_zero_impressions = @config . read ( 'library.include_zero_impressions' ) unless include_zero_impressions . nil? headers [ 'includeZeroImpressions' ] = include_zero_impressions . to_s end use_raw_enum_values = @config . read ( 'library.use_raw_enum_values' ) unless use_raw_enum_values . nil? headers [ 'useRawEnumValues' ] = use_raw_enum_values . to_s end return headers end
Initializes a header handler.

 Args:
  - credential_handler: a header with credential data
  - auth_handler: a header with auth data
  - config: API config

 Returns the headers set for the report request.

 Args:
  - url: URL for the report requests
  - cid: clientCustomerId to use

 Returns:
  - a Hash with HTTP headers.
Initializes a header handler .