mountainfyi 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/mountainfyi.rb +107 -0
  3. metadata +47 -0
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA256:
3
+ metadata.gz: ec5f902c807a909c654b9f0bc5fa266aaf75ee03268766dac4ea834938e2a917
4
+ data.tar.gz: d401063829295b94de77821e16665888ecb506504ca2e3242cc706206fea5f0e
5
+ SHA512:
6
+ metadata.gz: 268ea72e60e9c119ce69c7838c0789aa62efa4a30d45570c42b0ec985cb0b58bd21b07986acac0846a4188dfeb45939f6d3464c1f3f9113c7249d5fa6fe80437
7
+ data.tar.gz: b1afe068801c46a66c3974b280041ae1e98ee4f6c6be8dc7067b20dc476e1ea7f72afbc2101ad92c42be73294ebad7249f8236313c7775b3cac391c49c3bb6b7
@@ -0,0 +1,107 @@
1
+ # frozen_string_literal: true
2
+
3
+ require "net/http"
4
+ require "json"
5
+ require "uri"
6
+
7
+ # Ruby client for MountainFYI REST API (mountainfyi.com).
8
+ #
9
+ # client = MountainFYI::Client.new
10
+ # result = client.search("query")
11
+ #
12
+ module MountainFYI
13
+ class Client
14
+ BASE_URL = "https://mountainfyi.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 continents.
25
+ def list_continents
26
+ get("/api/v1/continents/")
27
+ end
28
+
29
+ # Get continent by slug.
30
+ def get_continent(slug)
31
+ get("/api/v1/continents/#{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 faqs.
43
+ def list_faqs
44
+ get("/api/v1/faqs/")
45
+ end
46
+
47
+ # Get faq by slug.
48
+ def get_faq(slug)
49
+ get("/api/v1/faqs/#{slug}/")
50
+ end
51
+ # List all mountains.
52
+ def list_mountains
53
+ get("/api/v1/mountains/")
54
+ end
55
+
56
+ # Get mountain by slug.
57
+ def get_mountain(slug)
58
+ get("/api/v1/mountains/#{slug}/")
59
+ end
60
+ # List all ranges.
61
+ def list_ranges
62
+ get("/api/v1/ranges/")
63
+ end
64
+
65
+ # Get range by slug.
66
+ def get_range(slug)
67
+ get("/api/v1/ranges/#{slug}/")
68
+ end
69
+ # List all regions.
70
+ def list_regions
71
+ get("/api/v1/regions/")
72
+ end
73
+
74
+ # Get region by slug.
75
+ def get_region(slug)
76
+ get("/api/v1/regions/#{slug}/")
77
+ end
78
+ # List all routes.
79
+ def list_routes
80
+ get("/api/v1/routes/")
81
+ end
82
+
83
+ # Get route by slug.
84
+ def get_route(slug)
85
+ get("/api/v1/routes/#{slug}/")
86
+ end
87
+ # List all seasonal conditions.
88
+ def list_seasonal_conditions
89
+ get("/api/v1/seasonal-conditions/")
90
+ end
91
+
92
+ # Get seasonal condition by slug.
93
+ def get_seasonal_condition(slug)
94
+ get("/api/v1/seasonal-conditions/#{slug}/")
95
+ end
96
+
97
+ private
98
+
99
+ def get(path, **params)
100
+ uri = URI.join(@base_url, path)
101
+ uri.query = URI.encode_www_form(params) unless params.empty?
102
+ response = Net::HTTP.get_response(uri)
103
+ raise "HTTP #{response.code}" unless response.is_a?(Net::HTTPSuccess)
104
+ JSON.parse(response.body)
105
+ end
106
+ end
107
+ end
metadata ADDED
@@ -0,0 +1,47 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: mountainfyi
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 MountainFYI REST API at mountainfyi.com. Zero external
14
+ dependencies.
15
+ email: dev@fyipedia.com
16
+ executables: []
17
+ extensions: []
18
+ extra_rdoc_files: []
19
+ files:
20
+ - lib/mountainfyi.rb
21
+ homepage: https://mountainfyi.com
22
+ licenses:
23
+ - MIT
24
+ metadata:
25
+ source_code_uri: https://github.com/fyipedia/mountainfyi-rb
26
+ documentation_uri: https://mountainfyi.com/api/v1/schema/
27
+ homepage_uri: https://mountainfyi.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 MountainFYI API
47
+ test_files: []