Skip to content

Commit e46f168

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

File tree

2 files changed

+8
-6
lines changed

2 files changed

+8
-6
lines changed

README.md

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

156-
schedule_search.push(result)
156+
puts "Re-queuing #{search_id}"
157+
schedule_search.push(search_id)
157158
end
158159

159160
schedule_search.close
@@ -173,7 +174,7 @@ require 'connection_pool'
173174

174175
# create a thread pool of 4 threads with a persistent connection to serpapi.com
175176
pool = ConnectionPool.new(size: n, timeout: 5) do
176-
SerpApi::Client.new(engine: 'google', api_key: ENV['SERPAPI_KEY'], timeout: 30, persistent: true)
177+
SerpApi::Client.new(engine: 'google', api_key: ENV['SERPAPI_KEY'], timeout: 30, persistent: true)
177178
end
178179

179180
# run user thread to search for your favorites coffee type
@@ -205,18 +206,19 @@ benchmark: (demo/demo_thread_pool.rb)
205206

206207
```ruby
207208
require 'serpapi'
208-
209209
require 'pp'
210210

211211
client = SerpApi::Client.new(api_key: ENV['SERPAPI_KEY'])
212212
params = {
213213
q: 'coffee'
214214
}
215215
results = client.search(params)
216+
216217
unless results[:organic_results]
217-
puts 'organic results found'
218+
puts 'no organic results found'
218219
exit 1
219220
end
221+
220222
pp results[:organic_results]
221223
puts 'done'
222224
exit 0
@@ -253,7 +255,7 @@ it prints the first 3 locations matching Austin (Texas, Texas, Rochester)
253255
]
254256
```
255257

256-
NOTE: api_key is not required for this endpoint.
258+
NOTE: `api_key` is not required for this endpoint.
257259

258260
### Search Archive API
259261

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)