weather_gem_kg 1.0.0 → 1.0.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 +4 -4
- data/CHANGELOG.md +33 -0
- data/Gemfile.lock +1 -1
- data/README.md +73 -11
- data/lib/weather_gem_kg/version.rb +1 -1
- metadata +2 -1
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: a95c4c55f26f7f75e7fe956bc5d91d0148849e3df4366d98b5a90ceb1cd45ca1
|
|
4
|
+
data.tar.gz: 7970245200fcfb56dfcaecefb6fbb33ab32f7266f626fda99bb3c69d5e4cbf1e
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 45d9ad7f35f0f21c345d8f12109b9cf177eed2b700236d8fad7b00e86d147c814b1cfd6b7c84d8ed9edac9a8adab9b0b93c85f27cc0eb56b36a1663c80ce7de0
|
|
7
|
+
data.tar.gz: 7432f57f7412c7f1c3b7370556941a3022821c9d1dce641bb7795eda1c38c29409d73390b1e27b5a7f5969d9189bdbe6d4070518ed28771a4efbac43c7308396
|
data/CHANGELOG.md
ADDED
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
# Changelog
|
|
2
|
+
|
|
3
|
+
All notable changes to this project are documented in this file.
|
|
4
|
+
|
|
5
|
+
## [1.0.0] — 2026-07-21
|
|
6
|
+
|
|
7
|
+
### Added
|
|
8
|
+
|
|
9
|
+
- `WeatherGemKg.forecast(city:, days:, client:)` public API
|
|
10
|
+
- `WeatherGemKg::ForecastDay` (`date`, `max_temp`, `min_temp`, `condition`)
|
|
11
|
+
- `WeatherGemKg::Client` interface and `WeatherGemKg::Clients::OpenMeteo`
|
|
12
|
+
- Errors: `LocationNotFoundError`, `RequestError`, `InvalidArgumentError`
|
|
13
|
+
- GitHub Actions CI workflow
|
|
14
|
+
- `.ruby-version` pinned to Ruby 4.0.6
|
|
15
|
+
- Rails installer updated for key-free configuration
|
|
16
|
+
|
|
17
|
+
### Changed
|
|
18
|
+
|
|
19
|
+
- Runtime dependency is `httparty` only (declared in the gemspec)
|
|
20
|
+
- Specs use WebMock stubs (no live HTTP in CI)
|
|
21
|
+
- `required_ruby_version` set to `>= 3.2`
|
|
22
|
+
|
|
23
|
+
### Removed
|
|
24
|
+
|
|
25
|
+
- Apixu and Dark Sky clients
|
|
26
|
+
- `WeatherGemKg::Generator` and `#generate_me`
|
|
27
|
+
- API key settings (`api_key_apixu`, `api_key_dark`)
|
|
28
|
+
- `geocoder` and `vcr` dependencies
|
|
29
|
+
- Travis CI configuration
|
|
30
|
+
|
|
31
|
+
## [0.32.0] — prior
|
|
32
|
+
|
|
33
|
+
Initial published line with Apixu and Dark Sky providers.
|
data/Gemfile.lock
CHANGED
data/README.md
CHANGED
|
@@ -1,46 +1,65 @@
|
|
|
1
1
|
# WeatherGemKg
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
Daily city weather forecasts for Ruby, powered by [Open-Meteo](https://open-meteo.com/).
|
|
4
|
+
|
|
5
|
+
- **No API key** required
|
|
6
|
+
- Returns structured `ForecastDay` objects (`date`, `max_temp`, `min_temp`, `condition`)
|
|
7
|
+
- Swappable client interface for custom providers
|
|
8
|
+
- Ruby **≥ 3.2**
|
|
4
9
|
|
|
5
10
|
## Installation
|
|
6
11
|
|
|
7
|
-
Add
|
|
12
|
+
Add to your Gemfile:
|
|
8
13
|
|
|
9
14
|
```ruby
|
|
10
|
-
gem "weather_gem_kg"
|
|
15
|
+
gem "weather_gem_kg", "~> 1.0"
|
|
11
16
|
```
|
|
12
17
|
|
|
13
|
-
|
|
18
|
+
Then:
|
|
14
19
|
|
|
15
20
|
```bash
|
|
16
21
|
bundle install
|
|
17
22
|
```
|
|
18
23
|
|
|
19
|
-
Or install
|
|
24
|
+
Or install directly:
|
|
20
25
|
|
|
21
26
|
```bash
|
|
22
27
|
gem install weather_gem_kg
|
|
23
28
|
```
|
|
24
29
|
|
|
30
|
+
Pin `~> 1.0` if you previously used `0.x` — **1.0.0 is a breaking release**. See [CHANGELOG.md](CHANGELOG.md).
|
|
31
|
+
|
|
25
32
|
### Rails
|
|
26
33
|
|
|
27
34
|
```bash
|
|
28
35
|
rails generate weather_gem_kg:install
|
|
29
36
|
```
|
|
30
37
|
|
|
38
|
+
This creates `config/initializers/weather_gem_kg.rb`.
|
|
39
|
+
|
|
31
40
|
## Usage
|
|
32
41
|
|
|
33
42
|
```ruby
|
|
34
43
|
require "weather_gem_kg"
|
|
35
44
|
|
|
36
|
-
|
|
45
|
+
forecast = WeatherGemKg.forecast(city: "Bishkek", days: 3)
|
|
37
46
|
|
|
38
|
-
|
|
47
|
+
forecast.each do |day|
|
|
39
48
|
puts "#{day.date}: #{day.min_temp}–#{day.max_temp}°C, #{day.condition}"
|
|
40
49
|
end
|
|
50
|
+
# => 2026-07-21: 15.2–30.1°C, Clear sky
|
|
41
51
|
```
|
|
42
52
|
|
|
43
|
-
|
|
53
|
+
### `ForecastDay`
|
|
54
|
+
|
|
55
|
+
| Attribute | Type | Description |
|
|
56
|
+
|-------------|---------|--------------------------|
|
|
57
|
+
| `date` | String | ISO date (`YYYY-MM-DD`) |
|
|
58
|
+
| `max_temp` | Float | Daily high (°C) |
|
|
59
|
+
| `min_temp` | Float | Daily low (°C) |
|
|
60
|
+
| `condition` | String | Human-readable condition |
|
|
61
|
+
|
|
62
|
+
`days` must be between **1 and 16** (Open-Meteo limit). If omitted, `configuration.default_days` is used (default: `1`).
|
|
44
63
|
|
|
45
64
|
### Configuration
|
|
46
65
|
|
|
@@ -51,21 +70,64 @@ WeatherGemKg.configure do |config|
|
|
|
51
70
|
end
|
|
52
71
|
```
|
|
53
72
|
|
|
73
|
+
No API keys are needed for the default Open-Meteo client.
|
|
74
|
+
|
|
75
|
+
### Errors
|
|
76
|
+
|
|
77
|
+
```ruby
|
|
78
|
+
begin
|
|
79
|
+
WeatherGemKg.forecast(city: "Bishkek", days: 3)
|
|
80
|
+
rescue WeatherGemKg::LocationNotFoundError
|
|
81
|
+
# city could not be geocoded
|
|
82
|
+
rescue WeatherGemKg::RequestError
|
|
83
|
+
# HTTP / upstream failure
|
|
84
|
+
rescue WeatherGemKg::InvalidArgumentError
|
|
85
|
+
# blank city or days out of range
|
|
86
|
+
end
|
|
87
|
+
```
|
|
88
|
+
|
|
89
|
+
All errors inherit from `WeatherGemKg::Error`.
|
|
90
|
+
|
|
54
91
|
### Custom client
|
|
55
92
|
|
|
56
|
-
Any object
|
|
93
|
+
Any object that implements `#forecast(city:, days:)` and returns an `Array` of `ForecastDay` can be used:
|
|
57
94
|
|
|
58
95
|
```ruby
|
|
96
|
+
class MyClient < WeatherGemKg::Client
|
|
97
|
+
def forecast(city:, days:)
|
|
98
|
+
# ...
|
|
99
|
+
end
|
|
100
|
+
end
|
|
101
|
+
|
|
59
102
|
WeatherGemKg.forecast(city: "Bishkek", days: 1, client: MyClient.new)
|
|
103
|
+
# or
|
|
104
|
+
WeatherGemKg.configure { |c| c.client = MyClient.new }
|
|
60
105
|
```
|
|
61
106
|
|
|
62
107
|
## Development
|
|
63
108
|
|
|
64
109
|
```bash
|
|
65
110
|
bundle install
|
|
66
|
-
bundle exec rake
|
|
111
|
+
bundle exec rake # run specs
|
|
112
|
+
bin/console # interactive console with the gem loaded
|
|
113
|
+
```
|
|
114
|
+
|
|
115
|
+
Specs stub HTTP with WebMock — no network required for the test suite.
|
|
116
|
+
|
|
117
|
+
### Releasing to RubyGems
|
|
118
|
+
|
|
119
|
+
1. Bump `WeatherGemKg::VERSION` in `lib/weather_gem_kg/version.rb`
|
|
120
|
+
2. Update [CHANGELOG.md](CHANGELOG.md)
|
|
121
|
+
3. Commit all changes (the gemspec packs files via `git ls-files`)
|
|
122
|
+
4. Publish:
|
|
123
|
+
|
|
124
|
+
```bash
|
|
125
|
+
bundle exec rake release
|
|
126
|
+
# or
|
|
127
|
+
gem build weather_gem_kg.gemspec
|
|
128
|
+
gem push weather_gem_kg-X.Y.Z.gem
|
|
67
129
|
```
|
|
68
130
|
|
|
69
131
|
## License
|
|
70
132
|
|
|
71
|
-
MIT
|
|
133
|
+
MIT — see [LICENSE.txt](LICENSE.txt).
|
metadata
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: weather_gem_kg
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 1.0.
|
|
4
|
+
version: 1.0.1
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Edilbek
|
|
@@ -77,6 +77,7 @@ files:
|
|
|
77
77
|
- ".gitignore"
|
|
78
78
|
- ".rspec"
|
|
79
79
|
- ".ruby-version"
|
|
80
|
+
- CHANGELOG.md
|
|
80
81
|
- CODE_OF_CONDUCT.md
|
|
81
82
|
- Gemfile
|
|
82
83
|
- Gemfile.lock
|