Sha256: 9e458e7c8fe044775e1750acade674c0c4cd52ecd27d55389b2e3d1e2bc8fd27

Contents?: true

Size: 553 Bytes

Versions: 3

Compression:

Stored size: 553 Bytes

Contents

module Plagiarism
  module Strategies
    class Google < Engine
      URL = 'https://ajax.googleapis.com/ajax/services/search/web'
      VERSION = '1.0'

      class << self

        def fetch(content, params)
          Typhoeus.get URL, params: params.merge(v: VERSION, q: content, rsz: :large)
        end

        def exists?(response)
          JSON.parse(response)['responseData']['results'].all? do |r|
            uri = URI.parse(r['unescapedUrl'])
            uri.host =~ whitelists_regex
          end
        end

      end

    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
plagiarism2-0.0.3 lib/plagiarism/strategries/google.rb
plagiarism2-0.0.2 lib/plagiarism/strategries/google.rb
plagiarism2-0.0.1 lib/plagiarism/strategries/google.rb