Sha256: f53e049719672868620d5a720ad2f091483b3c574019014f72b95a3df485cf7a
Contents?: true
Size: 704 Bytes
Versions: 5
Compression:
Stored size: 704 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 iterate(response, action = :all?) results = JSON.parse(response)['items'] || [] results.send(action) do |r| uri = URI.parse URI::encode(r['link']) yield uri end end end end end end
Version data entries
5 entries across 5 versions & 1 rubygems