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.



35
36
37
38
39
40
41
# File 'lib/infoblox/connection.rb', line 35

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

#connectionObject

Returns the value of attribute connection.



3
4
5
# File 'lib/infoblox/connection.rb', line 3

def connection
  @connection
end

#hostObject

Returns the value of attribute host.



3
4
5
# File 'lib/infoblox/connection.rb', line 3

def host
  @host
end

#loggerObject

Returns the value of attribute logger.



3
4
5
# File 'lib/infoblox/connection.rb', line 3

def logger
  @logger
end

#passwordObject

Returns the value of attribute password.



3
4
5
# File 'lib/infoblox/connection.rb', line 3

def password
  @password
end

#ssl_optsObject

Returns the value of attribute ssl_opts.



3
4
5
# File 'lib/infoblox/connection.rb', line 3

def ssl_opts
  @ssl_opts
end

#usernameObject

Returns the value of attribute username.



3
4
5
# File 'lib/infoblox/connection.rb', line 3

def username
  @username
end

Instance Method Details

#delete(href) ⇒ Object



29
30
31
32
33
# File 'lib/infoblox/connection.rb', line 29

def delete(href)
  wrap do
    connection.delete(href)
  end
end

#get(href, params = {}) ⇒ Object



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

def get(href, params={})
  wrap do
    connection.get(href, params)
  end
end

#post(href, body) ⇒ Object



11
12
13
14
15
16
17
18
# File 'lib/infoblox/connection.rb', line 11

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



20
21
22
23
24
25
26
27
# File 'lib/infoblox/connection.rb', line 20

def put(href, body)
  wrap do
    connection.put do |req|
      req.url href
      req.body = body.to_json
    end
  end
end