Skip to content

Commit 96b8aaf

Browse files
authored
Merge pull request #19 from strzibny/ruby-version
Fix Ruby version confusion
2 parents adae9d2 + 3b9ac4f commit 96b8aaf

File tree

3 files changed

+34
-44
lines changed

3 files changed

+34
-44
lines changed

README.md

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ Query a vast range of data at scale, including web search results, flight schedu
1616

1717
## Installation
1818

19-
Ruby 2.7 and later are supported. To achieve an optimal performance, the latest version is recommended. Check 2.7.8 vs 3.4.4 [performance comparison](#Performance-Comparison).
19+
Ruby 2.7 and higher are supported. To achieve an optimal performance, the latest version is recommended. Check 2.7.8 vs 3.4.4 [performance comparison](#Performance-Comparison).
2020

2121
Other versions, such as Ruby 1.9, Ruby 2.x, and JRuby, are compatible with [legacy SerpApi library](https://github.com/serpapi/google-search-results-ruby), which is still supported. To upgrade to the latest library, check our [migration guide](#Migration-quick-guide).
2222

@@ -1093,11 +1093,9 @@ Most notable improvements:
10931093
- Reduce logic complexity in our implementation. (faster performance)
10941094
- Better documentation.
10951095

1096-
## Supported Ruby version.
1097-
Ruby versions validated by Github Actions:
1098-
- 3.1
1099-
- 3.4
1100-
* doc: [Github Actions.](https://github.com/serpapi/serpapi-ruby/actions/workflows/ci.yml)
1096+
## Supported Ruby versions
1097+
1098+
Ruby 2.7 and higher is supported.
11011099

11021100
## Developer Guide
11031101
### Key goals

README.md.erb

Lines changed: 25 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
<%-
2-
def snippet(format, path, demo = false)
2+
def snippet(format, path, demo = false)
33
lines = File.new(path).readlines
44
if demo
55
# skip comment
@@ -20,13 +20,13 @@ end
2020
-%>
2121
# SerpApi Ruby Library
2222

23-
[![serpapi-ruby](https://github.com/serpapi/serpapi-ruby/actions/workflows/ci.yml/badge.svg)](https://github.com/serpapi/serpapi-ruby/actions/workflows/ci.yml) [![Gem Version](https://badge.fury.io/rb/serpapi.svg)](https://badge.fury.io/rb/serpapi)
23+
[![serpapi-ruby](https://github.com/serpapi/serpapi-ruby/actions/workflows/ci.yml/badge.svg)](https://github.com/serpapi/serpapi-ruby/actions/workflows/ci.yml) [![Gem Version](https://badge.fury.io/rb/serpapi.svg)](https://badge.fury.io/rb/serpapi)
2424

25-
Integrate search data into your AI workflow, RAG / fine-tuning, or Ruby application using this official wrapper for [SerpApi](https://serpapi.com).
25+
Integrate search data into your AI workflow, RAG / fine-tuning, or Ruby application using this official wrapper for [SerpApi](https://serpapi.com).
2626

27-
SerpApi supports Google, Google Maps, Google Shopping, Baidu, Yandex, Yahoo, eBay, App Stores, and [more](https://serpapi.com).
27+
SerpApi supports Google, Google Maps, Google Shopping, Baidu, Yandex, Yahoo, eBay, App Stores, and [more](https://serpapi.com).
2828

29-
Query a vast range of data at scale, including web search results, flight schedules, stock market data, news headlines, and [more](https://serpapi.com).
29+
Query a vast range of data at scale, including web search results, flight schedules, stock market data, news headlines, and [more](https://serpapi.com).
3030

3131
## Features
3232
* `persistent` → Keep socket connection open to save on SSL handshake / reconnection (2x faster). [Search at scale](#Search-At-Scale)
@@ -36,7 +36,7 @@ Query a vast range of data at scale, including web search results, flight schedu
3636

3737
## Installation
3838

39-
Ruby 2.7 and later are supported. To achieve an optimal performance, the latest version is recommended. Check 2.7.8 vs 3.4.4 [performance comparison](#Performance-Comparison).
39+
Ruby 2.7 and higher are supported. To achieve an optimal performance, the latest version is recommended. Check 2.7.8 vs 3.4.4 [performance comparison](#Performance-Comparison).
4040

4141
Other versions, such as Ruby 1.9, Ruby 2.x, and JRuby, are compatible with [legacy SerpApi library](https://github.com/serpapi/google-search-results-ruby), which is still supported. To upgrade to the latest library, check our [migration guide](#Migration-quick-guide).
4242

@@ -45,7 +45,7 @@ Other versions, such as Ruby 1.9, Ruby 2.x, and JRuby, are compatible with [lega
4545
gem 'serpapi', '~> 1.0', '>= 1.0.3'
4646
```
4747

48-
### Gem
48+
### Gem
4949
```bash
5050
$ gem install serpapi
5151
```
@@ -139,7 +139,7 @@ Search API enables `async` search.
139139
- Non-blocking (`async=true`) : the development is more complex, but this allows handling many simultaneous connections.
140140
- Blocking (`async=false`) : it is easy to write the code but more compute-intensive when the parent process needs to hold many connections.
141141

142-
Here is an example of asynchronous searches using Ruby
142+
Here is an example of asynchronous searches using Ruby
143143
```ruby
144144
require 'serpapi'
145145

@@ -204,9 +204,9 @@ end
204204
responses = threads.map(&:value)
205205
```
206206

207-
The code aims to demonstrate how thread pools can be used to
208-
improve performance by executing multiple tasks concurrently. In
209-
this case, it makes multiple HTTP requests to an API endpoint using
207+
The code aims to demonstrate how thread pools can be used to
208+
improve performance by executing multiple tasks concurrently. In
209+
this case, it makes multiple HTTP requests to an API endpoint using
210210
a thread pool of persistent connections.
211211

212212
Note: `gem install connection_pool` to run this example.
@@ -228,7 +228,7 @@ benchmark: (demo/demo_thread_pool.rb)
228228
| 3.4.8 | 0.018644 | 4 | 0.004661 |
229229
| 4.0.0 | 0.017302 | 4 | 0.004326 |
230230

231-
Ruby 4.0.0 shows a slight improvement over Ruby 3.4.8, but the difference is not significant using thread.
231+
Ruby 4.0.0 shows a slight improvement over Ruby 3.4.8, but the difference is not significant using thread.
232232
Ractor could be considered for a more efficient use of resources but it's still in the experimental stage.
233233

234234
Note: in this benchmark, `thread == HTTP connections`.
@@ -508,25 +508,25 @@ see: [https://serpapi.com/yelp-search-api](https://serpapi.com/yelp-search-api)
508508
4. **SerpApi Optimization**: Shows consistent ~2.2x improvement with persistent connections regardless of Ruby version
509509
5. **Ruby 4.0.0 Performance**: Shows mixed results with some regressions compared to 3.4.4, particularly for HTTP.rb persistent connections. Ruby 4.0.0 was just released for Christmas 2025, and HTTP.rb has not been optimized for it yet.
510510

511-
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 or 4.0.0.
511+
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 or 4.0.0.
512512

513-
**Context** This benchmark was performed on warmup search results using a MacBook Pro 2025 connected via Wi-Fi 6.0 home network on AT&T fiber from Austin, TX (no network optimization).
513+
**Context** This benchmark was performed on warmup search results using a MacBook Pro 2025 connected via Wi-Fi 6.0 home network on AT&T fiber from Austin, TX (no network optimization).
514514

515515
## Migration quick guide
516516

517517
If you were already using [google-search-results-ruby gem](https://github.com/serpapi/google-search-results-ruby), here are the changes.
518518

519519
```
520520
# load library
521-
# old way
521+
# old way
522522
require 'google_search_results'
523523
# new way
524524
require 'serpapi'
525525

526526
# define a search
527527
# old way to describe the search
528528
search = GoogleSearch.new(search_params)
529-
# new way
529+
# new way
530530
default_parameter = {api_key: "secret_key", engine: "google"}
531531
client = SerpApi::Client.new(default_parameter)
532532
# an instance of the serpapi client is created
@@ -553,7 +553,7 @@ raw_html = client.html(params)
553553
hash_results = search.get_hash
554554
# new way
555555
results = client.search(params)
556-
# where params is the search parameters (override the default search parameters in the constructor).
556+
# where params is the search parameters (override the default search parameters in the constructor).
557557

558558
# search as raw JSON format
559559
# old way
@@ -574,11 +574,9 @@ Most notable improvements:
574574
- Reduce logic complexity in our implementation. (faster performance)
575575
- Better documentation.
576576

577-
## Supported Ruby version.
578-
Ruby versions validated by Github Actions:
579-
- 3.1
580-
- 3.4
581-
* doc: [Github Actions.](https://github.com/serpapi/serpapi-ruby/actions/workflows/ci.yml)
577+
## Supported Ruby versions
578+
579+
Ruby 2.7 and higher is supported.
582580

583581
## Change logs
584582
* [2025-11-17] 1.0.2 Implement `inspect` functions for client
@@ -605,7 +603,7 @@ This project source code and coding style was inspired by the most awesome Ruby
605603
- [Cloudfare](https://rubygems.org/gems/cloudflare/versions/2.1.0)
606604
- [rest-client](https://rubygems.org/gems/rest-client)
607605
- [stripe](https://rubygems.org/gems/stripe)
608-
606+
609607
### Code quality expectations
610608
- 0 lint offense: `rake lint`
611609
- 100% tests passing: `rake test`
@@ -616,7 +614,7 @@ This project source code and coding style was inspired by the most awesome Ruby
616614
### Class diagram
617615
```mermaid
618616
classDiagram
619-
Application *-- serpapi
617+
Application *-- serpapi
620618
serpapi *-- Client
621619
class Client {
622620
engine String
@@ -636,7 +634,7 @@ classDiagram
636634
### search() : Sequence diagram
637635
```mermaid
638636
sequenceDiagram
639-
Client->>SerpApi.com: search() : http request
637+
Client->>SerpApi.com: search() : http request
640638
SerpApi.com-->>SerpApi.com: query search engine
641639
SerpApi.com-->>SerpApi.com: parse HTML into JSON
642640
SerpApi.com-->>Client: JSON string payload
@@ -659,12 +657,12 @@ The class SerpApi::Client (client side / ruby):
659657
Et voila!
660658

661659
## Continuous integration
662-
We love [continuous integration](https://en.wikipedia.org/wiki/Continuous_integration) (CI) and [Test-Driven Development](https://en.wikipedia.org/wiki/Test-driven_development) (TDD) at SerpApi.
660+
We love [continuous integration](https://en.wikipedia.org/wiki/Continuous_integration) (CI) and [Test-Driven Development](https://en.wikipedia.org/wiki/Test-driven_development) (TDD) at SerpApi.
663661
We use RSpec and Github Actions to test our infrastructure around the clock, and that includes all changes to our clients.
664662

665663
The directory spec/ includes specification which serves the dual purposes of examples and functional tests.
666664

667-
Set your secret API key in your shell before running a test.
665+
Set your secret API key in your shell before running a test.
668666
The SerpApi key can be obtained from [serpapi.com/signup](https://serpapi.com/users/sign_up?plan=free).
669667
```bash
670668
export SERPAPI_KEY="your_secret_key"

serpapi.gemspec

Lines changed: 5 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,14 @@
1-
2-
if RUBY_VERSION < '2.1.0'
3-
load File.join(File.dirname(__FILE__), 'lib/serpapi/version')
4-
else
5-
require_relative 'lib/serpapi/version'
6-
end
1+
require_relative 'lib/serpapi/version'
72

83
Gem::Specification.new do |s|
94
s.name = 'serpapi'
105
s.version = SerpApi::VERSION
116
s.summary = 'Official Ruby library for SerpApi.com'
12-
s.description = 'Integrate powerful search functionality into your Ruby application with SerpApi. SerpApi offers official
13-
support for Google, Google Maps, Google Shopping, Baidu, Yandex, Yahoo, eBay, App Stores, and more.
14-
Access a vast range of data, including web search results, local business listings, and product
7+
s.description = 'Integrate powerful search functionality into your Ruby application with SerpApi. SerpApi offers official
8+
support for Google, Google Maps, Google Shopping, Baidu, Yandex, Yahoo, eBay, App Stores, and more.
9+
Access a vast range of data, including web search results, local business listings, and product
1510
information.'
16-
s.authors = ['victor benarbia', 'Julien Khaleghy']
11+
s.authors = ['Victor Benarbia', 'Julien Khaleghy']
1712
s.email = 'victor@serpapi.com'
1813
s.files = Dir['{lib}/serpapi.rb'] + Dir['{lib}/serpapi/*.rb']
1914
s.require_paths = ['lib']
@@ -30,5 +25,4 @@ information.'
3025
s.add_development_dependency 'yard', '~>0.9.28'
3126
s.add_development_dependency 'rubocop', '~>1.75.7'
3227
s.add_development_dependency 'csv'
33-
3428
end

0 commit comments

Comments
 (0)