Class: CustomHttpHeader
- Inherits:
-
Object
- Object
- CustomHttpHeader
- Defined in:
- lib/rally_rest_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
- #add_headers(req) ⇒ Object
-
#initialize ⇒ CustomHttpHeader
constructor
A new instance of CustomHttpHeader.
Constructor Details
#initialize ⇒ CustomHttpHeader
Returns a new instance of CustomHttpHeader.
8 9 10 11 12 13 |
# File 'lib/rally_rest_api/custom_http_header.rb', line 8 def initialize @os = RUBY_PLATFORM @platform = "Ruby #{RUBY_VERSION}" @library = "RallyRestAPI version #{RallyRestVersion::LIBRARY_VERSION::STRING}" @name = "RubyRestAPI" end |
Instance Attribute Details
#library ⇒ Object (readonly)
Returns the value of attribute library.
3 4 5 |
# File 'lib/rally_rest_api/custom_http_header.rb', line 3 def library @library end |
#name ⇒ Object
Returns the value of attribute name.
2 3 4 |
# File 'lib/rally_rest_api/custom_http_header.rb', line 2 def name @name end |
#os ⇒ Object (readonly)
Returns the value of attribute os.
3 4 5 |
# File 'lib/rally_rest_api/custom_http_header.rb', line 3 def os @os end |
#platform ⇒ Object (readonly)
Returns the value of attribute platform.
3 4 5 |
# File 'lib/rally_rest_api/custom_http_header.rb', line 3 def platform @platform end |
#vendor ⇒ Object
Returns the value of attribute vendor.
2 3 4 |
# File 'lib/rally_rest_api/custom_http_header.rb', line 2 def vendor @vendor end |
#version ⇒ Object
Returns the value of attribute version.
2 3 4 |
# File 'lib/rally_rest_api/custom_http_header.rb', line 2 def version @version end |
Instance Method Details
#add_headers(req) ⇒ Object
15 16 17 18 19 20 21 22 |
# File 'lib/rally_rest_api/custom_http_header.rb', line 15 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 |