Sha256: 8417b3cd4ed56008674594d1aba345faf30a7127ba7d882de77ff36446835d7a
Contents?: true
Size: 699 Bytes
Versions: 2
Compression:
Stored size: 699 Bytes
Contents
module Plagiarism module Strategies class Google < Engine URL = 'https://www.googleapis.com/customsearch/v1' VERSION = '1.0' class << self def fetch(content, params) Typhoeus.get URL, params: params.merge( key: Config.google_key, cx: Config.google_cx, q: content, fields: 'items(link)', prettyPrint: false ) end def exists?(response) results = JSON.parse(response)['items'] || [] results.all? do |r| uri = URI.parse URI::encode(r['link']) uri.host =~ whitelists_regex end end end end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
plagiarism2-0.0.5 | lib/plagiarism/strategries/google.rb |
plagiarism2-0.0.4 | lib/plagiarism/strategries/google.rb |