vinofyi 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: ced4a419d126a4cd81222f4c9ff3ba22c3c423599bb507442410f75fd8811c3e
4
- data.tar.gz: 5dc2d94aa1c311f7e72481203138217c89bc0dd45a05898a880b67b6714f2773
3
+ metadata.gz: 4e1d649097896ad3da1832ed1bc482d3c888e9d3ed573c51f46183c2846f040e
4
+ data.tar.gz: c994778cb514ee8dec41941d15bf88873331fb4952f45237f8eb90c807473c0b
5
5
  SHA512:
6
- metadata.gz: 43f5c9a1ade482758e2f597665f333bea1117905e92559ee02f07c319b3678d0e0b8442207ca3fa2291f9cb6284f00c3a9f6ba6b51cb3d647eee0fc4d342cc9e
7
- data.tar.gz: 2f00d0c9b7533f962d0bb6ab265533479715bca3c56767400be831d29ae278a2b75c5d7ef02ea11fef08851bb494441d3badece21671ba4795984e5aa81361ad
6
+ metadata.gz: ffeb7fc9c3acd8bb2eb0b7fc2b07bfd5f04d249d0005f1102d48e3e24cda04a3e7b95c6c6b253d224c52d049de7a2f491d1f43685edbb842b26ef26aecfe8792
7
+ data.tar.gz: 4eee06041e696cef4f01dd4e928cc732907fc041702f5ef95bec416cd3a156ee33795ab95272fe82c8864808ce3603e0695432988aba24264823f58671ce452d
@@ -0,0 +1,48 @@
1
+ # frozen_string_literal: true
2
+
3
+ require "net/http"
4
+ require "json"
5
+ require "uri"
6
+
7
+ module VinoFYI
8
+ class Client
9
+ DEFAULT_BASE_URL = "https://vinofyi.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("/wine/#{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 VinoFYI
4
+ VERSION = "0.1.1"
5
+ end
data/lib/vinofyi.rb CHANGED
@@ -1,152 +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 VinoFYI REST API (vinofyi.com).
8
- #
9
- # client = VinoFYI::Client.new
10
- # result = client.search("query")
11
- #
12
- module VinoFYI
13
- class Client
14
- BASE_URL = "https://vinofyi.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 countries.
25
- def list_countries
26
- get("/api/v1/countries/")
27
- end
28
-
29
- # Get country by slug.
30
- def get_country(slug)
31
- get("/api/v1/countries/#{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 faults.
43
- def list_faults
44
- get("/api/v1/faults/")
45
- end
46
-
47
- # Get fault by slug.
48
- def get_fault(slug)
49
- get("/api/v1/faults/#{slug}/")
50
- end
51
- # List all flavors.
52
- def list_flavors
53
- get("/api/v1/flavors/")
54
- end
55
-
56
- # Get flavor by slug.
57
- def get_flavor(slug)
58
- get("/api/v1/flavors/#{slug}/")
59
- end
60
- # List all foods.
61
- def list_foods
62
- get("/api/v1/foods/")
63
- end
64
-
65
- # Get food by slug.
66
- def get_food(slug)
67
- get("/api/v1/foods/#{slug}/")
68
- end
69
- # List all glossary.
70
- def list_glossary
71
- get("/api/v1/glossary/")
72
- end
73
-
74
- # Get term by slug.
75
- def get_term(slug)
76
- get("/api/v1/glossary/#{slug}/")
77
- end
78
- # List all grapes.
79
- def list_grapes
80
- get("/api/v1/grapes/")
81
- end
82
-
83
- # Get grape by slug.
84
- def get_grape(slug)
85
- get("/api/v1/grapes/#{slug}/")
86
- end
87
- # List all guides.
88
- def list_guides
89
- get("/api/v1/guides/")
90
- end
91
-
92
- # Get guide by slug.
93
- def get_guide(slug)
94
- get("/api/v1/guides/#{slug}/")
95
- end
96
- # List all methods.
97
- def list_methods
98
- get("/api/v1/methods/")
99
- end
100
-
101
- # Get method by slug.
102
- def get_method(slug)
103
- get("/api/v1/methods/#{slug}/")
104
- end
105
- # List all regions.
106
- def list_regions
107
- get("/api/v1/regions/")
108
- end
109
-
110
- # Get region by slug.
111
- def get_region(slug)
112
- get("/api/v1/regions/#{slug}/")
113
- end
114
- # List all styles.
115
- def list_styles
116
- get("/api/v1/styles/")
117
- end
118
-
119
- # Get style by slug.
120
- def get_style(slug)
121
- get("/api/v1/styles/#{slug}/")
122
- end
123
- # List all wineries.
124
- def list_wineries
125
- get("/api/v1/wineries/")
126
- end
127
-
128
- # Get winery by slug.
129
- def get_winery(slug)
130
- get("/api/v1/wineries/#{slug}/")
131
- end
132
- # List all wines.
133
- def list_wines
134
- get("/api/v1/wines/")
135
- end
136
-
137
- # Get wine by slug.
138
- def get_wine(slug)
139
- get("/api/v1/wines/#{slug}/")
140
- end
141
-
142
- private
143
-
144
- def get(path, **params)
145
- uri = URI.join(@base_url, path)
146
- uri.query = URI.encode_www_form(params) unless params.empty?
147
- response = Net::HTTP.get_response(uri)
148
- raise "HTTP #{response.code}" unless response.is_a?(Net::HTTPSuccess)
149
- JSON.parse(response.body)
150
- end
151
- end
152
- end
3
+ require_relative "vinofyi/version"
4
+ require_relative "vinofyi/client"
metadata CHANGED
@@ -1,29 +1,35 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: vinofyi
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 VinoFYI REST API at vinofyi.com. Zero external dependencies.
14
- email: dev@fyipedia.com
13
+ description: API client for vinofyi.com. Wine encyclopedia with grapes, regions, and
14
+ food pairings. Zero dependencies.
15
+ email:
16
+ - hello@fyipedia.com
15
17
  executables: []
16
18
  extensions: []
17
19
  extra_rdoc_files: []
18
20
  files:
19
21
  - lib/vinofyi.rb
22
+ - lib/vinofyi/client.rb
23
+ - lib/vinofyi/version.rb
20
24
  homepage: https://vinofyi.com
21
25
  licenses:
22
26
  - MIT
23
27
  metadata:
24
- source_code_uri: https://github.com/fyipedia/vinofyi-rb
25
- documentation_uri: https://vinofyi.com/api/v1/schema/
26
28
  homepage_uri: https://vinofyi.com
29
+ source_code_uri: https://github.com/fyipedia/vinofyi-rb
30
+ changelog_uri: https://github.com/fyipedia/vinofyi-rb/blob/main/CHANGELOG.md
31
+ documentation_uri: https://vinofyi.com/developers/
32
+ bug_tracker_uri: https://github.com/fyipedia/vinofyi-rb/issues
27
33
  post_install_message:
28
34
  rdoc_options: []
29
35
  require_paths:
@@ -42,5 +48,5 @@ requirements: []
42
48
  rubygems_version: 3.0.3.1
43
49
  signing_key:
44
50
  specification_version: 4
45
- summary: Ruby client for VinoFYI API
51
+ summary: Wine encyclopedia with grapes, regions, and food pairings
46
52
  test_files: []