lib/plagiarism/strategries/bing.rb in plagiarism2-0.0.6 vs lib/plagiarism/strategries/bing.rb in plagiarism2-0.0.7
- old
+ new
@@ -7,12 +7,12 @@
def fetch(content, params)
Typhoeus.get(URL, params: params.merge('$format' => :json, 'Query' => "'#{content}'"), userpwd: ":#{Config.bing_key}")
end
- def iterate(response)
+ def iterate(response, action = :all?)
results = JSON.parse(response)['d']['results'] rescue []
- results.all? do |r|
+ results.send(action) do |r|
uri = URI.parse URI::encode(r['Url'])
yield uri
end
end