apiverve_techstackdetector 1.2.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 +7 -0
- data/LICENSE +21 -0
- data/README.md +330 -0
- data/lib/apiverve_techstackdetector/client.rb +184 -0
- data/lib/apiverve_techstackdetector.rb +9 -0
- metadata +102 -0
checksums.yaml
ADDED
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
---
|
|
2
|
+
SHA256:
|
|
3
|
+
metadata.gz: 3455b47fc4edabf5b1847593653f97074ebf0dc56baec774a7818858585cd2f7
|
|
4
|
+
data.tar.gz: 9e8b98c21cfcfeabbb8bcc7b44b4e6317cff16dce29b102ac89563071ee11cc2
|
|
5
|
+
SHA512:
|
|
6
|
+
metadata.gz: f7929e6fadeabf0c62e5133e7e2f9f457e2a5dde1c263ea3b9f2de948054308a09e45df1c4abb28daad5a446e1b66c119cfd69ee7d46da281707cf091851cc58
|
|
7
|
+
data.tar.gz: dcb490b902a794a2b6e2b45ff7659a08aa1bae474210c0e0dad37177f24e578569608e68bdfc34f1ab0780f4d95ee2b6581240382896620ed670232b3a14a042
|
data/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 APIVerve and EvlarSoft LLC
|
|
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,330 @@
|
|
|
1
|
+
# Website Tech Stack Detector API - Ruby Gem
|
|
2
|
+
|
|
3
|
+
Website Tech Stack Detector identifies the technologies a website runs on, such as its CMS, ecommerce platform, JavaScript framework, analytics, CDN and hosting, with categories and a confidence score for each. Paid plans add detected versions, CPE identifiers and a rendered mode that runs the page's JavaScript.
|
|
4
|
+
|
|
5
|
+
## Installation
|
|
6
|
+
|
|
7
|
+
Add this line to your application's Gemfile:
|
|
8
|
+
|
|
9
|
+
```ruby
|
|
10
|
+
gem 'apiverve_techstackdetector'
|
|
11
|
+
```
|
|
12
|
+
|
|
13
|
+
And then execute:
|
|
14
|
+
|
|
15
|
+
```bash
|
|
16
|
+
$ bundle install
|
|
17
|
+
```
|
|
18
|
+
|
|
19
|
+
Or install it yourself as:
|
|
20
|
+
|
|
21
|
+
```bash
|
|
22
|
+
$ gem install apiverve_techstackdetector
|
|
23
|
+
```
|
|
24
|
+
|
|
25
|
+
## Getting Started
|
|
26
|
+
|
|
27
|
+
Get your API key at [APIVerve](https://apiverve.com)
|
|
28
|
+
|
|
29
|
+
### Basic Usage
|
|
30
|
+
|
|
31
|
+
```ruby
|
|
32
|
+
require 'apiverve_techstackdetector'
|
|
33
|
+
|
|
34
|
+
# Initialize the client
|
|
35
|
+
client = APIVerve::Techstackdetector::Client.new(api_key: "YOUR_API_KEY")
|
|
36
|
+
|
|
37
|
+
# Make a request
|
|
38
|
+
response = client.execute({
|
|
39
|
+
url: "https://wordpress.org",
|
|
40
|
+
render: true
|
|
41
|
+
})
|
|
42
|
+
|
|
43
|
+
# Print the response
|
|
44
|
+
puts response
|
|
45
|
+
```
|
|
46
|
+
|
|
47
|
+
|
|
48
|
+
### Error Handling
|
|
49
|
+
|
|
50
|
+
```ruby
|
|
51
|
+
begin
|
|
52
|
+
response = client.execute({ url: "https://wordpress.org", render: true })
|
|
53
|
+
puts response["data"]
|
|
54
|
+
rescue APIVerve::Techstackdetector::ValidationError => e
|
|
55
|
+
puts "Validation error: #{e.errors.join(', ')}"
|
|
56
|
+
rescue APIVerve::Techstackdetector::APIError => e
|
|
57
|
+
puts "API error: #{e.message}"
|
|
58
|
+
puts "Status code: #{e.status_code}"
|
|
59
|
+
end
|
|
60
|
+
```
|
|
61
|
+
|
|
62
|
+
### Debug Mode
|
|
63
|
+
|
|
64
|
+
```ruby
|
|
65
|
+
# Enable debug logging
|
|
66
|
+
client = APIVerve::Techstackdetector::Client.new(
|
|
67
|
+
api_key: "YOUR_API_KEY",
|
|
68
|
+
debug: true
|
|
69
|
+
)
|
|
70
|
+
```
|
|
71
|
+
|
|
72
|
+
## Example Response
|
|
73
|
+
|
|
74
|
+
```json
|
|
75
|
+
{
|
|
76
|
+
"status": "ok",
|
|
77
|
+
"error": null,
|
|
78
|
+
"data": {
|
|
79
|
+
"url": "https://wordpress.org/",
|
|
80
|
+
"finalUrl": "https://wordpress.org/",
|
|
81
|
+
"statusCode": 200,
|
|
82
|
+
"mode": "static",
|
|
83
|
+
"technologyCount": 13,
|
|
84
|
+
"technologies": [
|
|
85
|
+
{
|
|
86
|
+
"name": "WordPress",
|
|
87
|
+
"slug": "wordpress",
|
|
88
|
+
"categories": [
|
|
89
|
+
"CMS",
|
|
90
|
+
"Blogs"
|
|
91
|
+
],
|
|
92
|
+
"version": "7.2",
|
|
93
|
+
"confidence": 100,
|
|
94
|
+
"implied": false,
|
|
95
|
+
"detectedBy": [
|
|
96
|
+
"html",
|
|
97
|
+
"scriptSrc",
|
|
98
|
+
"scripts",
|
|
99
|
+
"headers",
|
|
100
|
+
"meta",
|
|
101
|
+
"dom"
|
|
102
|
+
],
|
|
103
|
+
"website": "https://wordpress.org",
|
|
104
|
+
"icon": "WordPress.svg",
|
|
105
|
+
"description": "WordPress is a free and open-source content management system written in PHP and paired with a MySQL or MariaDB database. Features include a plugin architecture and a template system.",
|
|
106
|
+
"cpe": "cpe:2.3:a:wordpress:wordpress:*:*:*:*:*:*:*:*"
|
|
107
|
+
},
|
|
108
|
+
{
|
|
109
|
+
"name": "WordPress Block Editor",
|
|
110
|
+
"slug": "wordpress-block-editor",
|
|
111
|
+
"categories": [
|
|
112
|
+
"Page builders"
|
|
113
|
+
],
|
|
114
|
+
"version": null,
|
|
115
|
+
"confidence": 100,
|
|
116
|
+
"implied": false,
|
|
117
|
+
"detectedBy": [
|
|
118
|
+
"html"
|
|
119
|
+
],
|
|
120
|
+
"website": "https://wordpress.org/gutenberg/",
|
|
121
|
+
"icon": "WordPress.svg",
|
|
122
|
+
"description": "Sites using the WordPress Block Editor, also known as Gutenberg.",
|
|
123
|
+
"cpe": null
|
|
124
|
+
},
|
|
125
|
+
{
|
|
126
|
+
"name": "WordPress Site Editor",
|
|
127
|
+
"slug": "wordpress-site-editor",
|
|
128
|
+
"categories": [
|
|
129
|
+
"Page builders"
|
|
130
|
+
],
|
|
131
|
+
"version": null,
|
|
132
|
+
"confidence": 100,
|
|
133
|
+
"implied": false,
|
|
134
|
+
"detectedBy": [
|
|
135
|
+
"html"
|
|
136
|
+
],
|
|
137
|
+
"website": "https://wordpress.org/documentation/article/site-editor/",
|
|
138
|
+
"icon": "WordPress.svg",
|
|
139
|
+
"description": "Full Site Editing enables users to design and customize their entire WordPress website with a block-based editor.",
|
|
140
|
+
"cpe": null
|
|
141
|
+
},
|
|
142
|
+
{
|
|
143
|
+
"name": "Gutenberg",
|
|
144
|
+
"slug": "gutenberg",
|
|
145
|
+
"categories": [
|
|
146
|
+
"WordPress plugins",
|
|
147
|
+
"Editors"
|
|
148
|
+
],
|
|
149
|
+
"version": "24.2.0",
|
|
150
|
+
"confidence": 100,
|
|
151
|
+
"implied": false,
|
|
152
|
+
"detectedBy": [
|
|
153
|
+
"scriptSrc",
|
|
154
|
+
"dom"
|
|
155
|
+
],
|
|
156
|
+
"website": "https://github.com/WordPress/gutenberg",
|
|
157
|
+
"icon": "Gutenberg.png",
|
|
158
|
+
"description": "Gutenberg is the code name for the new block based editor introduced in WordPress 5.",
|
|
159
|
+
"cpe": null
|
|
160
|
+
},
|
|
161
|
+
{
|
|
162
|
+
"name": "MySQL",
|
|
163
|
+
"slug": "mysql",
|
|
164
|
+
"categories": [
|
|
165
|
+
"Databases"
|
|
166
|
+
],
|
|
167
|
+
"version": null,
|
|
168
|
+
"confidence": 100,
|
|
169
|
+
"implied": true,
|
|
170
|
+
"detectedBy": [],
|
|
171
|
+
"website": "https://mysql.com",
|
|
172
|
+
"icon": "MySQL.svg",
|
|
173
|
+
"description": "MySQL is an open-source relational database management system.",
|
|
174
|
+
"cpe": "cpe:2.3:a:mysql:mysql:*:*:*:*:*:*:*:*"
|
|
175
|
+
},
|
|
176
|
+
{
|
|
177
|
+
"name": "PHP",
|
|
178
|
+
"slug": "php",
|
|
179
|
+
"categories": [
|
|
180
|
+
"Programming languages"
|
|
181
|
+
],
|
|
182
|
+
"version": null,
|
|
183
|
+
"confidence": 100,
|
|
184
|
+
"implied": false,
|
|
185
|
+
"detectedBy": [
|
|
186
|
+
"scripts"
|
|
187
|
+
],
|
|
188
|
+
"website": "https://php.net",
|
|
189
|
+
"icon": "PHP.svg",
|
|
190
|
+
"description": "PHP is a general-purpose scripting language used for web development.",
|
|
191
|
+
"cpe": "cpe:2.3:a:php:php:*:*:*:*:*:*:*:*"
|
|
192
|
+
},
|
|
193
|
+
{
|
|
194
|
+
"name": "Nginx",
|
|
195
|
+
"slug": "nginx",
|
|
196
|
+
"categories": [
|
|
197
|
+
"Web servers",
|
|
198
|
+
"Reverse proxies"
|
|
199
|
+
],
|
|
200
|
+
"version": null,
|
|
201
|
+
"confidence": 100,
|
|
202
|
+
"implied": false,
|
|
203
|
+
"detectedBy": [
|
|
204
|
+
"headers"
|
|
205
|
+
],
|
|
206
|
+
"website": "https://nginx.org/en",
|
|
207
|
+
"icon": "Nginx.svg",
|
|
208
|
+
"description": "Nginx is a web server that can also be used as a reverse proxy, load balancer, mail proxy and HTTP cache.",
|
|
209
|
+
"cpe": "cpe:2.3:a:f5:nginx:*:*:*:*:*:*:*:*"
|
|
210
|
+
},
|
|
211
|
+
{
|
|
212
|
+
"name": "Google Font API",
|
|
213
|
+
"slug": "google-font-api",
|
|
214
|
+
"categories": [
|
|
215
|
+
"Font scripts"
|
|
216
|
+
],
|
|
217
|
+
"version": null,
|
|
218
|
+
"confidence": 100,
|
|
219
|
+
"implied": false,
|
|
220
|
+
"detectedBy": [
|
|
221
|
+
"dom"
|
|
222
|
+
],
|
|
223
|
+
"website": "https://fonts.google.com/",
|
|
224
|
+
"icon": "Google Font API.svg",
|
|
225
|
+
"description": "Google Font API is a web service that supports open-source font files that can be used on your web designs.",
|
|
226
|
+
"cpe": null
|
|
227
|
+
},
|
|
228
|
+
{
|
|
229
|
+
"name": "Google Tag Manager",
|
|
230
|
+
"slug": "google-tag-manager",
|
|
231
|
+
"categories": [
|
|
232
|
+
"Tag managers"
|
|
233
|
+
],
|
|
234
|
+
"version": null,
|
|
235
|
+
"confidence": 100,
|
|
236
|
+
"implied": false,
|
|
237
|
+
"detectedBy": [
|
|
238
|
+
"html"
|
|
239
|
+
],
|
|
240
|
+
"website": "https://www.google.com/tagmanager",
|
|
241
|
+
"icon": "Google Tag Manager.svg",
|
|
242
|
+
"description": "Google Tag Manager is a tag management system (TMS) that allows you to quickly and easily update measurement codes and related code fragments collectively known as tags on your website or mobile app.",
|
|
243
|
+
"cpe": null
|
|
244
|
+
},
|
|
245
|
+
{
|
|
246
|
+
"name": "HSTS",
|
|
247
|
+
"slug": "hsts",
|
|
248
|
+
"categories": [
|
|
249
|
+
"Security"
|
|
250
|
+
],
|
|
251
|
+
"version": null,
|
|
252
|
+
"confidence": 100,
|
|
253
|
+
"implied": false,
|
|
254
|
+
"detectedBy": [
|
|
255
|
+
"headers"
|
|
256
|
+
],
|
|
257
|
+
"website": "https://www.rfc-editor.org/rfc/rfc6797#section-6.1",
|
|
258
|
+
"icon": null,
|
|
259
|
+
"description": "HTTP Strict Transport Security (HSTS) informs browsers that the site should only be accessed using HTTPS.",
|
|
260
|
+
"cpe": null
|
|
261
|
+
},
|
|
262
|
+
{
|
|
263
|
+
"name": "Priority Hints",
|
|
264
|
+
"slug": "priority-hints",
|
|
265
|
+
"categories": [
|
|
266
|
+
"Performance"
|
|
267
|
+
],
|
|
268
|
+
"version": null,
|
|
269
|
+
"confidence": 100,
|
|
270
|
+
"implied": false,
|
|
271
|
+
"detectedBy": [
|
|
272
|
+
"dom"
|
|
273
|
+
],
|
|
274
|
+
"website": "https://wicg.github.io/priority-hints/",
|
|
275
|
+
"icon": "Priority Hints.svg",
|
|
276
|
+
"description": "Priority Hints exposes a mechanism for developers to signal a relative priority for browsers to consider when fetching resources.",
|
|
277
|
+
"cpe": null
|
|
278
|
+
},
|
|
279
|
+
{
|
|
280
|
+
"name": "Open Graph",
|
|
281
|
+
"slug": "open-graph",
|
|
282
|
+
"categories": [
|
|
283
|
+
"Miscellaneous"
|
|
284
|
+
],
|
|
285
|
+
"version": null,
|
|
286
|
+
"confidence": 100,
|
|
287
|
+
"implied": false,
|
|
288
|
+
"detectedBy": [
|
|
289
|
+
"dom"
|
|
290
|
+
],
|
|
291
|
+
"website": "https://ogp.me",
|
|
292
|
+
"icon": "Open Graph.svg",
|
|
293
|
+
"description": "Open Graph is a protocol that is used to integrate any web page into the social graph.",
|
|
294
|
+
"cpe": null
|
|
295
|
+
},
|
|
296
|
+
{
|
|
297
|
+
"name": "RSS",
|
|
298
|
+
"slug": "rss",
|
|
299
|
+
"categories": [
|
|
300
|
+
"Miscellaneous"
|
|
301
|
+
],
|
|
302
|
+
"version": null,
|
|
303
|
+
"confidence": 100,
|
|
304
|
+
"implied": false,
|
|
305
|
+
"detectedBy": [
|
|
306
|
+
"dom"
|
|
307
|
+
],
|
|
308
|
+
"website": "https://www.rssboard.org/rss-specification",
|
|
309
|
+
"icon": "RSS.svg",
|
|
310
|
+
"description": "RSS is a family of web feed formats used to publish frequently updated works—such as blog entries, news headlines, audio, and video—in a standardized format.",
|
|
311
|
+
"cpe": null
|
|
312
|
+
}
|
|
313
|
+
],
|
|
314
|
+
"fingerprintsUpdatedAt": "2026-10-19T01:59:39.005Z"
|
|
315
|
+
}
|
|
316
|
+
}
|
|
317
|
+
```
|
|
318
|
+
|
|
319
|
+
## Documentation
|
|
320
|
+
|
|
321
|
+
For more information, visit the [API Documentation](https://docs.apiverve.com/ref/techstackdetector?utm_source=rubygems&utm_medium=referral&utm_content=readme).
|
|
322
|
+
|
|
323
|
+
## Support
|
|
324
|
+
|
|
325
|
+
- Website: [https://apiverve.com/marketplace/techstackdetector?utm_source=ruby&utm_medium=referral&utm_content=readme](https://apiverve.com/marketplace/techstackdetector?utm_source=ruby&utm_medium=referral&utm_content=readme)
|
|
326
|
+
- Email: hello@apiverve.com
|
|
327
|
+
|
|
328
|
+
## License
|
|
329
|
+
|
|
330
|
+
This gem is available under the [MIT License](LICENSE).
|
|
@@ -0,0 +1,184 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
require "faraday"
|
|
4
|
+
require "faraday/multipart"
|
|
5
|
+
require "json"
|
|
6
|
+
|
|
7
|
+
module APIVerve
|
|
8
|
+
module Techstackdetector
|
|
9
|
+
# Client for the Website Tech Stack Detector API
|
|
10
|
+
#
|
|
11
|
+
# @example Basic usage
|
|
12
|
+
# client = APIVerve::Techstackdetector::Client.new(api_key: "your_api_key")
|
|
13
|
+
# response = client.execute({ url: "https://wordpress.org", render: true })
|
|
14
|
+
# puts response
|
|
15
|
+
#
|
|
16
|
+
# @see https://apiverve.com/marketplace/techstackdetector?utm_source=ruby&utm_medium=referral&utm_content=readme
|
|
17
|
+
class Client
|
|
18
|
+
BASE_URL = "https://api.apiverve.com/v1/techstackdetector"
|
|
19
|
+
DEFAULT_TIMEOUT = 30
|
|
20
|
+
|
|
21
|
+
# Validation rules for parameters
|
|
22
|
+
VALIDATION_RULES = { 'url' => { type: 'string', required: true, format: 'url' }, 'render' => { type: 'boolean', required: false } }
|
|
23
|
+
|
|
24
|
+
# Format validation patterns
|
|
25
|
+
FORMAT_PATTERNS = {
|
|
26
|
+
'email' => /^[^\s@]+@[^\s@]+\.[^\s@]+$/,
|
|
27
|
+
'url' => /^https?:\/\/.+/,
|
|
28
|
+
'ip' => /^(?:(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.){3}(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)$|^([0-9a-fA-F]{1,4}:){7}[0-9a-fA-F]{1,4}$/,
|
|
29
|
+
'date' => /^\d{4}-\d{2}-\d{2}$/,
|
|
30
|
+
'hexColor' => /^#?([0-9a-fA-F]{3}|[0-9a-fA-F]{6})$/
|
|
31
|
+
}.freeze
|
|
32
|
+
|
|
33
|
+
# Initialize the client
|
|
34
|
+
#
|
|
35
|
+
# @param api_key [String] Your APIVerve API key
|
|
36
|
+
# @param timeout [Integer] Request timeout in seconds (default: 30)
|
|
37
|
+
# @param debug [Boolean] Enable debug logging (default: false)
|
|
38
|
+
# @raise [ArgumentError] If API key is invalid
|
|
39
|
+
def initialize(api_key:, timeout: DEFAULT_TIMEOUT, debug: false)
|
|
40
|
+
validate_api_key!(api_key)
|
|
41
|
+
|
|
42
|
+
@api_key = api_key
|
|
43
|
+
@timeout = timeout
|
|
44
|
+
@debug = debug
|
|
45
|
+
|
|
46
|
+
@connection = Faraday.new(url: BASE_URL) do |conn|
|
|
47
|
+
conn.request :multipart
|
|
48
|
+
conn.request :url_encoded
|
|
49
|
+
conn.adapter Faraday.default_adapter
|
|
50
|
+
conn.options.timeout = @timeout
|
|
51
|
+
conn.headers["x-api-key"] = @api_key
|
|
52
|
+
conn.headers["auth-mode"] = "rubygems-package"
|
|
53
|
+
conn.headers["Content-Type"] = "application/json"
|
|
54
|
+
end
|
|
55
|
+
end
|
|
56
|
+
|
|
57
|
+
# Execute the API request
|
|
58
|
+
#
|
|
59
|
+
# @param params [Hash] Query parameters or request body
|
|
60
|
+
# @return [Hash] API response
|
|
61
|
+
# @raise [APIError] If the request fails
|
|
62
|
+
# @raise [ValidationError] If parameter validation fails
|
|
63
|
+
def execute(params = {})
|
|
64
|
+
validate_params!(params)
|
|
65
|
+
|
|
66
|
+
log("Making GET request to #{BASE_URL}")
|
|
67
|
+
log("Parameters: #{params.inspect}") if params.any?
|
|
68
|
+
|
|
69
|
+
response = @connection.get do |req|
|
|
70
|
+
params.each { |k, v| req.params[k.to_s] = v }
|
|
71
|
+
end
|
|
72
|
+
|
|
73
|
+
handle_response(response)
|
|
74
|
+
end
|
|
75
|
+
|
|
76
|
+
private
|
|
77
|
+
|
|
78
|
+
def validate_api_key!(api_key)
|
|
79
|
+
raise ArgumentError, "API key is required. Get your API key at: https://apiverve.com" if api_key.nil? || api_key.strip.empty?
|
|
80
|
+
|
|
81
|
+
unless api_key.match?(/^[a-zA-Z0-9_-]+$/)
|
|
82
|
+
raise ArgumentError, "Invalid API key format. API key should only contain letters, numbers, hyphens, and underscores."
|
|
83
|
+
end
|
|
84
|
+
end
|
|
85
|
+
|
|
86
|
+
def validate_params!(params)
|
|
87
|
+
return if VALIDATION_RULES.empty?
|
|
88
|
+
|
|
89
|
+
errors = []
|
|
90
|
+
|
|
91
|
+
VALIDATION_RULES.each do |param_name, rules|
|
|
92
|
+
value = params[param_name.to_sym] || params[param_name]
|
|
93
|
+
|
|
94
|
+
# Check required
|
|
95
|
+
if rules[:required] && (value.nil? || value.to_s.empty?)
|
|
96
|
+
errors << "Required parameter [#{param_name}] is missing."
|
|
97
|
+
next
|
|
98
|
+
end
|
|
99
|
+
|
|
100
|
+
next if value.nil?
|
|
101
|
+
|
|
102
|
+
case rules[:type]
|
|
103
|
+
when "integer", "number"
|
|
104
|
+
begin
|
|
105
|
+
num_value = rules[:type] == "number" ? Float(value) : Integer(value)
|
|
106
|
+
errors << "Parameter [#{param_name}] must be at least #{rules[:min]}." if rules[:min] && num_value < rules[:min]
|
|
107
|
+
errors << "Parameter [#{param_name}] must be at most #{rules[:max]}." if rules[:max] && num_value > rules[:max]
|
|
108
|
+
rescue ArgumentError, TypeError
|
|
109
|
+
errors << "Parameter [#{param_name}] must be a valid #{rules[:type]}."
|
|
110
|
+
end
|
|
111
|
+
when "string"
|
|
112
|
+
unless value.is_a?(String)
|
|
113
|
+
errors << "Parameter [#{param_name}] must be a string."
|
|
114
|
+
next
|
|
115
|
+
end
|
|
116
|
+
errors << "Parameter [#{param_name}] must be at least #{rules[:min_length]} characters." if rules[:min_length] && value.length < rules[:min_length]
|
|
117
|
+
errors << "Parameter [#{param_name}] must be at most #{rules[:max_length]} characters." if rules[:max_length] && value.length > rules[:max_length]
|
|
118
|
+
|
|
119
|
+
if rules[:format] && FORMAT_PATTERNS[rules[:format]]
|
|
120
|
+
unless value.match?(FORMAT_PATTERNS[rules[:format]])
|
|
121
|
+
errors << "Parameter [#{param_name}] must be a valid #{rules[:format]}."
|
|
122
|
+
end
|
|
123
|
+
end
|
|
124
|
+
when "boolean"
|
|
125
|
+
unless [true, false, "true", "false"].include?(value)
|
|
126
|
+
errors << "Parameter [#{param_name}] must be a boolean."
|
|
127
|
+
end
|
|
128
|
+
end
|
|
129
|
+
|
|
130
|
+
# Enum validation
|
|
131
|
+
if rules[:enum] && !rules[:enum].include?(value)
|
|
132
|
+
errors << "Parameter [#{param_name}] must be one of: #{rules[:enum].join(', ')}."
|
|
133
|
+
end
|
|
134
|
+
end
|
|
135
|
+
|
|
136
|
+
raise ValidationError, errors unless errors.empty?
|
|
137
|
+
end
|
|
138
|
+
|
|
139
|
+
def handle_response(response)
|
|
140
|
+
log("Response status: #{response.status}")
|
|
141
|
+
|
|
142
|
+
data = JSON.parse(response.body)
|
|
143
|
+
|
|
144
|
+
if data["status"] == "error"
|
|
145
|
+
raise APIError.new(data["error"] || "Unknown API error", response.status, data)
|
|
146
|
+
end
|
|
147
|
+
|
|
148
|
+
unless response.success?
|
|
149
|
+
raise APIError.new(data["error"] || "HTTP #{response.status} error", response.status, data)
|
|
150
|
+
end
|
|
151
|
+
|
|
152
|
+
log("Request successful")
|
|
153
|
+
data
|
|
154
|
+
rescue JSON::ParserError => e
|
|
155
|
+
raise APIError.new("Invalid JSON response: #{e.message}", response.status)
|
|
156
|
+
end
|
|
157
|
+
|
|
158
|
+
def log(message)
|
|
159
|
+
puts "[APIVerve::Techstackdetector] #{message}" if @debug
|
|
160
|
+
end
|
|
161
|
+
end
|
|
162
|
+
|
|
163
|
+
# Custom error class for API errors
|
|
164
|
+
class APIError < StandardError
|
|
165
|
+
attr_reader :status_code, :response
|
|
166
|
+
|
|
167
|
+
def initialize(message, status_code = nil, response = nil)
|
|
168
|
+
@status_code = status_code
|
|
169
|
+
@response = response
|
|
170
|
+
super(message)
|
|
171
|
+
end
|
|
172
|
+
end
|
|
173
|
+
|
|
174
|
+
# Custom error class for validation errors
|
|
175
|
+
class ValidationError < StandardError
|
|
176
|
+
attr_reader :errors
|
|
177
|
+
|
|
178
|
+
def initialize(errors)
|
|
179
|
+
@errors = errors
|
|
180
|
+
super("Validation failed: #{errors.join(' ')}")
|
|
181
|
+
end
|
|
182
|
+
end
|
|
183
|
+
end
|
|
184
|
+
end
|
metadata
ADDED
|
@@ -0,0 +1,102 @@
|
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
|
2
|
+
name: apiverve_techstackdetector
|
|
3
|
+
version: !ruby/object:Gem::Version
|
|
4
|
+
version: 1.2.2
|
|
5
|
+
platform: ruby
|
|
6
|
+
authors:
|
|
7
|
+
- APIVerve
|
|
8
|
+
autorequire:
|
|
9
|
+
bindir: bin
|
|
10
|
+
cert_chain: []
|
|
11
|
+
date: 2026-10-21 00:00:00.000000000 Z
|
|
12
|
+
dependencies:
|
|
13
|
+
- !ruby/object:Gem::Dependency
|
|
14
|
+
name: faraday
|
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
|
16
|
+
requirements:
|
|
17
|
+
- - ">="
|
|
18
|
+
- !ruby/object:Gem::Version
|
|
19
|
+
version: '1.0'
|
|
20
|
+
- - "<"
|
|
21
|
+
- !ruby/object:Gem::Version
|
|
22
|
+
version: '3.0'
|
|
23
|
+
type: :runtime
|
|
24
|
+
prerelease: false
|
|
25
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
26
|
+
requirements:
|
|
27
|
+
- - ">="
|
|
28
|
+
- !ruby/object:Gem::Version
|
|
29
|
+
version: '1.0'
|
|
30
|
+
- - "<"
|
|
31
|
+
- !ruby/object:Gem::Version
|
|
32
|
+
version: '3.0'
|
|
33
|
+
- !ruby/object:Gem::Dependency
|
|
34
|
+
name: faraday-multipart
|
|
35
|
+
requirement: !ruby/object:Gem::Requirement
|
|
36
|
+
requirements:
|
|
37
|
+
- - "~>"
|
|
38
|
+
- !ruby/object:Gem::Version
|
|
39
|
+
version: '1.0'
|
|
40
|
+
type: :runtime
|
|
41
|
+
prerelease: false
|
|
42
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
43
|
+
requirements:
|
|
44
|
+
- - "~>"
|
|
45
|
+
- !ruby/object:Gem::Version
|
|
46
|
+
version: '1.0'
|
|
47
|
+
- !ruby/object:Gem::Dependency
|
|
48
|
+
name: json
|
|
49
|
+
requirement: !ruby/object:Gem::Requirement
|
|
50
|
+
requirements:
|
|
51
|
+
- - "~>"
|
|
52
|
+
- !ruby/object:Gem::Version
|
|
53
|
+
version: '2.0'
|
|
54
|
+
type: :runtime
|
|
55
|
+
prerelease: false
|
|
56
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
57
|
+
requirements:
|
|
58
|
+
- - "~>"
|
|
59
|
+
- !ruby/object:Gem::Version
|
|
60
|
+
version: '2.0'
|
|
61
|
+
description: Website Tech Stack Detector identifies the technologies a website runs
|
|
62
|
+
on, such as its CMS, ecommerce platform, JavaScript framework, analytics, CDN and
|
|
63
|
+
hosting, with categories and a confidence score for each. Paid plans add detected
|
|
64
|
+
versions, CPE identifiers and a rendered mode that runs the page's JavaScript.
|
|
65
|
+
email:
|
|
66
|
+
- hello@apiverve.com
|
|
67
|
+
executables: []
|
|
68
|
+
extensions: []
|
|
69
|
+
extra_rdoc_files: []
|
|
70
|
+
files:
|
|
71
|
+
- LICENSE
|
|
72
|
+
- README.md
|
|
73
|
+
- lib/apiverve_techstackdetector.rb
|
|
74
|
+
- lib/apiverve_techstackdetector/client.rb
|
|
75
|
+
homepage: https://apiverve.com/marketplace/techstackdetector?utm_source=ruby&utm_medium=referral&utm_content=homepage
|
|
76
|
+
licenses:
|
|
77
|
+
- MIT
|
|
78
|
+
metadata:
|
|
79
|
+
homepage_uri: https://apiverve.com/marketplace/techstackdetector?utm_source=ruby&utm_medium=referral&utm_content=homepage
|
|
80
|
+
source_code_uri: https://github.com/apiverve/techstackdetector-API/tree/main/ruby
|
|
81
|
+
changelog_uri: https://apiverve.com/changelog
|
|
82
|
+
documentation_uri: https://docs.apiverve.com/ref/techstackdetector
|
|
83
|
+
post_install_message:
|
|
84
|
+
rdoc_options: []
|
|
85
|
+
require_paths:
|
|
86
|
+
- lib
|
|
87
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
|
88
|
+
requirements:
|
|
89
|
+
- - ">="
|
|
90
|
+
- !ruby/object:Gem::Version
|
|
91
|
+
version: 2.7.0
|
|
92
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
|
93
|
+
requirements:
|
|
94
|
+
- - ">="
|
|
95
|
+
- !ruby/object:Gem::Version
|
|
96
|
+
version: '0'
|
|
97
|
+
requirements: []
|
|
98
|
+
rubygems_version: 3.0.3.1
|
|
99
|
+
signing_key:
|
|
100
|
+
specification_version: 4
|
|
101
|
+
summary: Website Tech Stack Detector API - Ruby Client
|
|
102
|
+
test_files: []
|