Skip to content

Commit 26d51c3

Browse files
committed
Merge pull request #17 from bjmllr/sign-in-later
allow connections to be created without signing in
2 parents c51fd17 + e6c2df4 commit 26d51c3

2 files changed

Lines changed: 4 additions & 4 deletions

File tree

lib/zenoss.rb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,8 +32,8 @@ module Zenoss
3232

3333
# initialize a connection to a Zenoss server. This is the same as doing
3434
# Zenoss::Connection.new(server,user,pass)
35-
def Zenoss.connect(server, user, pass, &block)
36-
Connection.new(server,user,pass,&block)
35+
def Zenoss.connect(server, user, pass, opts = {}, &block)
36+
Connection.new(server, user, pass, opts, &block)
3737
end
3838

3939
# Some of the REST methods return Strings that are formated like a Python list.

lib/zenoss/connection.rb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,13 +31,13 @@ class Connection
3131
include Zenoss::JSONAPI::ReportRouter
3232
include Zenoss::RESTAPI
3333

34-
def initialize(url, user, pass, &block)
34+
def initialize(url, user, pass, opts = {}, &block)
3535
@zenoss_uri = (url.is_a?(URI) ? url : URI.parse(url))
3636
@request_number = 1
3737
@httpcli = HTTPClient.new
3838
@httpcli.receive_timeout = 360 # six minutes should be more that sufficient
3939
yield(@httpcli) if block_given?
40-
sign_in(user,pass)
40+
sign_in(user, pass) unless opts[:no_sign_in]
4141
end
4242

4343
private

0 commit comments

Comments
 (0)