Class: LinkChecker::Net::HTTP::Task

Inherits:
Task
  • Object
show all
Defined in:
lib/ruby-link-checker/net/http/checker.rb

Instance Attribute Summary

Attributes inherited from Task

#checker, #logger, #method, #options, #original_uri, #uri

Instance Method Summary collapse

Methods inherited from Task

#initialize

Methods included from Callbacks

#callbacks, #delegates, #method_missing, #on

Constructor Details

This class inherits a constructor from LinkChecker::Task

Dynamic Method Handling

This class handles dynamic methods through the method_missing method in the class LinkChecker::Callbacks

Instance Method Details

#run!Object



5
6
7
8
9
10
11
12
13
14
# File 'lib/ruby-link-checker/net/http/checker.rb', line 5

def run!
  ::Net::HTTP.start(uri.host, uri.port, use_ssl: true) do |http|
    http.read_timeout = checker.read_timeout if checker.read_timeout
    http.open_timeout = checker.open_timeout if checker.open_timeout
    request = ::Net::HTTPGenericRequest.new(method, false, true, uri)
    request['User-Agent'] = checker.user_agent
    response = http.request(request)
    result! Result.new(uri, method, original_uri, request, response, options)
  end
end