Class: CMDB::Source::Network
- Inherits:
-
CMDB::Source
- Object
- CMDB::Source
- CMDB::Source::Network
- Defined in:
- lib/cmdb/source/network.rb
Overview
Abstract base class for sources that are backed by an HTTP k/v store. Contains reusable HTTP request logic.
Direct Known Subclasses
Instance Attribute Summary collapse
-
#http_url ⇒ URI
readonly
HTTP base location of this source (minus path).
Attributes inherited from CMDB::Source
Instance Method Summary collapse
-
#initialize(uri, port, prefix) ⇒ Network
constructor
Construct a new HTTP source.
Methods inherited from CMDB::Source
Constructor Details
#initialize(uri, port, prefix) ⇒ Network
Construct a new HTTP source. The logical URI is transformed into an HTTP base URL by preserving the hostname, overriding the port (unless the URI already has a specific port), replacing the scheme with http and eliminating the path.
16 17 18 19 |
# File 'lib/cmdb/source/network.rb', line 16 def initialize(uri, port, prefix) super(uri, prefix) @http_url = URI.parse("http://%s:%s" % [@uri.host, @uri.port || port]) end |
Instance Attribute Details
#http_url ⇒ URI (readonly)
Returns HTTP base location of this source (minus path).
6 7 8 |
# File 'lib/cmdb/source/network.rb', line 6 def http_url @http_url end |