symbolfyi 0.1.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 +7 -0
- data/lib/symbolfyi.rb +107 -0
- metadata +47 -0
checksums.yaml
ADDED
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
---
|
|
2
|
+
SHA256:
|
|
3
|
+
metadata.gz: 6b31fe13bdd89ca8c18ebc274d50f12fc13e31c952db46739c9b8c1468c375b3
|
|
4
|
+
data.tar.gz: 2d1e6e50946e19b08cf9f5f460bfca4bd3893c04dc4b408be5f1d98d8fe3b5b7
|
|
5
|
+
SHA512:
|
|
6
|
+
metadata.gz: bd64837ce34cecc9b031e130bc541bafb59336f461604136edbb411311c36dea6db486529036e1d5cad082cbb8157078ec2dd6b07a75eb2acaad97a02f3fe089
|
|
7
|
+
data.tar.gz: 3c4eaec35a2e36775009d586280da55065c4883c88d902801c4bd8fd676cb98d4209b43bca4b298bc830857466af3a72cedc9a3fafe839a097325aac4ad02188
|
data/lib/symbolfyi.rb
ADDED
|
@@ -0,0 +1,107 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
require "net/http"
|
|
4
|
+
require "json"
|
|
5
|
+
require "uri"
|
|
6
|
+
|
|
7
|
+
# Ruby client for SymbolFYI REST API (symbolfyi.com).
|
|
8
|
+
#
|
|
9
|
+
# client = SymbolFYI::Client.new
|
|
10
|
+
# result = client.search("query")
|
|
11
|
+
#
|
|
12
|
+
module SymbolFYI
|
|
13
|
+
class Client
|
|
14
|
+
BASE_URL = "https://symbolfyi.com"
|
|
15
|
+
|
|
16
|
+
def initialize(base_url: BASE_URL)
|
|
17
|
+
@base_url = base_url
|
|
18
|
+
end
|
|
19
|
+
|
|
20
|
+
def search(query)
|
|
21
|
+
get("/api/v1/search/", q: query)
|
|
22
|
+
end
|
|
23
|
+
|
|
24
|
+
# List all categories.
|
|
25
|
+
def list_categories
|
|
26
|
+
get("/api/v1/categories/")
|
|
27
|
+
end
|
|
28
|
+
|
|
29
|
+
# Get category by slug.
|
|
30
|
+
def get_category(slug)
|
|
31
|
+
get("/api/v1/categories/#{slug}/")
|
|
32
|
+
end
|
|
33
|
+
# List all collections.
|
|
34
|
+
def list_collections
|
|
35
|
+
get("/api/v1/collections/")
|
|
36
|
+
end
|
|
37
|
+
|
|
38
|
+
# Get collection by slug.
|
|
39
|
+
def get_collection(slug)
|
|
40
|
+
get("/api/v1/collections/#{slug}/")
|
|
41
|
+
end
|
|
42
|
+
# List all faqs.
|
|
43
|
+
def list_faqs
|
|
44
|
+
get("/api/v1/faqs/")
|
|
45
|
+
end
|
|
46
|
+
|
|
47
|
+
# Get faq by slug.
|
|
48
|
+
def get_faq(slug)
|
|
49
|
+
get("/api/v1/faqs/#{slug}/")
|
|
50
|
+
end
|
|
51
|
+
# List all glossary.
|
|
52
|
+
def list_glossary
|
|
53
|
+
get("/api/v1/glossary/")
|
|
54
|
+
end
|
|
55
|
+
|
|
56
|
+
# Get term by slug.
|
|
57
|
+
def get_term(slug)
|
|
58
|
+
get("/api/v1/glossary/#{slug}/")
|
|
59
|
+
end
|
|
60
|
+
# List all guide categories.
|
|
61
|
+
def list_guide_categories
|
|
62
|
+
get("/api/v1/guide-categories/")
|
|
63
|
+
end
|
|
64
|
+
|
|
65
|
+
# Get guide category by slug.
|
|
66
|
+
def get_guide_category(slug)
|
|
67
|
+
get("/api/v1/guide-categories/#{slug}/")
|
|
68
|
+
end
|
|
69
|
+
# List all guide series.
|
|
70
|
+
def list_guide_series
|
|
71
|
+
get("/api/v1/guide-series/")
|
|
72
|
+
end
|
|
73
|
+
|
|
74
|
+
# Get guide sery by slug.
|
|
75
|
+
def get_guide_sery(slug)
|
|
76
|
+
get("/api/v1/guide-series/#{slug}/")
|
|
77
|
+
end
|
|
78
|
+
# List all guides.
|
|
79
|
+
def list_guides
|
|
80
|
+
get("/api/v1/guides/")
|
|
81
|
+
end
|
|
82
|
+
|
|
83
|
+
# Get guide by slug.
|
|
84
|
+
def get_guide(slug)
|
|
85
|
+
get("/api/v1/guides/#{slug}/")
|
|
86
|
+
end
|
|
87
|
+
# List all symbols.
|
|
88
|
+
def list_symbols
|
|
89
|
+
get("/api/v1/symbols/")
|
|
90
|
+
end
|
|
91
|
+
|
|
92
|
+
# Get symbol by slug.
|
|
93
|
+
def get_symbol(slug)
|
|
94
|
+
get("/api/v1/symbols/#{slug}/")
|
|
95
|
+
end
|
|
96
|
+
|
|
97
|
+
private
|
|
98
|
+
|
|
99
|
+
def get(path, **params)
|
|
100
|
+
uri = URI.join(@base_url, path)
|
|
101
|
+
uri.query = URI.encode_www_form(params) unless params.empty?
|
|
102
|
+
response = Net::HTTP.get_response(uri)
|
|
103
|
+
raise "HTTP #{response.code}" unless response.is_a?(Net::HTTPSuccess)
|
|
104
|
+
JSON.parse(response.body)
|
|
105
|
+
end
|
|
106
|
+
end
|
|
107
|
+
end
|
metadata
ADDED
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
|
2
|
+
name: symbolfyi
|
|
3
|
+
version: !ruby/object:Gem::Version
|
|
4
|
+
version: 0.1.0
|
|
5
|
+
platform: ruby
|
|
6
|
+
authors:
|
|
7
|
+
- FYIPedia
|
|
8
|
+
autorequire:
|
|
9
|
+
bindir: bin
|
|
10
|
+
cert_chain: []
|
|
11
|
+
date: 2026-03-21 00:00:00.000000000 Z
|
|
12
|
+
dependencies: []
|
|
13
|
+
description: Ruby client for the SymbolFYI REST API at symbolfyi.com. Zero external
|
|
14
|
+
dependencies.
|
|
15
|
+
email: dev@fyipedia.com
|
|
16
|
+
executables: []
|
|
17
|
+
extensions: []
|
|
18
|
+
extra_rdoc_files: []
|
|
19
|
+
files:
|
|
20
|
+
- lib/symbolfyi.rb
|
|
21
|
+
homepage: https://symbolfyi.com
|
|
22
|
+
licenses:
|
|
23
|
+
- MIT
|
|
24
|
+
metadata:
|
|
25
|
+
source_code_uri: https://github.com/fyipedia/symbolfyi-rb
|
|
26
|
+
documentation_uri: https://symbolfyi.com/api/v1/schema/
|
|
27
|
+
homepage_uri: https://symbolfyi.com
|
|
28
|
+
post_install_message:
|
|
29
|
+
rdoc_options: []
|
|
30
|
+
require_paths:
|
|
31
|
+
- lib
|
|
32
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
|
33
|
+
requirements:
|
|
34
|
+
- - ">="
|
|
35
|
+
- !ruby/object:Gem::Version
|
|
36
|
+
version: '3.0'
|
|
37
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
|
38
|
+
requirements:
|
|
39
|
+
- - ">="
|
|
40
|
+
- !ruby/object:Gem::Version
|
|
41
|
+
version: '0'
|
|
42
|
+
requirements: []
|
|
43
|
+
rubygems_version: 3.0.3.1
|
|
44
|
+
signing_key:
|
|
45
|
+
specification_version: 4
|
|
46
|
+
summary: Ruby client for SymbolFYI API
|
|
47
|
+
test_files: []
|