boardgamefyi 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/boardgamefyi.rb +161 -0
  3. metadata +47 -0
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA256:
3
+ metadata.gz: d1032faac9bf8cc0083a3cc5b8d6932214fa694d4f42ad4bdc23f84331ee3eb7
4
+ data.tar.gz: 26969c68410405721454e18d5291c0ef03a91ed21dcd858f2fb06ef6322fe883
5
+ SHA512:
6
+ metadata.gz: c8951e52a30f5f2599993c5937e5d4ebea4a8c21a6474a5f5e6b5af3dd3e74badf0d408a86324deab617f07239780f9a547a3fa76d0ef62b75eaaf25a484ba07
7
+ data.tar.gz: 75e1f17690fd95f76e852fbe53763c8f3d5e4f8c4910dc3bd60fe7196bece8bd56a4189027408d9b759232ca7143cdfbcfdde327f65fa8081c94360eb14917eb
@@ -0,0 +1,161 @@
1
+ # frozen_string_literal: true
2
+
3
+ require "net/http"
4
+ require "json"
5
+ require "uri"
6
+
7
+ # Ruby client for BoardGameFYI REST API (boardgamefyi.com).
8
+ #
9
+ # client = BoardGameFYI::Client.new
10
+ # result = client.search("query")
11
+ #
12
+ module BoardGameFYI
13
+ class Client
14
+ BASE_URL = "https://boardgamefyi.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 artists.
25
+ def list_artists
26
+ get("/api/v1/artists/")
27
+ end
28
+
29
+ # Get artist by slug.
30
+ def get_artist(slug)
31
+ get("/api/v1/artists/#{slug}/")
32
+ end
33
+ # List all awards.
34
+ def list_awards
35
+ get("/api/v1/awards/")
36
+ end
37
+
38
+ # Get award by slug.
39
+ def get_award(slug)
40
+ get("/api/v1/awards/#{slug}/")
41
+ end
42
+ # List all categories.
43
+ def list_categories
44
+ get("/api/v1/categories/")
45
+ end
46
+
47
+ # Get category by slug.
48
+ def get_category(slug)
49
+ get("/api/v1/categories/#{slug}/")
50
+ end
51
+ # List all designers.
52
+ def list_designers
53
+ get("/api/v1/designers/")
54
+ end
55
+
56
+ # Get designer by slug.
57
+ def get_designer(slug)
58
+ get("/api/v1/designers/#{slug}/")
59
+ end
60
+ # List all faqs.
61
+ def list_faqs
62
+ get("/api/v1/faqs/")
63
+ end
64
+
65
+ # Get faq by slug.
66
+ def get_faq(slug)
67
+ get("/api/v1/faqs/#{slug}/")
68
+ end
69
+ # List all game night themes.
70
+ def list_game_night_themes
71
+ get("/api/v1/game-night-themes/")
72
+ end
73
+
74
+ # Get game night theme by slug.
75
+ def get_game_night_theme(slug)
76
+ get("/api/v1/game-night-themes/#{slug}/")
77
+ end
78
+ # List all games.
79
+ def list_games
80
+ get("/api/v1/games/")
81
+ end
82
+
83
+ # Get game by slug.
84
+ def get_game(slug)
85
+ get("/api/v1/games/#{slug}/")
86
+ end
87
+ # List all glossary.
88
+ def list_glossary
89
+ get("/api/v1/glossary/")
90
+ end
91
+
92
+ # Get term by slug.
93
+ def get_term(slug)
94
+ get("/api/v1/glossary/#{slug}/")
95
+ end
96
+ # List all guide series.
97
+ def list_guide_series
98
+ get("/api/v1/guide-series/")
99
+ end
100
+
101
+ # Get guide sery by slug.
102
+ def get_guide_sery(slug)
103
+ get("/api/v1/guide-series/#{slug}/")
104
+ end
105
+ # List all guides.
106
+ def list_guides
107
+ get("/api/v1/guides/")
108
+ end
109
+
110
+ # Get guide by slug.
111
+ def get_guide(slug)
112
+ get("/api/v1/guides/#{slug}/")
113
+ end
114
+ # List all mechanics.
115
+ def list_mechanics
116
+ get("/api/v1/mechanics/")
117
+ end
118
+
119
+ # Get mechanic by slug.
120
+ def get_mechanic(slug)
121
+ get("/api/v1/mechanics/#{slug}/")
122
+ end
123
+ # List all progression paths.
124
+ def list_progression_paths
125
+ get("/api/v1/progression-paths/")
126
+ end
127
+
128
+ # Get progression path by slug.
129
+ def get_progression_path(slug)
130
+ get("/api/v1/progression-paths/#{slug}/")
131
+ end
132
+ # List all publishers.
133
+ def list_publishers
134
+ get("/api/v1/publishers/")
135
+ end
136
+
137
+ # Get publisher by slug.
138
+ def get_publisher(slug)
139
+ get("/api/v1/publishers/#{slug}/")
140
+ end
141
+ # List all tools.
142
+ def list_tools
143
+ get("/api/v1/tools/")
144
+ end
145
+
146
+ # Get tool by slug.
147
+ def get_tool(slug)
148
+ get("/api/v1/tools/#{slug}/")
149
+ end
150
+
151
+ private
152
+
153
+ def get(path, **params)
154
+ uri = URI.join(@base_url, path)
155
+ uri.query = URI.encode_www_form(params) unless params.empty?
156
+ response = Net::HTTP.get_response(uri)
157
+ raise "HTTP #{response.code}" unless response.is_a?(Net::HTTPSuccess)
158
+ JSON.parse(response.body)
159
+ end
160
+ end
161
+ end
metadata ADDED
@@ -0,0 +1,47 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: boardgamefyi
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 BoardGameFYI REST API at boardgamefyi.com. Zero external
14
+ dependencies.
15
+ email: dev@fyipedia.com
16
+ executables: []
17
+ extensions: []
18
+ extra_rdoc_files: []
19
+ files:
20
+ - lib/boardgamefyi.rb
21
+ homepage: https://boardgamefyi.com
22
+ licenses:
23
+ - MIT
24
+ metadata:
25
+ source_code_uri: https://github.com/fyipedia/boardgamefyi-rb
26
+ documentation_uri: https://boardgamefyi.com/api/v1/schema/
27
+ homepage_uri: https://boardgamefyi.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 BoardGameFYI API
47
+ test_files: []