lib/answersengine/client/scraper_job.rb in answersengine-0.4.1 vs lib/answersengine/client/scraper_job.rb in answersengine-0.5.0

- old
+ new

@@ -1,19 +1,20 @@ module AnswersEngine module Client class ScraperJob < AnswersEngine::Client::Base def all(scraper_name, opts={}) - self.class.get("/scrapers/#{scraper_name}/jobs", @options) + params = @options.merge(opts) + self.class.get("/scrapers/#{scraper_name}/jobs", params) end def create(scraper_name, opts={}) body = {} body[:standard_worker_count] = opts[:workers] if opts[:workers] body[:browser_worker_count] = opts[:browsers] if opts[:browsers] body[:proxy_type] = opts[:proxy_type] if opts[:proxy_type] - @options.merge!({body: body.to_json}) - self.class.post("/scrapers/#{scraper_name}/jobs", @options) + params = @options.merge({body: body.to_json}) + self.class.post("/scrapers/#{scraper_name}/jobs", params) end def find(scraper_name) self.class.get("/scrapers/#{scraper_name}/current_job", @options) end @@ -22,13 +23,13 @@ body = {} body[:status] = opts[:status] if opts[:status] body[:standard_worker_count] = opts[:workers] if opts[:workers] body[:browser_worker_count] = opts[:browsers] if opts[:browsers] body[:proxy_type] = opts[:proxy_type] if opts[:proxy_type] - @options.merge!({body: body.to_json}) + params = @options.merge({body: body.to_json}) - self.class.put("/scrapers/#{scraper_name}/current_job", @options) + self.class.put("/scrapers/#{scraper_name}/current_job", params) end def cancel(scraper_name, opts={}) opts[:status] = 'cancelled' update(scraper_name, opts) @@ -44,6 +45,5 @@ update(scraper_name, opts) end end end end -