Skip to content

Commit 8656720

Browse files
committed
Fix small error in sample code
1 parent 37c17ae commit 8656720

File tree

5 files changed

+8
-10
lines changed

5 files changed

+8
-10
lines changed

README.md

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -153,7 +153,7 @@ until schedule_search.empty?
153153
next
154154
end
155155

156-
schedule_search.push(result)
156+
schedule_search.push(search_id)
157157
end
158158

159159
schedule_search.close
@@ -205,7 +205,6 @@ benchmark: (demo/demo_thread_pool.rb)
205205

206206
```ruby
207207
require 'serpapi'
208-
209208
require 'pp'
210209

211210
client = SerpApi::Client.new(api_key: ENV['SERPAPI_KEY'])
@@ -214,7 +213,7 @@ params = {
214213
}
215214
results = client.search(params)
216215
unless results[:organic_results]
217-
puts 'organic results found'
216+
puts 'no organic results found'
218217
exit 1
219218
end
220219
pp results[:organic_results]

README.md.erb

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -173,7 +173,7 @@ until schedule_search.empty?
173173
next
174174
end
175175

176-
schedule_search.push(result)
176+
schedule_search.push(search_id)
177177
end
178178

179179
schedule_search.close
@@ -193,7 +193,7 @@ require 'connection_pool'
193193

194194
# create a thread pool of 4 threads with a persistent connection to serpapi.com
195195
pool = ConnectionPool.new(size: n, timeout: 5) do
196-
SerpApi::Client.new(engine: 'google', api_key: ENV['SERPAPI_KEY'], timeout: 30, persistent: true)
196+
SerpApi::Client.new(engine: 'google', api_key: ENV['SERPAPI_KEY'], timeout: 30, persistent: true)
197197
end
198198

199199
# run user thread to search for your favorites coffee type
@@ -225,7 +225,6 @@ benchmark: (demo/demo_thread_pool.rb)
225225

226226
```ruby
227227
require 'serpapi'
228-
229228
require 'pp'
230229

231230
client = SerpApi::Client.new(api_key: ENV['SERPAPI_KEY'])
@@ -234,7 +233,7 @@ params = {
234233
}
235234
results = client.search(params)
236235
unless results[:organic_results]
237-
puts 'organic results found'
236+
puts 'no organic results found'
238237
exit 1
239238
end
240239
pp results[:organic_results]

Rakefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ task readme: ['README.md.erb'] do
2626
end
2727

2828
YARD::Rake::YardocTask.new(:doc) do |t|
29-
t.files = ['lib/*/*.rb', 'README.md', 'LICENSE']
29+
t.files = ['lib/*/*.rb', 'LICENSE']
3030
t.options = ['--markup=markdown']
3131
t.stats_options = ['--list-undoc']
3232
end

demo/demo_async.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,7 @@
7575

7676
# add results back to the client queue
7777
# if the search is still in progress
78-
schedule_search.push(result)
78+
schedule_search.push(search_id)
7979
end
8080

8181
# destroy the queue

spec/serpapi/client/client_spec.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
describe 'set of client test to archieve full code coverage' do
44
let(:client) do
5-
client = SerpApi::Client.new(engine: 'google', api_key: ENV['SERPAPI_KEY'], timeout: 30)
5+
SerpApi::Client.new(engine: 'google', api_key: ENV['SERPAPI_KEY'], timeout: 30)
66
end
77

88
it 'search for coffee in Austin, TX, returns symbolized Hash' do

0 commit comments

Comments
 (0)