Skip to content

Commit 8c1dd07

Browse files
authored
Merge pull request #10 from serpapi/fix-documentation-code
Fix small errors and typos in documentation
2 parents 37c17ae + 12cd762 commit 8c1dd07

File tree

5 files changed

+19
-21
lines changed

5 files changed

+19
-21
lines changed

README.md

Lines changed: 8 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -97,7 +97,7 @@ params = {
9797
results = client.search(params)
9898

9999
# search results as a raw HTML string
100-
raw_html = client.html(params) # Corrected parameter reference
100+
raw_html = client.html(params)
101101
```
102102
[SerpApi documentation](https://serpapi.com/search-api).
103103

@@ -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,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]
@@ -1017,9 +1016,9 @@ see: [https://serpapi.com/yelp-search-api](https://serpapi.com/yelp-search-api)
10171016

10181017
The older library (google-search-results-ruby) was performing at 55 req/s on Ruby 2.7.8, which is 2x slower than the current version (serpapi-ruby) on Ruby 3.4.4.
10191018

1020-
## Migration quick guide
1019+
### Migration quick guide
10211020

1022-
if you were already using (google-search-results-ruby gem)[https://github.com/serpapi/google-search-results-ruby], here are the changes.
1021+
If you were already using (google-search-results-ruby gem)[https://github.com/serpapi/google-search-results-ruby], here are the changes.
10231022

10241023
```
10251024
# load library
@@ -1044,7 +1043,7 @@ client = SerpApi::Client.new(default_parameter)
10441043
search.params[:location] = "Portland,Oregon,United States"
10451044
# new way
10461045
# just provided the search call with the parameters.
1047-
results = client.search({location: "Portland,Oregon,United States", q: "Coffe"})
1046+
results = client.search({location: "Portland,Oregon,United States", q: "Coffee"})
10481047
10491048
# search format return as raw html
10501049
# old way
@@ -1212,4 +1211,4 @@ $ rake oobt
12121211

12131212
Open ./Rakefile for more information.
12141213

1215-
Contributions are welcome. Feel to submit a pull request!
1214+
Contributions are welcome. Feel free to submit a pull request!

README.md.erb

Lines changed: 8 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -117,7 +117,7 @@ params = {
117117
results = client.search(params)
118118

119119
# search results as a raw HTML string
120-
raw_html = client.html(params) # Corrected parameter reference
120+
raw_html = client.html(params)
121121
```
122122
→ [SerpApi documentation](https://serpapi.com/search-api).
123123

@@ -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]
@@ -498,9 +497,9 @@ see: [https://serpapi.com/yelp-search-api](https://serpapi.com/yelp-search-api)
498497

499498
The older library (google-search-results-ruby) was performing at 55 req/s on Ruby 2.7.8, which is 2x slower than the current version (serpapi-ruby) on Ruby 3.4.4.
500499

501-
## Migration quick guide
500+
### Migration quick guide
502501

503-
if you were already using (google-search-results-ruby gem)[https://github.com/serpapi/google-search-results-ruby], here are the changes.
502+
If you were already using (google-search-results-ruby gem)[https://github.com/serpapi/google-search-results-ruby], here are the changes.
504503

505504
```
506505
# load library
@@ -525,7 +524,7 @@ client = SerpApi::Client.new(default_parameter)
525524
search.params[:location] = "Portland,Oregon,United States"
526525
# new way
527526
# just provided the search call with the parameters.
528-
results = client.search({location: "Portland,Oregon,United States", q: "Coffe"})
527+
results = client.search({location: "Portland,Oregon,United States", q: "Coffee"})
529528

530529
# search format return as raw html
531530
# old way
@@ -693,4 +692,4 @@ $ rake oobt
693692

694693
Open ./Rakefile for more information.
695694

696-
Contributions are welcome. Feel to submit a pull request!
695+
Contributions are welcome. Feel free to submit a pull request!

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)