Sha256: f248ad8fc0940c43294c4cc718b174ef4dbc0365ab2e69dcacffadfa25729ff2

Contents?: true

Size: 912 Bytes

Versions: 5

Compression:

Stored size: 912 Bytes

Contents

module AnswersEngine
  module Client
    class ScraperJobVar < AnswersEngine::Client::Base

      def find(scraper_name, var_name)
        self.class.get("/scrapers/#{scraper_name}/current_job/vars/#{var_name}", @options)
      end

      def all(scraper_name, opts={})
        params = @options.merge opts
        self.class.get("/scrapers/#{scraper_name}/current_job/vars", params)
      end

      def set(scraper_name, var_name, value, opts={})
        body = {}
        body[:value] = value
        body[:secret] = opts[:secret] if opts[:secret]
        params = @options.merge({body: body.to_json})
        self.class.put("/scrapers/#{scraper_name}/current_job/vars/#{var_name}", params)
      end

      def unset(scraper_name, var_name, opts={})
        params = @options.merge(opts)
        self.class.delete("/scrapers/#{scraper_name}/current_job/vars/#{var_name}", params)
      end
    end
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
answersengine-0.10.1 lib/answersengine/client/scraper_job_var.rb
answersengine-0.10.0 lib/answersengine/client/scraper_job_var.rb
answersengine-0.9.1 lib/answersengine/client/scraper_job_var.rb
answersengine-0.9.0 lib/answersengine/client/scraper_job_var.rb
answersengine-0.8.0 lib/answersengine/client/scraper_job_var.rb