Class: Zenoss::Connection
- Inherits:
-
Object
- Object
- Zenoss::Connection
- Includes:
- Zenoss, JSONAPI, JSONAPI::DeviceRouter, JSONAPI::EventsRouter, JSONAPI::ReportRouter, RESTAPI
- Defined in:
- lib/zenoss/connection.rb
Overview
This class represents a connection into a Zenoss server.
Constant Summary
Constants included from JSONAPI
Instance Method Summary collapse
-
#initialize(url, user, pass, opts = {}) {|@httpcli| ... } ⇒ Connection
constructor
A new instance of Connection.
Methods included from RESTAPI
Methods included from JSONAPI::ReportRouter
#get_report_tree, #get_report_types
Methods included from JSONAPI::EventsRouter
#close_events, #ev_query, #query_events, #write_log
Methods included from JSONAPI::DeviceRouter
#find_devices_by_ip, #find_devices_by_name, #get_devices, #get_info, #get_templates, #remodel, #set_info
Methods included from JSONAPI
Methods included from Zenoss
connect, #parse_array, #pdatetime_to_datetime, #pdict_to_hash, #plist_to_array, #ptuples_to_hash, #sanitize_str
Constructor Details
#initialize(url, user, pass, opts = {}) {|@httpcli| ... } ⇒ Connection
Returns a new instance of Connection.
34 35 36 37 38 39 40 41 42 |
# File 'lib/zenoss/connection.rb', line 34 def initialize(url, user, pass, opts = {}, &block) @zenoss_version = opts[:version] @zenoss_uri = (url.is_a?(URI) ? url : URI.parse(url)) @request_number = 1 @httpcli = HTTPClient.new @httpcli.receive_timeout = 360 # six minutes should be more that sufficient yield(@httpcli) if block_given? sign_in(user, pass) unless opts[:no_sign_in] end |