class RallyAPI::CustomHttpHeader

Constants

HTTP_HEADER_FIELDS
HTTP_HEADER_PREFIX

Attributes

library[R]
name[RW]
os[R]
platform[R]
vendor[RW]
version[RW]

Public Class Methods

new(custom_vals = {}) click to toggle source
# File lib/rally_api/custom_http_header.rb, line 19
def initialize(custom_vals = {})
  @os = RUBY_PLATFORM
  @platform = "Ruby #{RUBY_VERSION}"
  @library = "RallyRestJson version #{RallyAPI::VERSION}"
  @name = "RallyRestJsonRuby"

  if custom_vals.keys.length > 0
    @name    = custom_vals[:name]     unless custom_vals[:name].nil?
    @version = custom_vals[:version]
    @vendor  = custom_vals[:vendor]
  end
end

Public Instance Methods

headers() click to toggle source
# File lib/rally_api/custom_http_header.rb, line 32
def headers
  headers = {}
  HTTP_HEADER_FIELDS.each do |field|
    value = self.send(field)
    next if value.nil?
    header_key = "#{HTTP_HEADER_PREFIX}#{field.to_s.capitalize}"
    headers[header_key.to_sym] = value
  end
  headers
end