peasy-compress 0.1.1 → 0.2.0
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 +4 -4
- data/lib/peasy_compress/client.rb +109 -0
- data/lib/peasy_compress/version.rb +1 -1
- data/lib/peasy_compress.rb +1 -0
- metadata +7 -3
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: a3f5156c74fa1a79e0ee63280e5c06fdaa9f0e334af8aab4f4669d94c275008a
|
|
4
|
+
data.tar.gz: ca59160e4ad247398c4a2469ba57ec487a1f284fecb2397dc9c6c8b4e08285f1
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 7e612d3649026ef14b435f613c892c45d7366ab4b5824bbb744d7b26113d79381704f835c2965b5d8e065dacc41b0f29245d882aa23292347bf317f11d0df13c
|
|
7
|
+
data.tar.gz: 8aec3dbb9b36c5f99f8cb87ebb8bcf8af6bd319c8ea4bf888668f30f6a06f0185906b93d7afe332e76c24df0e13930ef6ce06ad8f55ecaf5182bba2e59ace3e5
|
|
@@ -0,0 +1,109 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
require "net/http"
|
|
4
|
+
require "json"
|
|
5
|
+
require "uri"
|
|
6
|
+
|
|
7
|
+
module PeasyCompress
|
|
8
|
+
# REST API client for peasytools.com.
|
|
9
|
+
# Zero dependencies — uses Ruby stdlib only.
|
|
10
|
+
class Client
|
|
11
|
+
DEFAULT_BASE_URL = "https://peasytools.com"
|
|
12
|
+
|
|
13
|
+
def initialize(base_url: DEFAULT_BASE_URL)
|
|
14
|
+
@base_url = base_url.chomp("/")
|
|
15
|
+
end
|
|
16
|
+
|
|
17
|
+
# --- Tools ---
|
|
18
|
+
|
|
19
|
+
def list_tools(page: 1, limit: 50, category: nil, search: nil)
|
|
20
|
+
get("/api/v1/tools/", page: page, limit: limit, category: category, search: search)
|
|
21
|
+
end
|
|
22
|
+
|
|
23
|
+
def get_tool(slug)
|
|
24
|
+
get("/api/v1/tools/#{slug}/")
|
|
25
|
+
end
|
|
26
|
+
|
|
27
|
+
# --- Categories ---
|
|
28
|
+
|
|
29
|
+
def list_categories(page: 1, limit: 50)
|
|
30
|
+
get("/api/v1/categories/", page: page, limit: limit)
|
|
31
|
+
end
|
|
32
|
+
|
|
33
|
+
# --- Formats ---
|
|
34
|
+
|
|
35
|
+
def list_formats(page: 1, limit: 50, category: nil, search: nil)
|
|
36
|
+
get("/api/v1/formats/", page: page, limit: limit, category: category, search: search)
|
|
37
|
+
end
|
|
38
|
+
|
|
39
|
+
def get_format(slug)
|
|
40
|
+
get("/api/v1/formats/#{slug}/")
|
|
41
|
+
end
|
|
42
|
+
|
|
43
|
+
# --- Conversions ---
|
|
44
|
+
|
|
45
|
+
def list_conversions(page: 1, limit: 50, source: nil, target: nil)
|
|
46
|
+
get("/api/v1/conversions/", page: page, limit: limit, source: source, target: target)
|
|
47
|
+
end
|
|
48
|
+
|
|
49
|
+
# --- Glossary ---
|
|
50
|
+
|
|
51
|
+
def list_glossary(page: 1, limit: 50, category: nil, search: nil)
|
|
52
|
+
get("/api/v1/glossary/", page: page, limit: limit, category: category, search: search)
|
|
53
|
+
end
|
|
54
|
+
|
|
55
|
+
def get_glossary_term(slug)
|
|
56
|
+
get("/api/v1/glossary/#{slug}/")
|
|
57
|
+
end
|
|
58
|
+
|
|
59
|
+
# --- Guides ---
|
|
60
|
+
|
|
61
|
+
def list_guides(page: 1, limit: 50, category: nil, audience_level: nil, search: nil)
|
|
62
|
+
get("/api/v1/guides/", page: page, limit: limit, category: category,
|
|
63
|
+
audience_level: audience_level, search: search)
|
|
64
|
+
end
|
|
65
|
+
|
|
66
|
+
def get_guide(slug)
|
|
67
|
+
get("/api/v1/guides/#{slug}/")
|
|
68
|
+
end
|
|
69
|
+
|
|
70
|
+
# --- Use Cases ---
|
|
71
|
+
|
|
72
|
+
def list_use_cases(page: 1, limit: 50, industry: nil, search: nil)
|
|
73
|
+
get("/api/v1/use-cases/", page: page, limit: limit, industry: industry, search: search)
|
|
74
|
+
end
|
|
75
|
+
|
|
76
|
+
# --- Search ---
|
|
77
|
+
|
|
78
|
+
def search(query, limit: 20)
|
|
79
|
+
get("/api/v1/search/", q: query, limit: limit)
|
|
80
|
+
end
|
|
81
|
+
|
|
82
|
+
# --- Sites ---
|
|
83
|
+
|
|
84
|
+
def list_sites
|
|
85
|
+
get("/api/v1/sites/")
|
|
86
|
+
end
|
|
87
|
+
|
|
88
|
+
# --- OpenAPI ---
|
|
89
|
+
|
|
90
|
+
def openapi_spec
|
|
91
|
+
get("/api/openapi.json")
|
|
92
|
+
end
|
|
93
|
+
|
|
94
|
+
private
|
|
95
|
+
|
|
96
|
+
def get(path, **params)
|
|
97
|
+
uri = URI("#{@base_url}#{path}")
|
|
98
|
+
params.reject! { |_, v| v.nil? }
|
|
99
|
+
uri.query = URI.encode_www_form(params) unless params.empty?
|
|
100
|
+
response = Net::HTTP.get_response(uri)
|
|
101
|
+
body = JSON.parse(response.body)
|
|
102
|
+
unless response.is_a?(Net::HTTPSuccess)
|
|
103
|
+
detail = body.is_a?(Hash) ? body.fetch("detail", "Unknown error") : response.body
|
|
104
|
+
raise PeasyCompress::Error, "HTTP #{response.code}: #{detail}"
|
|
105
|
+
end
|
|
106
|
+
body
|
|
107
|
+
end
|
|
108
|
+
end
|
|
109
|
+
end
|
data/lib/peasy_compress.rb
CHANGED
metadata
CHANGED
|
@@ -1,13 +1,14 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: peasy-compress
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.
|
|
4
|
+
version: 0.2.0
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- PeasyTools
|
|
8
|
+
autorequire:
|
|
8
9
|
bindir: bin
|
|
9
10
|
cert_chain: []
|
|
10
|
-
date:
|
|
11
|
+
date: 2026-03-17 00:00:00.000000000 Z
|
|
11
12
|
dependencies: []
|
|
12
13
|
description: Compression library for Ruby — gzip, deflate, and zlib compression with
|
|
13
14
|
ratio calculation. Uses Ruby stdlib Zlib, zero external dependencies.
|
|
@@ -18,6 +19,7 @@ extensions: []
|
|
|
18
19
|
extra_rdoc_files: []
|
|
19
20
|
files:
|
|
20
21
|
- lib/peasy_compress.rb
|
|
22
|
+
- lib/peasy_compress/client.rb
|
|
21
23
|
- lib/peasy_compress/engine.rb
|
|
22
24
|
- lib/peasy_compress/version.rb
|
|
23
25
|
homepage: https://peasytools.com
|
|
@@ -29,6 +31,7 @@ metadata:
|
|
|
29
31
|
changelog_uri: https://github.com/peasytools/peasy-compress-rb/blob/main/CHANGELOG.md
|
|
30
32
|
documentation_uri: https://peasytools.com
|
|
31
33
|
bug_tracker_uri: https://github.com/peasytools/peasy-compress-rb/issues
|
|
34
|
+
post_install_message:
|
|
32
35
|
rdoc_options: []
|
|
33
36
|
require_paths:
|
|
34
37
|
- lib
|
|
@@ -43,7 +46,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
|
43
46
|
- !ruby/object:Gem::Version
|
|
44
47
|
version: '0'
|
|
45
48
|
requirements: []
|
|
46
|
-
rubygems_version:
|
|
49
|
+
rubygems_version: 3.0.3.1
|
|
50
|
+
signing_key:
|
|
47
51
|
specification_version: 4
|
|
48
52
|
summary: Compression — gzip, deflate, brotli
|
|
49
53
|
test_files: []
|