Class: Infoblox::Connection
- Inherits:
-
Object
- Object
- Infoblox::Connection
- Defined in:
- lib/infoblox/connection.rb
Instance Attribute Summary collapse
-
#adapter ⇒ Object
Returns the value of attribute adapter.
-
#adapter_block ⇒ Object
Returns the value of attribute adapter_block.
-
#connection ⇒ Object
Returns the value of attribute connection.
-
#host ⇒ Object
Returns the value of attribute host.
-
#logger ⇒ Object
Returns the value of attribute logger.
-
#password ⇒ Object
Returns the value of attribute password.
-
#ssl_opts ⇒ Object
Returns the value of attribute ssl_opts.
-
#username ⇒ Object
Returns the value of attribute username.
Instance Method Summary collapse
- #delete(href) ⇒ Object
- #get(href, params = {}) ⇒ Object
-
#initialize(opts = {}) ⇒ Connection
constructor
A new instance of Connection.
-
#inspect ⇒ Object
Don’t display the username/password in logging, etc.
- #post(href, body) ⇒ Object
- #put(href, body) ⇒ Object
Constructor Details
#initialize(opts = {}) ⇒ Connection
Returns a new instance of Connection.
45 46 47 48 49 50 51 |
# File 'lib/infoblox/connection.rb', line 45 def initialize(opts={}) self.username = opts[:username] self.password = opts[:password] self.host = opts[:host] self.logger = opts[:logger] self.ssl_opts = opts[:ssl_opts] || {} end |
Instance Attribute Details
#adapter ⇒ Object
Returns the value of attribute adapter.
6 7 8 |
# File 'lib/infoblox/connection.rb', line 6 def adapter @adapter end |
#adapter_block ⇒ Object
Returns the value of attribute adapter_block.
6 7 8 |
# File 'lib/infoblox/connection.rb', line 6 def adapter_block @adapter_block end |
#connection ⇒ Object
Returns the value of attribute connection.
6 7 8 |
# File 'lib/infoblox/connection.rb', line 6 def connection @connection end |
#host ⇒ Object
Returns the value of attribute host.
6 7 8 |
# File 'lib/infoblox/connection.rb', line 6 def host @host end |
#logger ⇒ Object
Returns the value of attribute logger.
6 7 8 |
# File 'lib/infoblox/connection.rb', line 6 def logger @logger end |
#password ⇒ Object
Returns the value of attribute password.
6 7 8 |
# File 'lib/infoblox/connection.rb', line 6 def password @password end |
#ssl_opts ⇒ Object
Returns the value of attribute ssl_opts.
6 7 8 |
# File 'lib/infoblox/connection.rb', line 6 def ssl_opts @ssl_opts end |
#username ⇒ Object
Returns the value of attribute username.
6 7 8 |
# File 'lib/infoblox/connection.rb', line 6 def username @username end |
Instance Method Details
#delete(href) ⇒ Object
39 40 41 42 43 |
# File 'lib/infoblox/connection.rb', line 39 def delete(href) wrap do connection.delete(href) end end |
#get(href, params = {}) ⇒ Object
15 16 17 18 19 |
# File 'lib/infoblox/connection.rb', line 15 def get(href, params={}) wrap do connection.get(href, params) end end |
#inspect ⇒ Object
Don’t display the username/password in logging, etc.
80 81 82 |
# File 'lib/infoblox/connection.rb', line 80 def inspect "#<#{self.class}:#{object_id} @host=\"#{@host}\">" end |
#post(href, body) ⇒ Object
21 22 23 24 25 26 27 28 |
# File 'lib/infoblox/connection.rb', line 21 def post(href, body) wrap do connection.post do |req| req.url href req.body = body.to_json end end end |
#put(href, body) ⇒ Object
30 31 32 33 34 35 36 37 |
# File 'lib/infoblox/connection.rb', line 30 def put(href, body) wrap do connection.put do |req| req.url href req.body = body.to_json end end end |