fishfyi 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/fishfyi.rb +161 -0
  3. metadata +46 -0
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA256:
3
+ metadata.gz: 5120437ea2b7e29a81038697e0b79b178039fceaf1507fb0b02515a307a1fb98
4
+ data.tar.gz: 0206bfd9e9d87b6cd8d4f4dac0e784cf6524938ec9c0e0c97c4b7310f9caef1a
5
+ SHA512:
6
+ metadata.gz: 4bba80b36aa5d67bab270b0a6ffe1bf9246dd80a63c9e1856514732a2354f52cfb26249a04778bd427769b143efda64d604e48558bc424648cafdce577b50451
7
+ data.tar.gz: 724c6c39d59d4519bfaf0764c8dc81a97351378edcc63477b7646e82571d4a960498b1edcf6fbea48e26a02ad769e7267017d6a5d54524c0dfaebb6bce73d97c
data/lib/fishfyi.rb ADDED
@@ -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 FishFYI REST API (fishfyi.com).
8
+ #
9
+ # client = FishFYI::Client.new
10
+ # result = client.search("query")
11
+ #
12
+ module FishFYI
13
+ class Client
14
+ BASE_URL = "https://fishfyi.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 compatibility.
25
+ def list_compatibility
26
+ get("/api/v1/compatibility/")
27
+ end
28
+
29
+ # Get compatibility by slug.
30
+ def get_compatibility(slug)
31
+ get("/api/v1/compatibility/#{slug}/")
32
+ end
33
+ # List all countries.
34
+ def list_countries
35
+ get("/api/v1/countries/")
36
+ end
37
+
38
+ # Get country by slug.
39
+ def get_country(slug)
40
+ get("/api/v1/countries/#{slug}/")
41
+ end
42
+ # List all families.
43
+ def list_families
44
+ get("/api/v1/families/")
45
+ end
46
+
47
+ # Get family by slug.
48
+ def get_family(slug)
49
+ get("/api/v1/families/#{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 fish.
61
+ def list_fish
62
+ get("/api/v1/fish/")
63
+ end
64
+
65
+ # Get fish by slug.
66
+ def get_fish(slug)
67
+ get("/api/v1/fish/#{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 glossary categories.
79
+ def list_glossary_categories
80
+ get("/api/v1/glossary-categories/")
81
+ end
82
+
83
+ # Get glossary category by slug.
84
+ def get_glossary_category(slug)
85
+ get("/api/v1/glossary-categories/#{slug}/")
86
+ end
87
+ # List all guide series.
88
+ def list_guide_series
89
+ get("/api/v1/guide-series/")
90
+ end
91
+
92
+ # Get guide sery by slug.
93
+ def get_guide_sery(slug)
94
+ get("/api/v1/guide-series/#{slug}/")
95
+ end
96
+ # List all guides.
97
+ def list_guides
98
+ get("/api/v1/guides/")
99
+ end
100
+
101
+ # Get guide by slug.
102
+ def get_guide(slug)
103
+ get("/api/v1/guides/#{slug}/")
104
+ end
105
+ # List all methods.
106
+ def list_methods
107
+ get("/api/v1/methods/")
108
+ end
109
+
110
+ # Get method by slug.
111
+ def get_method(slug)
112
+ get("/api/v1/methods/#{slug}/")
113
+ end
114
+ # List all orders.
115
+ def list_orders
116
+ get("/api/v1/orders/")
117
+ end
118
+
119
+ # Get order by slug.
120
+ def get_order(slug)
121
+ get("/api/v1/orders/#{slug}/")
122
+ end
123
+ # List all regions.
124
+ def list_regions
125
+ get("/api/v1/regions/")
126
+ end
127
+
128
+ # Get region by slug.
129
+ def get_region(slug)
130
+ get("/api/v1/regions/#{slug}/")
131
+ end
132
+ # List all seasons.
133
+ def list_seasons
134
+ get("/api/v1/seasons/")
135
+ end
136
+
137
+ # Get season by slug.
138
+ def get_season(slug)
139
+ get("/api/v1/seasons/#{slug}/")
140
+ end
141
+ # List all water bodies.
142
+ def list_water_bodies
143
+ get("/api/v1/water-bodies/")
144
+ end
145
+
146
+ # Get water body by slug.
147
+ def get_water_body(slug)
148
+ get("/api/v1/water-bodies/#{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,46 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: fishfyi
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 FishFYI REST API at fishfyi.com. Zero external dependencies.
14
+ email: dev@fyipedia.com
15
+ executables: []
16
+ extensions: []
17
+ extra_rdoc_files: []
18
+ files:
19
+ - lib/fishfyi.rb
20
+ homepage: https://fishfyi.com
21
+ licenses:
22
+ - MIT
23
+ metadata:
24
+ source_code_uri: https://github.com/fyipedia/fishfyi-rb
25
+ documentation_uri: https://fishfyi.com/api/v1/schema/
26
+ homepage_uri: https://fishfyi.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 FishFYI API
46
+ test_files: []