meteoalarm 0.1.2

Sign up to get free protection for your applications and to get access to all the features.
Files changed (50) hide show
  1. checksums.yaml +7 -0
  2. data/CHANGELOG.md +14 -0
  3. data/Gemfile +16 -0
  4. data/Gemfile.lock +44 -0
  5. data/LICENSE.txt +21 -0
  6. data/README.md +90 -0
  7. data/Rakefile +14 -0
  8. data/countries/austria.json +116122 -0
  9. data/countries/belgium.json +369 -0
  10. data/countries/bosnia-herzegovina.json +474 -0
  11. data/countries/bulgeria.json +1084 -0
  12. data/countries/croatia.json +129694 -0
  13. data/countries/cyprus.json +67 -0
  14. data/countries/czechia.json +839 -0
  15. data/countries/denmark.json +2359 -0
  16. data/countries/estonia.json +838 -0
  17. data/countries/finland.json +3546 -0
  18. data/countries/france.json +4601 -0
  19. data/countries/germany.json +13918 -0
  20. data/countries/greece.json +1958 -0
  21. data/countries/hungary.json +545 -0
  22. data/countries/iceland.json +653 -0
  23. data/countries/ireland.json +1949 -0
  24. data/countries/israel.json +1733 -0
  25. data/countries/italy.json +3192 -0
  26. data/countries/latvia.json +164392 -0
  27. data/countries/lithuania.json +556 -0
  28. data/countries/luxembourg.json +52 -0
  29. data/countries/malta.json +47 -0
  30. data/countries/moldova.json +1609 -0
  31. data/countries/montenegro.json +193 -0
  32. data/countries/netherlands.json +956 -0
  33. data/countries/norway.json +7295 -0
  34. data/countries/poland.json +16858 -0
  35. data/countries/portugal.json +5923 -0
  36. data/countries/republic-of-north-macedonia.json +908 -0
  37. data/countries/romania.json +2122 -0
  38. data/countries/serbia.json +881 -0
  39. data/countries/slovenia.json +256 -0
  40. data/countries/slovkia.json +2628 -0
  41. data/countries/spain.json +14032 -0
  42. data/countries/sweden.json +3660 -0
  43. data/countries/switzerland.json +30511 -0
  44. data/countries/united-kingdom.json +98131 -0
  45. data/lib/meteoalarm/country_mapping.rb +41 -0
  46. data/lib/meteoalarm/tasks/areas.rake +17 -0
  47. data/lib/meteoalarm/tasks/countries.rake +10 -0
  48. data/lib/meteoalarm/version.rb +5 -0
  49. data/lib/meteoalarm.rb +185 -0
  50. metadata +93 -0
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA256:
3
+ metadata.gz: a490f0eebfac5e80820deff7876c1c95b7e3f019db42d0555429b3faef70b151
4
+ data.tar.gz: 40d97474871812e4440552232ff9ed90382c3de65490405cf53152f643adced2
5
+ SHA512:
6
+ metadata.gz: d86da58dcf511eb67398ae1ee66930d2dedfa329daea254471d2545b95d419183032ca0a4f88069b9516f79539ed16112a8d76d9e56a58327a5b86e0d77208ea
7
+ data.tar.gz: 166d72c0d5939a1f94eb47f1b9cd1fc8fd6426ec4f9c23a2380a8ea90f3c50c45df60339c14607fdb5ccfd37bc68b282f738d318c9da7a3c328aed92d148806a
data/CHANGELOG.md ADDED
@@ -0,0 +1,14 @@
1
+ ## [Unreleased]
2
+
3
+ ## [0.1.2] - 2024-01-13
4
+
5
+ - Changed the approach for handling expired alarms.
6
+ - Introduced a new feature enabling the filtering of alarms scheduled for the future.
7
+
8
+ ## [0.1.1] - 2024-01-12
9
+
10
+ - Resolved problems related to the pathway to country files.
11
+
12
+ ## [0.1.0] - 2024-01-12
13
+
14
+ - Initial release
data/Gemfile ADDED
@@ -0,0 +1,16 @@
1
+ # frozen_string_literal: true
2
+
3
+ source "https://rubygems.org"
4
+
5
+ # Specify your gem's dependencies in meteoalarm.gemspec
6
+ gemspec
7
+
8
+ gem "rake", "~> 13.0"
9
+
10
+ gem "minitest", "~> 5.0"
11
+
12
+ group :test do
13
+ gem "webmock"
14
+ gem "timecop"
15
+ gem "simplecov"
16
+ end
data/Gemfile.lock ADDED
@@ -0,0 +1,44 @@
1
+ PATH
2
+ remote: .
3
+ specs:
4
+ meteoalarm (0.1.1)
5
+
6
+ GEM
7
+ remote: https://rubygems.org/
8
+ specs:
9
+ addressable (2.8.6)
10
+ public_suffix (>= 2.0.2, < 6.0)
11
+ crack (0.4.5)
12
+ rexml
13
+ docile (1.4.0)
14
+ hashdiff (1.1.0)
15
+ minitest (5.20.0)
16
+ public_suffix (5.0.4)
17
+ rake (13.1.0)
18
+ rexml (3.2.6)
19
+ simplecov (0.22.0)
20
+ docile (~> 1.1)
21
+ simplecov-html (~> 0.11)
22
+ simplecov_json_formatter (~> 0.1)
23
+ simplecov-html (0.12.3)
24
+ simplecov_json_formatter (0.1.4)
25
+ timecop (0.9.8)
26
+ webmock (3.19.1)
27
+ addressable (>= 2.8.0)
28
+ crack (>= 0.3.2)
29
+ hashdiff (>= 0.4.0, < 2.0.0)
30
+
31
+ PLATFORMS
32
+ arm64-darwin-22
33
+ x86_64-linux
34
+
35
+ DEPENDENCIES
36
+ meteoalarm!
37
+ minitest (~> 5.0)
38
+ rake (~> 13.0)
39
+ simplecov
40
+ timecop
41
+ webmock
42
+
43
+ BUNDLED WITH
44
+ 2.4.13
data/LICENSE.txt ADDED
@@ -0,0 +1,21 @@
1
+ The MIT License (MIT)
2
+
3
+ Copyright (c) 2024 Em Jov
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in
13
+ all copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
21
+ THE SOFTWARE.
data/README.md ADDED
@@ -0,0 +1,90 @@
1
+ # Meteoalarm
2
+
3
+ Meteoalarm serves as an API wrapper for [meteoalarm.org](https://meteoalarm.org/en/live/), a platform delivering hydrometeorological warnings across the European region. This gem simplifies the process of retrieving warnings based on country, specific coordinates or area, along with a few additional options.
4
+
5
+ ## Installation
6
+
7
+ Add this line to your Gemfile:
8
+
9
+ ```ruby
10
+ gem 'meteoalarm'
11
+ ```
12
+
13
+ And then execute:
14
+
15
+ ```bash
16
+ bundle install
17
+ ```
18
+
19
+ Or install it directly:
20
+
21
+ ```bash
22
+ gem install meteoalarm
23
+ ```
24
+
25
+ ## Usage
26
+
27
+ ```ruby
28
+ require 'meteoalarm'
29
+
30
+ # Get alarms for a specific country by its ISO 3166-1 A-2 code
31
+ Meteoalarm::Client.alarms('FR', **options) # Example: France
32
+ ```
33
+
34
+ #### Options
35
+
36
+ - `:latitude` and `:longitude`: Check alarms for a specific coordinates.
37
+ - `:area`: Check alarms for a specific area.
38
+ - `:active_now`: Check currently active alarms.
39
+ - `:date`: Check alarms by date.
40
+ - `:expired`: Include expired alarms.
41
+
42
+ #### Examples
43
+
44
+ ```ruby
45
+ require 'meteoalarm'
46
+
47
+ # Check alarms by coordinates
48
+ Meteoalarm::Client.alarms('FR', latitude: 48.84307, longitude: 2.33662)
49
+
50
+ # Check alarms by area
51
+ Meteoalarm::Client.alarms('FR', area: 'Paris')
52
+
53
+ # Check currently active alarms
54
+ Meteoalarm::Client.alarms('FR', active_now: true)
55
+
56
+ # Check alarms by date
57
+ Meteoalarm::Client.alarms('FR', date: Date.new(2024, 1, 21))
58
+
59
+ # Include expired alarms
60
+ Meteoalarm::Client.alarms('FR', expired: true)
61
+
62
+ # Or combine the options
63
+ Meteoalarm::Client.alarms('FR', area: 'Paris', active_now: true)
64
+ ```
65
+
66
+ ## Rake tasks
67
+
68
+ To incorporate Meteoalarm rake tasks into your project, include the following code in your `Rakefile`:
69
+ ```ruby
70
+ require 'meteoalarm'
71
+
72
+ spec = Gem::Specification.find_by_name 'meteoalarm'
73
+ Dir.glob("#{spec.gem_dir}/lib/meteoalarm/tasks/*.rake").each { |f| import f }
74
+ ```
75
+ By adding this code, you will gain access to the following rake tasks:
76
+ ```
77
+ rake meteoalarm:countries
78
+ List all countries in Meteoalarm system
79
+
80
+ rake meteoalarm:areas
81
+ List all areas of given COUNTRY_CODE in Meteoalarm system
82
+ ```
83
+
84
+ ## Contributing
85
+
86
+ Your contributions are welcome and appreciated. If you find issues or have improvements, feel free to open an issue or submit a pull request.
87
+
88
+ ## License
89
+
90
+ The gem is available as open source under the terms of the [MIT License](LICENSE.txt).
data/Rakefile ADDED
@@ -0,0 +1,14 @@
1
+ # frozen_string_literal: true
2
+
3
+ require "bundler/gem_tasks"
4
+ require "rake/testtask"
5
+
6
+ Rake::TestTask.new(:test) do |t|
7
+ t.libs << "test"
8
+ t.libs << "lib"
9
+ t.test_files = FileList["test/**/test_*.rb"]
10
+ end
11
+
12
+ Dir.glob("lib/meteoalarm/tasks/**/*.rake").each { |f| import f }
13
+
14
+ task default: :test