nihonshufyi 0.1.0 → 0.1.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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: cf463985e299af78d16602ff7e3b4c4023666196f6fe8d91d3c0d1d61a6362a5
4
- data.tar.gz: 57da5588b83e77c2c4cd7cb7542527d85e464487c0937a557970fe0083f1ab6b
3
+ metadata.gz: 88613b70e7f5f0480e728ef5afcf48c5d9d5dfa8b9e6d380dfa9aad0c9adbc3d
4
+ data.tar.gz: 32d5c549a26a2f8f0f7b5fc1cc18c8c3172e7cc0b5a995e67a90e15bef90ef33
5
5
  SHA512:
6
- metadata.gz: f5ff0d7205d4cd5e24642f248243d853bae78007751ba109028064948dea10a737fb6d032108b4119566fbce7977f673e0c8f4956f125d042229df5cf7f81326
7
- data.tar.gz: c7d7b069c3ac3081114991333d5e01fc344f427c8ed57bf3d7eea0a5a7fa51073cf92b36b788d7317f2eed9e6cde4144523571bc60c78a5c779ebedb56083b39
6
+ metadata.gz: 641a650971a165d306a31bf7ae2c52ade6454fbf3c33aa1d446d30b24ec0394cfeb3c016c9c71c0df3821c250b81a38a5ac56c97329838c6c003606fd7e146a6
7
+ data.tar.gz: 53ad4ce3ef398c7df9841fe51a2cf6e80e01fb6d95db5c956fca8c2985a913bb35b4bd2a9ebb3af3e6f984d6fb4dd81e5b976846dd1caee75a99cac19a585bdf
@@ -0,0 +1,48 @@
1
+ # frozen_string_literal: true
2
+
3
+ require "net/http"
4
+ require "json"
5
+ require "uri"
6
+
7
+ module NihonshuFYI
8
+ class Client
9
+ DEFAULT_BASE_URL = "https://nihonshufyi.com/api"
10
+
11
+ def initialize(base_url: DEFAULT_BASE_URL)
12
+ @base_url = base_url
13
+ end
14
+
15
+ def search(query)
16
+ get("/search/", q: query)
17
+ end
18
+
19
+ def entity(slug)
20
+ get("/sake/#{slug}/")
21
+ end
22
+
23
+ def glossary_term(slug)
24
+ get("/glossary/#{slug}/")
25
+ end
26
+
27
+ def random
28
+ get("/random/")
29
+ end
30
+
31
+ private
32
+
33
+ def get(path, params = {})
34
+ uri = URI("#{@base_url}#{path}")
35
+ uri.query = URI.encode_www_form(params) unless params.empty?
36
+
37
+ response = Net::HTTP.get_response(uri)
38
+
39
+ unless response.is_a?(Net::HTTPSuccess)
40
+ raise Error, "HTTP #{response.code}: #{response.body}"
41
+ end
42
+
43
+ JSON.parse(response.body, symbolize_names: true)
44
+ end
45
+ end
46
+
47
+ class Error < StandardError; end
48
+ end
@@ -0,0 +1,5 @@
1
+ # frozen_string_literal: true
2
+
3
+ module NihonshuFYI
4
+ VERSION = "0.1.1"
5
+ end
data/lib/nihonshufyi.rb CHANGED
@@ -1,143 +1,4 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require "net/http"
4
- require "json"
5
- require "uri"
6
-
7
- # Ruby client for NihonshuFYI REST API (nihonshufyi.com).
8
- #
9
- # client = NihonshuFYI::Client.new
10
- # result = client.search("query")
11
- #
12
- module NihonshuFYI
13
- class Client
14
- BASE_URL = "https://nihonshufyi.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 breweries.
25
- def list_breweries
26
- get("/api/v1/breweries/")
27
- end
28
-
29
- # Get brewery by slug.
30
- def get_brewery(slug)
31
- get("/api/v1/breweries/#{slug}/")
32
- end
33
- # List all faqs.
34
- def list_faqs
35
- get("/api/v1/faqs/")
36
- end
37
-
38
- # Get faq by slug.
39
- def get_faq(slug)
40
- get("/api/v1/faqs/#{slug}/")
41
- end
42
- # List all glossary.
43
- def list_glossary
44
- get("/api/v1/glossary/")
45
- end
46
-
47
- # Get term by slug.
48
- def get_term(slug)
49
- get("/api/v1/glossary/#{slug}/")
50
- end
51
- # List all glossary categories.
52
- def list_glossary_categories
53
- get("/api/v1/glossary-categories/")
54
- end
55
-
56
- # Get glossary category by slug.
57
- def get_glossary_category(slug)
58
- get("/api/v1/glossary-categories/#{slug}/")
59
- end
60
- # List all grades.
61
- def list_grades
62
- get("/api/v1/grades/")
63
- end
64
-
65
- # Get grade by slug.
66
- def get_grade(slug)
67
- get("/api/v1/grades/#{slug}/")
68
- end
69
- # List all guides.
70
- def list_guides
71
- get("/api/v1/guides/")
72
- end
73
-
74
- # Get guide by slug.
75
- def get_guide(slug)
76
- get("/api/v1/guides/#{slug}/")
77
- end
78
- # List all prefectures.
79
- def list_prefectures
80
- get("/api/v1/prefectures/")
81
- end
82
-
83
- # Get prefecture by slug.
84
- def get_prefecture(slug)
85
- get("/api/v1/prefectures/#{slug}/")
86
- end
87
- # List all rice.
88
- def list_rice
89
- get("/api/v1/rice/")
90
- end
91
-
92
- # Get rice by slug.
93
- def get_rice(slug)
94
- get("/api/v1/rice/#{slug}/")
95
- end
96
- # List all sake.
97
- def list_sake
98
- get("/api/v1/sake/")
99
- end
100
-
101
- # Get sake by slug.
102
- def get_sake(slug)
103
- get("/api/v1/sake/#{slug}/")
104
- end
105
- # List all serving.
106
- def list_serving
107
- get("/api/v1/serving/")
108
- end
109
-
110
- # Get serving by slug.
111
- def get_serving(slug)
112
- get("/api/v1/serving/#{slug}/")
113
- end
114
- # List all tools.
115
- def list_tools
116
- get("/api/v1/tools/")
117
- end
118
-
119
- # Get tool by slug.
120
- def get_tool(slug)
121
- get("/api/v1/tools/#{slug}/")
122
- end
123
- # List all yeast.
124
- def list_yeast
125
- get("/api/v1/yeast/")
126
- end
127
-
128
- # Get yeast by slug.
129
- def get_yeast(slug)
130
- get("/api/v1/yeast/#{slug}/")
131
- end
132
-
133
- private
134
-
135
- def get(path, **params)
136
- uri = URI.join(@base_url, path)
137
- uri.query = URI.encode_www_form(params) unless params.empty?
138
- response = Net::HTTP.get_response(uri)
139
- raise "HTTP #{response.code}" unless response.is_a?(Net::HTTPSuccess)
140
- JSON.parse(response.body)
141
- end
142
- end
143
- end
3
+ require_relative "nihonshufyi/version"
4
+ require_relative "nihonshufyi/client"
metadata CHANGED
@@ -1,30 +1,35 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: nihonshufyi
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0
4
+ version: 0.1.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - FYIPedia
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2026-03-21 00:00:00.000000000 Z
11
+ date: 2026-03-30 00:00:00.000000000 Z
12
12
  dependencies: []
13
- description: Ruby client for the NihonshuFYI REST API at nihonshufyi.com. Zero external
14
- dependencies.
15
- email: dev@fyipedia.com
13
+ description: API client for nihonshufyi.com. Sake guide with rice varieties, breweries,
14
+ and tasting notes. Zero dependencies.
15
+ email:
16
+ - hello@fyipedia.com
16
17
  executables: []
17
18
  extensions: []
18
19
  extra_rdoc_files: []
19
20
  files:
20
21
  - lib/nihonshufyi.rb
22
+ - lib/nihonshufyi/client.rb
23
+ - lib/nihonshufyi/version.rb
21
24
  homepage: https://nihonshufyi.com
22
25
  licenses:
23
26
  - MIT
24
27
  metadata:
25
- source_code_uri: https://github.com/fyipedia/nihonshufyi-rb
26
- documentation_uri: https://nihonshufyi.com/api/v1/schema/
27
28
  homepage_uri: https://nihonshufyi.com
29
+ source_code_uri: https://github.com/fyipedia/nihonshufyi-rb
30
+ changelog_uri: https://github.com/fyipedia/nihonshufyi-rb/blob/main/CHANGELOG.md
31
+ documentation_uri: https://nihonshufyi.com/developers/
32
+ bug_tracker_uri: https://github.com/fyipedia/nihonshufyi-rb/issues
28
33
  post_install_message:
29
34
  rdoc_options: []
30
35
  require_paths:
@@ -43,5 +48,5 @@ requirements: []
43
48
  rubygems_version: 3.0.3.1
44
49
  signing_key:
45
50
  specification_version: 4
46
- summary: Ruby client for NihonshuFYI API
51
+ summary: Sake guide with rice varieties, breweries, and tasting notes
47
52
  test_files: []