Skip to content

Commit 196bcfd

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

File tree

2 files changed

+7
-6
lines changed

2 files changed

+7
-6
lines changed

README.md

Lines changed: 6 additions & 5 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
@@ -173,7 +173,7 @@ require 'connection_pool'
173173

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

179179
# run user thread to search for your favorites coffee type
@@ -205,18 +205,19 @@ 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'])
212211
params = {
213212
q: 'coffee'
214213
}
215214
results = client.search(params)
215+
216216
unless results[:organic_results]
217-
puts 'organic results found'
217+
puts 'no organic results found'
218218
exit 1
219219
end
220+
220221
pp results[:organic_results]
221222
puts 'done'
222223
exit 0
@@ -253,7 +254,7 @@ it prints the first 3 locations matching Austin (Texas, Texas, Rochester)
253254
]
254255
```
255256

256-
NOTE: api_key is not required for this endpoint.
257+
NOTE: `api_key` is not required for this endpoint.
257258

258259
### Search Archive API
259260

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)