Class: Linkey::Getter

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

Instance Method Summary collapse

Constructor Details

#initialize(paths, base, headers = {}, status = 200) ⇒ Getter

Returns a new instance of Getter.



71
72
73
74
75
76
# File 'lib/linkey.rb', line 71

def initialize(paths, base, headers = {}, status = 200)
  @paths   = paths
  @base    = base
  @headers = headers
  @status  = status
end

Instance Method Details

#checkObject



78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
# File 'lib/linkey.rb', line 78

def check
  puts "Checking..."

  paths.each do |path|
    begin
      Typhoeus::Request.new(url(path), options).tap do |req|
        req.on_complete { |r| parse_response(r, status) }
        HYDRA.queue req
      end
    rescue
      puts "Error with URL #{path}, please check config"
    end
  end

  HYDRA.run
  check_for_broken
end