Sha256: 41bf2dd86bf09c54d314146ba8d8ce46933cde3be78191f780e808b80b6dba2a

Contents?: true

Size: 1.03 KB

Versions: 1

Compression:

Stored size: 1.03 KB

Contents

# frozen_string_literal: true

module UrlScan
  module Clients
    class Community < Base
      # @return [Hash]
      def submit(url, customagent: nil, referer: nil, visibility: nil, tags: nil, override_safety: nil, country: nil)
        params = {
          url: url,
          customagent: customagent,
          referer: referer,
          visibility: visibility,
          tags: tags,
          overrideSafety: override_safety,
          country: country
        }.compact
        post("/scan/", params) { |json| json }
      end

      # @return [Hash]
      def result(uuid)
        get("/result/#{uuid}") { |json| json }
      end

      # @return [String]
      def dom(uuid)
        get("/dom/#{uuid}/") { |dom| dom }
      end

      def screenshot(uuid)
        get("/screenshots/#{uuid}.png") { |png| png }
      end

      # @return [Hash]
      def search(q, size: 100, search_after: nil)
        params = { q: q, size: size, search_after: search_after }.compact
        get("/search/", params) { |json| json }
      end
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
urlscan-0.8.0 lib/urlscan/clients/community.rb