Class: Infoblox::Connection

Inherits:
Object
  • Object
show all
Defined in:
lib/infoblox/connection.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

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

#adapterObject

Returns the value of attribute adapter.



6
7
8
# File 'lib/infoblox/connection.rb', line 6

def adapter
  @adapter
end

#adapter_blockObject

Returns the value of attribute adapter_block.



6
7
8
# File 'lib/infoblox/connection.rb', line 6

def adapter_block
  @adapter_block
end

#connectionObject

Returns the value of attribute connection.



6
7
8
# File 'lib/infoblox/connection.rb', line 6

def connection
  @connection
end

#hostObject

Returns the value of attribute host.



6
7
8
# File 'lib/infoblox/connection.rb', line 6

def host
  @host
end

#loggerObject

Returns the value of attribute logger.



6
7
8
# File 'lib/infoblox/connection.rb', line 6

def logger
  @logger
end

#passwordObject

Returns the value of attribute password.



6
7
8
# File 'lib/infoblox/connection.rb', line 6

def password
  @password
end

#ssl_optsObject

Returns the value of attribute ssl_opts.



6
7
8
# File 'lib/infoblox/connection.rb', line 6

def ssl_opts
  @ssl_opts
end

#usernameObject

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

#inspectObject

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