crawlora 1.5.0.pre.sdk.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.
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA256:
3
+ metadata.gz: d5df185ab17cbdb8ee244385b900049f2209efe980e1a672f39a7f61d18bfd35
4
+ data.tar.gz: af839794521c83c882affd859e4929ec76225144e45bb3f29141795b0fbb9b69
5
+ SHA512:
6
+ metadata.gz: ffd5f36fde004299e22e4f07d4c19e9904032d0ff78ee7c9a57b9d4d49964a2fba2fc0e7e14f412e9814b1c64e3d599c63259b69a6173dfbf50a71414354bd87
7
+ data.tar.gz: 2d529c261a355e69021267c41f520db47c0a8a399d107108ba08d3fe839158ef6929ef88986c6205592a144980a2f977af4eceeb42fa20ee2a2eb74568232874
data/CHANGELOG.md ADDED
@@ -0,0 +1,21 @@
1
+ # Changelog
2
+
3
+ ## 1.5.0-sdk.2
4
+
5
+ - Packaging: point the gem homepage at https://crawlora.net/, expand the gem
6
+ description, and add `documentation_uri` / `source_code_uri` / `bug_tracker_uri`
7
+ metadata for a richer RubyGems listing. No client or API changes.
8
+
9
+ ## 1.5.0-sdk.1
10
+
11
+ - Initial release of the Crawlora Ruby SDK.
12
+ - Grouped helpers (`client.<group>.<method>`) and dynamic `request`/`operation`
13
+ calls for every public operation, generated from the shared OpenAPI contract.
14
+ - Configurable retries with exponential backoff, jitter, and `Retry-After`
15
+ support; `on_retry` hook.
16
+ - Numeric and cursor pagination (`paginate` / `paginate_items`).
17
+ - `before_request` / `after_response` middleware, opt-in `request_id` and
18
+ `idempotency_keys`, client-side `rate_limit` / `max_concurrency`.
19
+ - `auto` / `json` / `text` / `stream` response modes.
20
+ - Typed error hierarchy: `Crawlora::Error`, `ClientError`, `ServerError`,
21
+ `NetworkError`.
data/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 Crawlora
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
data/README.md ADDED
@@ -0,0 +1,123 @@
1
+ # Crawlora Ruby SDK
2
+
3
+ Ruby client for the public [Crawlora](https://crawlora.net) web-scraping API. It
4
+ wraps every public endpoint with grouped helpers and a dynamic call interface,
5
+ plus retries, pagination, middleware hooks, and client-side rate limiting.
6
+
7
+ - **Base URL:** `https://api.crawlora.net/api/v1`
8
+ - **Auth:** API key (`x-api-key`) or JWT (`Authorization`)
9
+ - **Ruby:** 3.0+
10
+ - Operation reference: [`docs/operations.md`](docs/operations.md) · recipes: [`docs/recipes.md`](docs/recipes.md)
11
+
12
+ ## Install
13
+
14
+ ```ruby
15
+ # Gemfile
16
+ gem "crawlora"
17
+ ```
18
+
19
+ ```sh
20
+ gem install crawlora
21
+ ```
22
+
23
+ ## Quick start
24
+
25
+ ```ruby
26
+ require "crawlora"
27
+
28
+ # Reads CRAWLORA_API_KEY from the environment if api_key: is omitted.
29
+ client = Crawlora.client(api_key: ENV["CRAWLORA_API_KEY"])
30
+
31
+ result = client.bing.search(q: "web scraping")
32
+ result["data"].each { |item| puts item["title"] }
33
+
34
+ client.close # release pooled keep-alive connections
35
+ ```
36
+
37
+ Pass a block to auto-close:
38
+
39
+ ```ruby
40
+ Crawlora.client do |client|
41
+ puts client.amazon.product(asin: "B07FZ8S74R", language: "en_US")
42
+ end
43
+ ```
44
+
45
+ ## Calling operations
46
+
47
+ Grouped helpers map directly to the API (`client.<group>.<method>`):
48
+
49
+ ```ruby
50
+ client.youtube.video(id: "dQw4w9WgXcQ")
51
+ client.google.search(q: "crawlora", country: "US")
52
+ ```
53
+
54
+ Or call any operation dynamically by its id — handy for metaprogramming:
55
+
56
+ ```ruby
57
+ client.request("bing-search", { q: "web scraping", page: 2 })
58
+
59
+ # Discover operations:
60
+ Crawlora::OPERATION_COUNT # => total operations
61
+ Crawlora::GROUPS["bing"] # => { "search" => "bing-search", ... }
62
+ Crawlora::OperationId::BING_SEARCH # => "bing-search"
63
+ ```
64
+
65
+ ## Configuration
66
+
67
+ ```ruby
68
+ Crawlora.client(
69
+ api_key: "…",
70
+ timeout: 30, # seconds per request
71
+ retries: 2, # retry attempts on retryable failures
72
+ retry_delay: 0.25, # base backoff (exponential + jitter, honors Retry-After)
73
+ request_id: true, # attach an x-request-id to every call
74
+ idempotency_keys: true, # stable Idempotency-Key on POST/PATCH
75
+ rate_limit: 5, # max requests/second (client-side)
76
+ max_concurrency: 4, # max in-flight requests across threads
77
+ headers: { "X-Tenant" => "acme" }
78
+ )
79
+ ```
80
+
81
+ Per-request overrides use the reserved `_`-prefixed keyword on grouped calls, or
82
+ keyword args on `request`:
83
+
84
+ ```ruby
85
+ client.bing.search(q: "x", _timeout: 5, _headers: { "X-Trace" => "1" })
86
+ client.request("bing-search", { q: "x" }, response_type: "text", retries: 0)
87
+ ```
88
+
89
+ ## Pagination
90
+
91
+ ```ruby
92
+ # Numeric (page/offset) — stops on the first empty page:
93
+ client.paginate_items("airbnb-room-reviews", { id: "123" }, max_pages: 5).each do |review|
94
+ puts review["text"]
95
+ end
96
+
97
+ # Cursor mode — supply the cursor param and a next-cursor extractor:
98
+ client.paginate("producthunt-leaderboard", {},
99
+ cursor_param: "cursor", next_cursor: ->(page) { page["next_cursor"] }) do |page|
100
+ puts page["data"]
101
+ end
102
+ ```
103
+
104
+ ## Error handling
105
+
106
+ ```ruby
107
+ begin
108
+ client.bing.search(q: "x")
109
+ rescue Crawlora::ClientError => e # 4xx
110
+ warn "rejected (#{e.status}): #{e.message} #{e.code}"
111
+ rescue Crawlora::ServerError => e # 5xx
112
+ warn "server error: #{e.status}"
113
+ rescue Crawlora::NetworkError => e # timeout / transport failure
114
+ warn "network: #{e.message}"
115
+ end
116
+ ```
117
+
118
+ All inherit from `Crawlora::Error`, which exposes `status`, `code`, `body`,
119
+ `raw_body`, `headers`, and `request_id`.
120
+
121
+ ## License
122
+
123
+ MIT. See [LICENSE](LICENSE).