Class: Puppet::CloudPack::HttpHeaders
- Inherits:
-
Object
- Object
- Puppet::CloudPack::HttpHeaders
- Includes:
- Net::HTTPHeader
- Defined in:
- lib/puppet/cloudpack.rb
Overview
This is a utility class to provide access to the methods defined in the Net::HTTPHeader
module (e.g. set_content_type
, basic_auth
, etc.). Additionally it overrides the to_hash
method to return a hash of simple (String
) values rather than a hash of Arrays so that the returned value is usable as input to Net::HTTP.get
, Net::HTTP.post
etc. family of methods (and consequently the Puppet::Network::HTTP::Connection.request
method).
Instance Method Summary collapse
-
#initialize(headers = nil) ⇒ HttpHeaders
constructor
A new instance of HttpHeaders.
- #to_hash ⇒ Object
Constructor Details
#initialize(headers = nil) ⇒ HttpHeaders
Returns a new instance of HttpHeaders.
26 27 28 |
# File 'lib/puppet/cloudpack.rb', line 26 def initialize(headers = nil) initialize_http_header(headers) end |
Instance Method Details
#to_hash ⇒ Object
30 31 32 33 34 35 36 |
# File 'lib/puppet/cloudpack.rb', line 30 def to_hash hash = {} each do |k, v| hash[k] = v end hash end |