Skip to content

Commit 210335c

Browse files
committed
Polish documentation to be more pratical
1 parent 3304e4c commit 210335c

File tree

3 files changed

+49
-11
lines changed

3 files changed

+49
-11
lines changed

README.md

Lines changed: 24 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -272,16 +272,16 @@ First, you need to run a search and save the search id.
272272

273273
```ruby
274274
require 'serpapi'
275-
client = SerpApi::Client.new(engine: 'google', api_key: 'secret_api_key')
275+
client = SerpApi::Client.new(engine: 'google', api_key: ENV['SERPAPI_KEY'])
276276
results = client.search(q: "Coffee", location: "Portland")
277277
search_id = results[:search_metadata][:id]
278278
```
279279

280-
Now we can retrieve the previous search results from the archive (free)
280+
Now we can retrieve the previous search results from the archive using the search id (free of charge).
281281

282282
```ruby
283283
require 'serpapi'
284-
client = SerpApi::Client.new(api_key: 'secret_api_key')
284+
client = SerpApi::Client.new(api_key: ENV['SERPAPI_KEY'])
285285
results = client.search_archive(search_id)
286286
pp results
287287
```
@@ -291,11 +291,30 @@ This code prints the search results from the archive. :)
291291
### Account API
292292
```ruby
293293
require 'serpapi'
294-
client = SerpApi::Client.new(api_key: 'secret_api_key')
294+
client = SerpApi::Client.new(api_key: ENV['SERPAPI_KEY'])
295295
pp client.account
296296
```
297297

298-
It prints your account information.
298+
It prints your account information as:
299+
``json
300+
{
301+
account_id: "1234567890",
302+
api_key: "your_secret_key",
303+
account_email: "email@company.com",
304+
account_status: "Active",
305+
plan_id: "free",
306+
plan_name: "Free Plan",
307+
plan_monthly_price: 0.0,
308+
searches_per_month: 100,
309+
plan_searches_left: 0,
310+
extra_credits: 100,
311+
total_searches_left: 10,
312+
this_month_usage: 100,
313+
this_hour_searches: 0,
314+
last_hour_searches: 0,
315+
account_rate_limit_per_hour: 100
316+
}
317+
```
299318
300319
## Basic example per search engine
301320

README.md.erb

Lines changed: 24 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -227,16 +227,16 @@ First, you need to run a search and save the search id.
227227

228228
```ruby
229229
require 'serpapi'
230-
client = SerpApi::Client.new(engine: 'google', api_key: 'secret_api_key')
230+
client = SerpApi::Client.new(engine: 'google', api_key: ENV['SERPAPI_KEY'])
231231
results = client.search(q: "Coffee", location: "Portland")
232232
search_id = results[:search_metadata][:id]
233233
```
234234

235-
Now we can retrieve the previous search results from the archive (free)
235+
Now we can retrieve the previous search results from the archive using the search id (free of charge).
236236

237237
```ruby
238238
require 'serpapi'
239-
client = SerpApi::Client.new(api_key: 'secret_api_key')
239+
client = SerpApi::Client.new(api_key: ENV['SERPAPI_KEY'])
240240
results = client.search_archive(search_id)
241241
pp results
242242
```
@@ -246,11 +246,30 @@ This code prints the search results from the archive. :)
246246
### Account API
247247
```ruby
248248
require 'serpapi'
249-
client = SerpApi::Client.new(api_key: 'secret_api_key')
249+
client = SerpApi::Client.new(api_key: ENV['SERPAPI_KEY'])
250250
pp client.account
251251
```
252252

253-
It prints your account information.
253+
It prints your account information as:
254+
``json
255+
{
256+
account_id: "1234567890",
257+
api_key: "your_secret_key",
258+
account_email: "email@company.com",
259+
account_status: "Active",
260+
plan_id: "free",
261+
plan_name: "Free Plan",
262+
plan_monthly_price: 0.0,
263+
searches_per_month: 100,
264+
plan_searches_left: 0,
265+
extra_credits: 100,
266+
total_searches_left: 10,
267+
this_month_usage: 100,
268+
this_hour_searches: 0,
269+
last_hour_searches: 0,
270+
account_rate_limit_per_hour: 100
271+
}
272+
```
254273

255274
## Basic example per search engine
256275

demo/demo_async.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# The code snippet aims to improve the efficiency of searching using the SerpApi client in async mode.
1+
# The code snippet aims to improve the efficiency of searching using the SerpApi client using `async` mode.
22
# The request are non-blocking which allows batching a large amount of query, and wait before fetching the result back.
33
#
44
# **Process:**

0 commit comments

Comments
 (0)