vessel icon indicating copy to clipboard operation
vessel copied to clipboard

README example is outdated

Open gabrielgomes94 opened this issue 2 years ago • 5 comments

The following code from README documentation does not work anymore:

class QuotesToScrapeCom < Vessel::Cargo
   # ...

    if next_page = at_xpath("//li[@class='next']/a[@href]")
      url = absolute_url(next_page.attribute(:href))
      yield request(url: url, handler: :parse)
    end
  end
end

I copied and pasted the example but I was getting this error:

Traceback (most recent call last):
	28: from /usr/local/bundle/bin/irb:23:in `<main>'
	27: from /usr/local/bundle/bin/irb:23:in `load'
	26: from /usr/local/bundle/gems/irb-1.4.2/exe/irb:11:in `<top (required)>'
	 9: from (irb):165:in `<main>'
	 8: from /usr/local/bundle/gems/vessel-0.2.0/lib/vessel/cargo.rb:19:in `run'
	 7: from /usr/local/bundle/gems/vessel-0.2.0/lib/vessel/engine.rb:6:in `run'
	 6: from /usr/local/bundle/gems/vessel-0.2.0/lib/vessel/engine.rb:6:in `tap'
	 5: from /usr/local/bundle/gems/vessel-0.2.0/lib/vessel/engine.rb:29:in `run'
	 4: from /usr/local/bundle/gems/vessel-0.2.0/lib/vessel/engine.rb:40:in `handle'
	 3: from (irb):108:in `parse'
	 2: from /usr/local/bundle/gems/vessel-0.2.0/lib/vessel/cargo.rb:94:in `request'
	 1: from /usr/local/bundle/gems/vessel-0.2.0/lib/vessel/cargo.rb:94:in `new'
/usr/local/bundle/gems/vessel-0.2.0/lib/vessel/request.rb:13:in `initialize': unknown keyword: :handler (ArgumentError)

After debugging for a while, I noticed that request method cannot be called while passing handler: parameter.

gabrielgomes94 avatar Nov 09 '22 20:11 gabrielgomes94