Class: Auger::Http

Inherits:
Connection show all
Defined in:
lib/plugins/http.rb

Instance Attribute Summary

Attributes inherited from Connection

#connection, #options, #requests, #response, #roles

Instance Method Summary collapse

Methods inherited from Connection

#do_open, #initialize, load, #method_missing, #timeout

Constructor Details

This class inherits a constructor from Auger::Connection

Dynamic Method Handling

This class handles dynamic methods through the method_missing method in the class Auger::Connection

Instance Method Details

#close(http) ⇒ Object



34
35
36
# File 'lib/plugins/http.rb', line 34

def close(http)
  http.finish
end

#get(url, &block) ⇒ Object



19
20
21
22
# File 'lib/plugins/http.rb', line 19

def get(url, &block)
  @url = url
  @requests << Auger::HttpRequest.load(url, &block)
end

#open(host, options) ⇒ Object



24
25
26
27
28
29
30
31
32
# File 'lib/plugins/http.rb', line 24

def open(host, options)
  http = Net::HTTP.new(host, options[:port])
  http.use_ssl = options[:ssl]
  http.verify_mode = OpenSSL::SSL::VERIFY_NONE if options[:insecure]
  http.open_timeout = options[:timeout]
  http.read_timeout = options[:timeout]
  http.start
  http
end