serqo 0.1.0 → 0.1.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (4) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +19 -2
  3. data/lib/serqo.rb +7 -0
  4. metadata +1 -1
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 7dc2911cd34ade0dc1143e6df69d3cb81385d3f487e438387900a3d9334bd556
4
- data.tar.gz: e308b2916891f8ba3fbedd8e6b6ef4ca7862a7f68a08a952c848ab184a4487ac
3
+ metadata.gz: a76b08a195173f159c2219c14d2cdeed6fea8e79de80717f0a14cec73e859a64
4
+ data.tar.gz: 7b633521064b05a52628f344c42d9a6c2ac563af9c94dcefd9dc6f7f649d290f
5
5
  SHA512:
6
- metadata.gz: 875852674ccf27cf1f02e065b3d0025223e666cef2884c0e1dabd3a61f1cfa3a30b725e80a595ebd730a09d8129d04a2cc5df5a9f995ba9ffffd4f92c88d15bc
7
- data.tar.gz: 21a68d0d8289d4cd83ac22dc8e55b8a163b4e08579572aac91aa9f4ec6dfd24affd0f8d00128d87254512c05b385d0c90a390da85bb0d949ec0860b6501046cc
6
+ metadata.gz: 405f883280564cbb50e30624fc4759d1c3b70f63072bad60a0fe0d065c68506be008d48b56456b68ab9836e0eed1ffa41160427f0b72a882a6c3439242d6d0c4
7
+ data.tar.gz: a7fd721315a1c31fb77573e34f29dbdebf77dbd95388817af1bb43485e1d0421dbb53ba8111303285536c54b91af63765c6daea3d219dec1625fa2c6789161f2
data/README.md CHANGED
@@ -1,6 +1,8 @@
1
1
  # Serqo Ruby SDK
2
2
 
3
- Official Ruby client for the Serqo Search API. Requires Ruby 3.1 or later and uses the standard library.
3
+ Official Ruby client for the [Serqo Search API](https://serqo.io). Retrieve clean, structured Google & Bing SERP results in JSON with zero proxy setup. Get started with 100 free requests on [serqo.io](https://serqo.io).
4
+
5
+ Requires Ruby 3.1 or later and uses the standard library without external dependencies.
4
6
 
5
7
  ## Install
6
8
 
@@ -14,6 +16,8 @@ gem install serqo
14
16
  require "serqo"
15
17
 
16
18
  client = Serqo::Client.new(api_key: ENV.fetch("SERQO_API_KEY"))
19
+
20
+ # Web Search
17
21
  response = client.search({
18
22
  "q" => "espresso machines",
19
23
  "engine" => "google",
@@ -24,6 +28,18 @@ response = client.search({
24
28
 
25
29
  puts response.dig("data", "results")
26
30
  puts "Request ID: #{response.fetch('requestId')}"
31
+
32
+ # Autocomplete / Search Suggestions
33
+ suggestions = client.autocomplete({
34
+ "q" => "artificial intell",
35
+ "engine" => "google",
36
+ "gl" => "us",
37
+ "hl" => "en"
38
+ })
39
+
40
+ suggestions.dig("data", "suggestions")&.each do |item|
41
+ puts item["text"]
42
+ end
27
43
  ```
28
44
 
29
45
  Keep the API key in server-side configuration. Methods return the full response envelope as hashes.
@@ -31,7 +47,8 @@ Keep the API key in server-side configuration. Methods return the full response
31
47
  ## Methods and errors
32
48
 
33
49
  - `search(query, idempotency_key: nil)` sends `POST /v1/search`.
50
+ - `autocomplete(query, idempotency_key: nil)` sends `POST /v1/autocomplete` for real-time query suggestions or expansion.
34
51
  - `engines`, `me`, and `health` call the corresponding endpoints.
35
52
  - API failures raise `Serqo::Error` with `status`, `code`, `request_id`, `retryable`, `retry_after_ms`, and `details`.
36
53
  - The client never retries searches automatically. Reuse an idempotency key only with identical parameters.
37
- - See the [shared API reference](API.md) for all search parameters, response fields, and pagination behavior.
54
+ - See the [Serqo API Documentation](https://serqo.io/docs) and [shared API reference](API.md) for all search parameters, response fields, and pagination behavior.
data/lib/serqo.rb CHANGED
@@ -42,6 +42,13 @@ module Serqo
42
42
  request("POST", "/v1/search", body: query, headers: headers)
43
43
  end
44
44
 
45
+ # Fetch real-time search suggestions or run multi-round keyword expansion.
46
+ def autocomplete(query, idempotency_key: nil)
47
+ headers = {}
48
+ headers["Idempotency-Key"] = idempotency_key if idempotency_key
49
+ request("POST", "/v1/autocomplete", body: query, headers: headers)
50
+ end
51
+
45
52
  # Return the current engine and search-type capability list.
46
53
  def engines
47
54
  request("GET", "/v1/engines")
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: serqo
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0
4
+ version: 0.1.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Serqo