Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
86 changes: 86 additions & 0 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,86 @@
# Contributing

## Key goals

- Brand centric instead of search engine based
- No hard-coded logic per search engine
- Simple HTTP client (lightweight, reduced dependency)
- No magic default values
- Thread safe
- Easy extension
- Defensive code style (raise a custom exception)
- TDD - Test driven development
- Best API coding practice per platform
- KiSS principles

## Inspirations

This project source code and coding style was inspired by the most awesome Ruby Gems:
- [bcrypt](https://github.com/bcrypt-ruby/bcrypt-ruby)
- [Nokogiri](https://nokogiri.org)
- [Cloudfare](https://rubygems.org/gems/cloudflare/versions/2.1.0)
- [rest-client](https://rubygems.org/gems/rest-client)
- [stripe](https://rubygems.org/gems/stripe)

## Code quality expectations

- 0 lint offense: `rake lint`
- 100% tests passing: `rake test`
- 100% code coverage: `rake coverage` (simple-cov)

## Continuous integration

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.
We use RSpec and Github Actions to test our infrastructure around the clock, and that includes all changes to our clients.

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

Set your secret API key in your shell before running a test.
The SerpApi key can be obtained from [serpapi.com/signup](https://serpapi.com/users/sign_up?plan=free).
```bash
export SERPAPI_KEY="your_secret_key"
```
Install testing dependency
```bash
$ bundle install
# or
$ rake dependency
```

Check code quality using Lint.
```bash
$ rake lint
```

Run basic test
```bash
$ rake test
```

Run tests with code coverage
```bash
$ rake coverage
```

Review coverage report generated by `rake coverage`
```sh
# Current coverage: 98.68% (75 / 76 lines)
open coverage/index.html
```

Review documentation generated by `rake doc`
```sh
open doc/index.html
```

Run full regression test suite on the examples.
```bash
rake regression
```

Test the actuall packaged gem locally using the demo scripts.
```bash
$ rake oobt
```

Open ./Rakefile for more information.
131 changes: 2 additions & 129 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -1097,133 +1097,6 @@ Most notable improvements:

Ruby 2.7 and higher is supported.

## Developer Guide
### Key goals
- Brand centric instead of search engine based
- No hard-coded logic per search engine
- Simple HTTP client (lightweight, reduced dependency)
- No magic default values
- Thread safe
- Easy extension
- Defensive code style (raise a custom exception)
- TDD - Test driven development
- Best API coding practice per platform
- KiSS principles

### Inspirations
This project source code and coding style was inspired by the most awesome Ruby Gems:
- [bcrypt](https://github.com/bcrypt-ruby/bcrypt-ruby)
- [Nokogiri](https://nokogiri.org)
- [Cloudfare](https://rubygems.org/gems/cloudflare/versions/2.1.0)
- [rest-client](https://rubygems.org/gems/rest-client)
- [stripe](https://rubygems.org/gems/stripe)

### Code quality expectations
- 0 lint offense: `rake lint`
- 100% tests passing: `rake test`
- 100% code coverage: `rake coverage` (simple-cov)

# Developer Guide
## Design : UML diagram
### Class diagram
```mermaid
classDiagram
Application *-- serpapi
serpapi *-- Client
class Client {
engine String
api_key String
params Hash
search() Hash
html() String
location() String
search_archive() Hash
account() Hash
}
openuri <.. Client
json <.. Client
Ruby <.. openuri
Ruby <.. json
```
### search() : Sequence diagram
```mermaid
sequenceDiagram
Client->>SerpApi.com: search() : http request
SerpApi.com-->>SerpApi.com: query search engine
SerpApi.com-->>SerpApi.com: parse HTML into JSON
SerpApi.com-->>Client: JSON string payload
Client-->>Client: decode JSON into Hash
```
where:
- The end user implements the application.
- Client refers to SerpApi:Client.
- SerpApi.com is the backend HTTP / REST service.
- Engine refers to Google, Baidu, Bing, and more.

The SerpApi.com service (backend)
- executes a scalable search on `engine: "google"` using the search query: `q: "coffee"`.
- parses the messy HTML responses from Google on the backend.
- returns a standardized JSON response.
The class SerpApi::Client (client side / ruby):
- Format the request to SerpApi.com server.
- Execute HTTP Get request.
- Parse JSON into Ruby Hash using a standard JSON library.
Et voila!

## Continuous integration
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.
We use RSpec and Github Actions to test our infrastructure around the clock, and that includes all changes to our clients.

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

Set your secret API key in your shell before running a test.
The SerpApi key can be obtained from [serpapi.com/signup](https://serpapi.com/users/sign_up?plan=free).
```bash
export SERPAPI_KEY="your_secret_key"
```
Install testing dependency
```bash
$ bundle install
# or
$ rake dependency
```

Check code quality using Lint.
```bash
$ rake lint
```

Run basic test
```bash
$ rake test
```

Run tests with code coverage
```bash
$ rake coverage
```

Review coverage report generated by `rake coverage`
```sh
# Current coverage: 98.68% (75 / 76 lines)
open coverage/index.html
```

Review documentation generated by `rake doc`
```sh
open doc/index.html
```

Run full regression test suite on the examples.
```bash
rake regression
```

Test the actuall packaged gem locally using the demo scripts.
```bash
$ rake oobt
```

Open ./Rakefile for more information.
## Contributing

Contributions are welcome. Feel free to submit a pull request!
Contributions are welcome. Make sure to read our [contributing guide](./CONTRIBUTING.md).
131 changes: 0 additions & 131 deletions README.md.erb
Original file line number Diff line number Diff line change
Expand Up @@ -582,134 +582,3 @@ Ruby 2.7 and higher is supported.
* [2025-11-17] 1.0.2 Implement `inspect` functions for client
* [2025-07-18] 1.0.1 Add support for old Ruby versions (2.7, 3.0)
* [2025-07-01] 1.0.0 Full API support

## Developer Guide
### Key goals
- Brand centric instead of search engine based
- No hard-coded logic per search engine
- Simple HTTP client (lightweight, reduced dependency)
- No magic default values
- Thread safe
- Easy extension
- Defensive code style (raise a custom exception)
- TDD - Test driven development
- Best API coding practice per platform
- KiSS principles

### Inspirations
This project source code and coding style was inspired by the most awesome Ruby Gems:
- [bcrypt](https://github.com/bcrypt-ruby/bcrypt-ruby)
- [Nokogiri](https://nokogiri.org)
- [Cloudfare](https://rubygems.org/gems/cloudflare/versions/2.1.0)
- [rest-client](https://rubygems.org/gems/rest-client)
- [stripe](https://rubygems.org/gems/stripe)

### Code quality expectations
- 0 lint offense: `rake lint`
- 100% tests passing: `rake test`
- 100% code coverage: `rake coverage` (simple-cov)

# Developer Guide
## Design : UML diagram
### Class diagram
```mermaid
classDiagram
Application *-- serpapi
serpapi *-- Client
class Client {
engine String
api_key String
params Hash
search() Hash
html() String
location() String
search_archive() Hash
account() Hash
}
openuri <.. Client
json <.. Client
Ruby <.. openuri
Ruby <.. json
```
### search() : Sequence diagram
```mermaid
sequenceDiagram
Client->>SerpApi.com: search() : http request
SerpApi.com-->>SerpApi.com: query search engine
SerpApi.com-->>SerpApi.com: parse HTML into JSON
SerpApi.com-->>Client: JSON string payload
Client-->>Client: decode JSON into Hash
```
where:
- The end user implements the application.
- Client refers to SerpApi:Client.
- SerpApi.com is the backend HTTP / REST service.
- Engine refers to Google, Baidu, Bing, and more.

The SerpApi.com service (backend)
- executes a scalable search on `engine: "google"` using the search query: `q: "coffee"`.
- parses the messy HTML responses from Google on the backend.
- returns a standardized JSON response.
The class SerpApi::Client (client side / ruby):
- Format the request to SerpApi.com server.
- Execute HTTP Get request.
- Parse JSON into Ruby Hash using a standard JSON library.
Et voila!

## Continuous integration
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.
We use RSpec and Github Actions to test our infrastructure around the clock, and that includes all changes to our clients.

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

Set your secret API key in your shell before running a test.
The SerpApi key can be obtained from [serpapi.com/signup](https://serpapi.com/users/sign_up?plan=free).
```bash
export SERPAPI_KEY="your_secret_key"
```
Install testing dependency
```bash
$ bundle install
# or
$ rake dependency
```

Check code quality using Lint.
```bash
$ rake lint
```

Run basic test
```bash
$ rake test
```

Run tests with code coverage
```bash
$ rake coverage
```

Review coverage report generated by `rake coverage`
```sh
# Current coverage: 98.68% (75 / 76 lines)
open coverage/index.html
```

Review documentation generated by `rake doc`
```sh
open doc/index.html
```

Run full regression test suite on the examples.
```bash
rake regression
```

Test the actuall packaged gem locally using the demo scripts.
```bash
$ rake oobt
```

Open ./Rakefile for more information.

Contributions are welcome. Feel free to submit a pull request!
Loading