|
1 | | -# SerpApi Ruby Library |
| 1 | +<div align="center"> |
| 2 | +<h1 align="center">SerpApi Ruby Library</h1> |
2 | 3 |
|
3 | | -[](https://github.com/serpapi/serpapi-ruby/actions/workflows/ci.yml) |
4 | | -[](https://badge.fury.io/rb/serpapi) |
5 | | -[](https://github.com/serpapi/serpapi-ruby/actions/workflows/sanity_alt.yml) |
6 | | -[](https://github.com/serpapi/serpapi-ruby/actions/workflows/sanity_1.yml) |
7 | | -[](https://github.com/serpapi/serpapi-ruby/actions/workflows/sanity_2.yml) |
| 4 | + |
| 5 | + |
| 6 | +[](https://badge.fury.io/rb/serpapi) [](https://github.com/serpapi/serpapi-ruby/actions/workflows/ci.yml) [](https://github.com/serpapi/serpapi-ruby/actions/workflows/sanity_alt.yml) [](https://github.com/serpapi/serpapi-ruby/actions/workflows/sanity_1.yml) [](https://github.com/serpapi/serpapi-ruby/actions/workflows/sanity_2.yml) |
| 7 | +</div> |
8 | 8 |
|
9 | 9 | Integrate search data into your Ruby application. This library is the official wrapper for SerpApi (https://serpapi.com). |
10 | 10 |
|
@@ -157,36 +157,6 @@ pp client.account |
157 | 157 |
|
158 | 158 | It prints your account information. |
159 | 159 |
|
160 | | -### Bulk Search API |
161 | | - |
162 | | -If you have high volume of searches (e.g., >= 1 million) and they don't need to be live, you can use our Bulk Search API. You just have to use the `async` parameter: |
163 | | - |
164 | | -```ruby |
165 | | -client = SerpApi::Client.new api_key: 'secret_api_key', async: true |
166 | | - |
167 | | -searches = [ |
168 | | - { engine: "google", q: "coffee" }, |
169 | | - { engine: "google", q: "tea" }, |
170 | | - { engine: "google", q: "hot chocolate milk" }, |
171 | | - # ... |
172 | | -] |
173 | | - |
174 | | -# Submit async searches |
175 | | -async_searches = searches.map do |search| |
176 | | - async_search = client.search search |
177 | | - async_search |
178 | | -end |
179 | | - |
180 | | -# Get an ETA using the last search scheduled time |
181 | | -bulk_search_eta = async_search_results.last[:search_metadata][:scheduled_at] |
182 | | - |
183 | | -# After the searches are done processing (i.e., `bulk_search_eta`) |
184 | | -async_search_results = async_searches.map do |search| |
185 | | - results = client.search_archive search[:id] |
186 | | - results |
187 | | -end |
188 | | -``` |
189 | | - |
190 | 160 | ## Basic example per search engine |
191 | 161 |
|
192 | 162 | ### Search bing |
@@ -437,9 +407,10 @@ require 'serpapi' |
437 | 407 | client = SerpApi::Client.new(api_key: ENV['API_KEY'], engine: 'google_local_services') |
438 | 408 | results = client.search({ |
439 | 409 | 'q': 'Electrician', |
440 | | - 'place_id': 'ChIJOwg_06VPwokRYv534QaPC8g' |
| 410 | + 'data_cid': 'ChIJOwg_06VPwokRYv534QaPC8g' |
441 | 411 | }) |
442 | | -pp results |
| 412 | +pp results[:local_ads] |
| 413 | +# ENV['API_KEY'] captures the secret user API available from http://serpapi.com |
443 | 414 |
|
444 | 415 | ``` |
445 | 416 |
|
|
0 commit comments