Sha256: 559e7026b9a0a3336c93e4bef67321f701b0a158ff56f2d394d874ab9ab5a9c8

Contents?: true

Size: 650 Bytes

Versions: 13

Compression:

Stored size: 650 Bytes

Contents

class CustomHttpHeader
  attr_accessor :name, :version, :vendor
  attr_reader :library, :os, :platform

  HTTP_HEADER_FIELDS = [:name, :vendor, :version, :library, :platform, :os]
  HTTP_HEADER_PREFIX = 'X-RallyIntegration'

  def initialize
    @os = RUBY_PLATFORM
    @platform = "Ruby #{RUBY_VERSION}"
    @library = "RallyRestAPI version #{RallyRestVersion::LIBRARY_VERSION::STRING}"
    @name = "RubyRestAPI"
  end

  def add_headers(req)
    headers = {}
    HTTP_HEADER_FIELDS.each do |field|
      value = self.send(field)
      next if value.nil?
      req.add_field("#{HTTP_HEADER_PREFIX}#{field.to_s.capitalize}", value)
    end
  end
end

Version data entries

13 entries across 13 versions & 1 rubygems

Version Path
rally_rest_api-1.1.0 lib/rally_rest_api/custom_http_header.rb
rally_rest_api-1.0.6 lib/rally_rest_api/custom_http_header.rb
rally_rest_api-1.0.5 lib/rally_rest_api/custom_http_header.rb
rally_rest_api-1.0.4 lib/rally_rest_api/custom_http_header.rb
rally_rest_api-1.0.3 lib/rally_rest_api/custom_http_header.rb
rally_rest_api-1.0.2 lib/rally_rest_api/custom_http_header.rb
rally_rest_api-1.0.1 lib/rally_rest_api/custom_http_header.rb
rally_rest_api-0.9.0 lib/rally_rest_api/custom_http_header.rb
rally_rest_api-1.0.0 lib/rally_rest_api/custom_http_header.rb
rally_rest_api-0.7.10 lib/rally_rest_api/custom_http_header.rb
rally_rest_api-0.7.8 lib/rally_rest_api/custom_http_header.rb
rally_rest_api-0.7.9 lib/rally_rest_api/custom_http_header.rb
rally_rest_api-0.8.0 lib/rally_rest_api/custom_http_header.rb