Class: RallyAPI::CustomHttpHeader
- Inherits:
-
Object
- Object
- RallyAPI::CustomHttpHeader
- Defined in:
- lib/rally_api/custom_http_header.rb
Constant Summary collapse
- HTTP_HEADER_FIELDS =
[:name, :vendor, :version, :library, :platform, :os]
- HTTP_HEADER_PREFIX =
'X-RallyIntegration'
Instance Attribute Summary collapse
-
#library ⇒ Object
readonly
Returns the value of attribute library.
-
#name ⇒ Object
Returns the value of attribute name.
-
#os ⇒ Object
readonly
Returns the value of attribute os.
-
#platform ⇒ Object
readonly
Returns the value of attribute platform.
-
#vendor ⇒ Object
Returns the value of attribute vendor.
-
#version ⇒ Object
Returns the value of attribute version.
Instance Method Summary collapse
- #headers ⇒ Object
-
#initialize(custom_vals = {}) ⇒ CustomHttpHeader
constructor
A new instance of CustomHttpHeader.
Constructor Details
#initialize(custom_vals = {}) ⇒ CustomHttpHeader
Returns a new instance of CustomHttpHeader.
19 20 21 22 23 24 25 26 27 28 29 30 |
# 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 |
Instance Attribute Details
#library ⇒ Object (readonly)
Returns the value of attribute library.
14 15 16 |
# File 'lib/rally_api/custom_http_header.rb', line 14 def library @library end |
#name ⇒ Object
Returns the value of attribute name.
13 14 15 |
# File 'lib/rally_api/custom_http_header.rb', line 13 def name @name end |
#os ⇒ Object (readonly)
Returns the value of attribute os.
14 15 16 |
# File 'lib/rally_api/custom_http_header.rb', line 14 def os @os end |
#platform ⇒ Object (readonly)
Returns the value of attribute platform.
14 15 16 |
# File 'lib/rally_api/custom_http_header.rb', line 14 def platform @platform end |
#vendor ⇒ Object
Returns the value of attribute vendor.
13 14 15 |
# File 'lib/rally_api/custom_http_header.rb', line 13 def vendor @vendor end |
#version ⇒ Object
Returns the value of attribute version.
13 14 15 |
# File 'lib/rally_api/custom_http_header.rb', line 13 def version @version end |
Instance Method Details
#headers ⇒ Object
32 33 34 35 36 37 38 39 40 41 |
# 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 |