beerfyi 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.
Files changed (3) hide show
  1. checksums.yaml +7 -0
  2. data/lib/beerfyi.rb +143 -0
  3. metadata +46 -0
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA256:
3
+ metadata.gz: 071fdb9f15fd61143b6d63a3ec49549ee9eca23ea3aef98586e2b4ea8b8b2680
4
+ data.tar.gz: '08550c61d8cda38c4485c1356554c4aad29626d29de62f6765b019133a0f8eb8'
5
+ SHA512:
6
+ metadata.gz: 4bf0fd60a1c2d1ca2eb5629e70f0764e64f4bb58e6919cb52b32704503b922e7aefa68eeebc71242cf6eb93f691982c3b5483d8e4bfdedbdbf9df1e204e07992
7
+ data.tar.gz: 3aabfb3bf9dcc2e2b85ce5c6b3eecd530b83f2dd82746be9dea4d03b5bb51641b656e5483c60e69959287ffa967d2b498e7382385c882990c15a3b06068cd62b
data/lib/beerfyi.rb ADDED
@@ -0,0 +1,143 @@
1
+ # frozen_string_literal: true
2
+
3
+ require "net/http"
4
+ require "json"
5
+ require "uri"
6
+
7
+ # Ruby client for BeerFYI REST API (beerfyi.com).
8
+ #
9
+ # client = BeerFYI::Client.new
10
+ # result = client.search("query")
11
+ #
12
+ module BeerFYI
13
+ class Client
14
+ BASE_URL = "https://beerfyi.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 categories.
34
+ def list_categories
35
+ get("/api/v1/categories/")
36
+ end
37
+
38
+ # Get category by slug.
39
+ def get_category(slug)
40
+ get("/api/v1/categories/#{slug}/")
41
+ end
42
+ # List all countries.
43
+ def list_countries
44
+ get("/api/v1/countries/")
45
+ end
46
+
47
+ # Get country by slug.
48
+ def get_country(slug)
49
+ get("/api/v1/countries/#{slug}/")
50
+ end
51
+ # List all faqs.
52
+ def list_faqs
53
+ get("/api/v1/faqs/")
54
+ end
55
+
56
+ # Get faq by slug.
57
+ def get_faq(slug)
58
+ get("/api/v1/faqs/#{slug}/")
59
+ end
60
+ # List all glossary.
61
+ def list_glossary
62
+ get("/api/v1/glossary/")
63
+ end
64
+
65
+ # Get term by slug.
66
+ def get_term(slug)
67
+ get("/api/v1/glossary/#{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 hops.
79
+ def list_hops
80
+ get("/api/v1/hops/")
81
+ end
82
+
83
+ # Get hop by slug.
84
+ def get_hop(slug)
85
+ get("/api/v1/hops/#{slug}/")
86
+ end
87
+ # List all malts.
88
+ def list_malts
89
+ get("/api/v1/malts/")
90
+ end
91
+
92
+ # Get malt by slug.
93
+ def get_malt(slug)
94
+ get("/api/v1/malts/#{slug}/")
95
+ end
96
+ # List all regions.
97
+ def list_regions
98
+ get("/api/v1/regions/")
99
+ end
100
+
101
+ # Get region by slug.
102
+ def get_region(slug)
103
+ get("/api/v1/regions/#{slug}/")
104
+ end
105
+ # List all styles.
106
+ def list_styles
107
+ get("/api/v1/styles/")
108
+ end
109
+
110
+ # Get style by slug.
111
+ def get_style(slug)
112
+ get("/api/v1/styles/#{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 yeasts.
124
+ def list_yeasts
125
+ get("/api/v1/yeasts/")
126
+ end
127
+
128
+ # Get yeast by slug.
129
+ def get_yeast(slug)
130
+ get("/api/v1/yeasts/#{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
metadata ADDED
@@ -0,0 +1,46 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: beerfyi
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 BeerFYI REST API at beerfyi.com. Zero external dependencies.
14
+ email: dev@fyipedia.com
15
+ executables: []
16
+ extensions: []
17
+ extra_rdoc_files: []
18
+ files:
19
+ - lib/beerfyi.rb
20
+ homepage: https://beerfyi.com
21
+ licenses:
22
+ - MIT
23
+ metadata:
24
+ source_code_uri: https://github.com/fyipedia/beerfyi-rb
25
+ documentation_uri: https://beerfyi.com/api/v1/schema/
26
+ homepage_uri: https://beerfyi.com
27
+ post_install_message:
28
+ rdoc_options: []
29
+ require_paths:
30
+ - lib
31
+ required_ruby_version: !ruby/object:Gem::Requirement
32
+ requirements:
33
+ - - ">="
34
+ - !ruby/object:Gem::Version
35
+ version: '3.0'
36
+ required_rubygems_version: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - ">="
39
+ - !ruby/object:Gem::Version
40
+ version: '0'
41
+ requirements: []
42
+ rubygems_version: 3.0.3.1
43
+ signing_key:
44
+ specification_version: 4
45
+ summary: Ruby client for BeerFYI API
46
+ test_files: []