peasy-document 0.1.1 → 0.2.1
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_document/client.rb +109 -0
- data/lib/peasy_document/version.rb +1 -1
- data/lib/peasy_document.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: 19e11925157cfec797fd475525237e491f68557181e3ed1a84af1326a2c53ccb
|
|
4
|
+
data.tar.gz: 1de352f0da3cb64b761bf2efc76bf467f8e2a6e3097d843379025de60d9e6458
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 03e375d53597e1b0e6de4e1576be0e2a4110c028c30ad111afe68baa71ed1787bc6fe13cf9a39dade9d12879af4974c6684b2d35db2bdba200815b1b3cb7a7f3
|
|
7
|
+
data.tar.gz: 353db88cb409c49db7bc9683583c5519f3e02ce06abfc35cab79cd138585d0bde00c464026573c23069b8fde921fe581e36f59530ae91ad53a9e128733b6410c
|
|
@@ -0,0 +1,109 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
require "net/http"
|
|
4
|
+
require "json"
|
|
5
|
+
require "uri"
|
|
6
|
+
|
|
7
|
+
module PeasyDocument
|
|
8
|
+
# REST API client for peasyformats.com.
|
|
9
|
+
# Zero dependencies — uses Ruby stdlib only.
|
|
10
|
+
class Client
|
|
11
|
+
DEFAULT_BASE_URL = "https://peasyformats.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 PeasyDocument::Error, "HTTP #{response.code}: #{detail}"
|
|
105
|
+
end
|
|
106
|
+
body
|
|
107
|
+
end
|
|
108
|
+
end
|
|
109
|
+
end
|
data/lib/peasy_document.rb
CHANGED
metadata
CHANGED
|
@@ -1,13 +1,14 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: peasy-document
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.
|
|
4
|
+
version: 0.2.1
|
|
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-18 00:00:00.000000000 Z
|
|
11
12
|
dependencies: []
|
|
12
13
|
description: Document conversion library for Ruby — convert between Markdown, HTML,
|
|
13
14
|
CSV, JSON, and YAML formats. Uses Ruby stdlib (csv, json, yaml), zero external dependencies.
|
|
@@ -18,6 +19,7 @@ extensions: []
|
|
|
18
19
|
extra_rdoc_files: []
|
|
19
20
|
files:
|
|
20
21
|
- lib/peasy_document.rb
|
|
22
|
+
- lib/peasy_document/client.rb
|
|
21
23
|
- lib/peasy_document/engine.rb
|
|
22
24
|
- lib/peasy_document/version.rb
|
|
23
25
|
homepage: https://peasytools.com
|
|
@@ -29,6 +31,7 @@ metadata:
|
|
|
29
31
|
changelog_uri: https://github.com/peasytools/peasy-document-rb/blob/main/CHANGELOG.md
|
|
30
32
|
documentation_uri: https://peasytools.com
|
|
31
33
|
bug_tracker_uri: https://github.com/peasytools/peasy-document-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: Document conversion — Markdown, HTML, CSV, JSON, YAML
|
|
49
53
|
test_files: []
|