weather_gov 0.1.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (48) hide show
  1. checksums.yaml +7 -0
  2. data/.github/dependabot.yml +8 -0
  3. data/.github/workflows/rspec.yml +23 -0
  4. data/.github/workflows/rubocop.yml +23 -0
  5. data/.gitignore +13 -0
  6. data/.rspec +3 -0
  7. data/.rubocop.yml +29 -0
  8. data/Gemfile +6 -0
  9. data/Gemfile.lock +84 -0
  10. data/LICENSE.txt +21 -0
  11. data/README.md +40 -0
  12. data/Rakefile +8 -0
  13. data/bin/console +15 -0
  14. data/bin/setup +8 -0
  15. data/lib/weather_gov.rb +13 -0
  16. data/lib/weather_gov/address.rb +27 -0
  17. data/lib/weather_gov/alert.rb +45 -0
  18. data/lib/weather_gov/alert_collection.rb +28 -0
  19. data/lib/weather_gov/api.rb +93 -0
  20. data/lib/weather_gov/client.rb +115 -0
  21. data/lib/weather_gov/feature.rb +40 -0
  22. data/lib/weather_gov/feature_collection.rb +20 -0
  23. data/lib/weather_gov/forecast.rb +27 -0
  24. data/lib/weather_gov/forecast_period.rb +63 -0
  25. data/lib/weather_gov/gridpoint.rb +75 -0
  26. data/lib/weather_gov/identifier.rb +47 -0
  27. data/lib/weather_gov/identifier/alert.rb +13 -0
  28. data/lib/weather_gov/identifier/county_zone.rb +13 -0
  29. data/lib/weather_gov/identifier/fire_zone.rb +13 -0
  30. data/lib/weather_gov/identifier/forecast_zone.rb +13 -0
  31. data/lib/weather_gov/identifier/gridpoint.rb +29 -0
  32. data/lib/weather_gov/identifier/office.rb +13 -0
  33. data/lib/weather_gov/identifier/point.rb +21 -0
  34. data/lib/weather_gov/identifier/problem.rb +13 -0
  35. data/lib/weather_gov/identifier/station.rb +13 -0
  36. data/lib/weather_gov/observation_station.rb +27 -0
  37. data/lib/weather_gov/observation_station_collection.rb +20 -0
  38. data/lib/weather_gov/office.rb +68 -0
  39. data/lib/weather_gov/point.rb +81 -0
  40. data/lib/weather_gov/product.rb +29 -0
  41. data/lib/weather_gov/product_list.rb +17 -0
  42. data/lib/weather_gov/relative_location.rb +23 -0
  43. data/lib/weather_gov/valid_duration_value.rb +26 -0
  44. data/lib/weather_gov/valid_time.rb +48 -0
  45. data/lib/weather_gov/version.rb +5 -0
  46. data/lib/weather_gov/zone.rb +33 -0
  47. data/weather_gov.gemspec +39 -0
  48. metadata +190 -0
@@ -0,0 +1,5 @@
1
+ # frozen_string_literal: true
2
+
3
+ module WeatherGov
4
+ VERSION = "0.1.0"
5
+ end
@@ -0,0 +1,33 @@
1
+ # frozen_string_literal: true
2
+
3
+ module WeatherGov
4
+ class Zone < Feature
5
+ def type
6
+ properties.fetch("type")
7
+ end
8
+
9
+ def name
10
+ properties.fetch("name")
11
+ end
12
+
13
+ def state
14
+ properties.fetch("state")
15
+ end
16
+
17
+ def effective_date
18
+ Time.parse(properties.fetch("effectiveDate"))
19
+ end
20
+
21
+ def expiration
22
+ Time.parse(properties.fetch("expirationDate"))
23
+ end
24
+
25
+ def forecast_office_identifiers
26
+ properties.fetch("forecastOffices", []).map { |uri| Identifier::Office.new(uri) }
27
+ end
28
+
29
+ def forecast_offices
30
+ forecast_office_identifiers.map { |identifier| client.office(uri: identifier.uri) }
31
+ end
32
+ end
33
+ end
@@ -0,0 +1,39 @@
1
+ # frozen_string_literal: true
2
+
3
+ require_relative "lib/weather_gov/version"
4
+
5
+ Gem::Specification.new do |spec|
6
+ spec.name = "weather_gov"
7
+ spec.version = WeatherGov::VERSION
8
+ spec.authors = ["Jeremy Cole"]
9
+ spec.email = ["jeremy@jcole.us"]
10
+
11
+ spec.summary = "Ruby implementation of the NWS API Web Service"
12
+ spec.description = "Ruby implementation of the NWS API Web Service"
13
+ spec.homepage = "https://github.com/jeremycole/weather_gov"
14
+ spec.license = "MIT"
15
+ spec.required_ruby_version = Gem::Requirement.new(">= 2.5.0")
16
+
17
+ spec.metadata["homepage_uri"] = spec.homepage
18
+ spec.metadata["source_code_uri"] = spec.homepage
19
+ spec.metadata["changelog_uri"] = spec.homepage
20
+
21
+ # Specify which files should be added to the gem when it is released.
22
+ # The `git ls-files -z` loads the files in the RubyGem that have been added into git.
23
+ spec.files = Dir.chdir(File.expand_path(__dir__)) do
24
+ `git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) }
25
+ end
26
+ spec.bindir = "exe"
27
+ spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
28
+ spec.require_paths = ["lib"]
29
+
30
+ spec.add_dependency("activesupport", "~> 6.1")
31
+ spec.add_dependency("httparty", "~> 0.18.1")
32
+
33
+ spec.add_development_dependency("rake", "~> 13.0")
34
+ spec.add_development_dependency("rspec", "~> 3.0")
35
+
36
+ spec.add_development_dependency("rubocop", "~> 1.18")
37
+ spec.add_development_dependency("rubocop-rake", "~> 0.6.0")
38
+ spec.add_development_dependency("rubocop-rspec", "~> 2.4")
39
+ end
metadata ADDED
@@ -0,0 +1,190 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: weather_gov
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.1.0
5
+ platform: ruby
6
+ authors:
7
+ - Jeremy Cole
8
+ autorequire:
9
+ bindir: exe
10
+ cert_chain: []
11
+ date: 2021-07-03 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: activesupport
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - "~>"
18
+ - !ruby/object:Gem::Version
19
+ version: '6.1'
20
+ type: :runtime
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - "~>"
25
+ - !ruby/object:Gem::Version
26
+ version: '6.1'
27
+ - !ruby/object:Gem::Dependency
28
+ name: httparty
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - "~>"
32
+ - !ruby/object:Gem::Version
33
+ version: 0.18.1
34
+ type: :runtime
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - "~>"
39
+ - !ruby/object:Gem::Version
40
+ version: 0.18.1
41
+ - !ruby/object:Gem::Dependency
42
+ name: rake
43
+ requirement: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - "~>"
46
+ - !ruby/object:Gem::Version
47
+ version: '13.0'
48
+ type: :development
49
+ prerelease: false
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - "~>"
53
+ - !ruby/object:Gem::Version
54
+ version: '13.0'
55
+ - !ruby/object:Gem::Dependency
56
+ name: rspec
57
+ requirement: !ruby/object:Gem::Requirement
58
+ requirements:
59
+ - - "~>"
60
+ - !ruby/object:Gem::Version
61
+ version: '3.0'
62
+ type: :development
63
+ prerelease: false
64
+ version_requirements: !ruby/object:Gem::Requirement
65
+ requirements:
66
+ - - "~>"
67
+ - !ruby/object:Gem::Version
68
+ version: '3.0'
69
+ - !ruby/object:Gem::Dependency
70
+ name: rubocop
71
+ requirement: !ruby/object:Gem::Requirement
72
+ requirements:
73
+ - - "~>"
74
+ - !ruby/object:Gem::Version
75
+ version: '1.18'
76
+ type: :development
77
+ prerelease: false
78
+ version_requirements: !ruby/object:Gem::Requirement
79
+ requirements:
80
+ - - "~>"
81
+ - !ruby/object:Gem::Version
82
+ version: '1.18'
83
+ - !ruby/object:Gem::Dependency
84
+ name: rubocop-rake
85
+ requirement: !ruby/object:Gem::Requirement
86
+ requirements:
87
+ - - "~>"
88
+ - !ruby/object:Gem::Version
89
+ version: 0.6.0
90
+ type: :development
91
+ prerelease: false
92
+ version_requirements: !ruby/object:Gem::Requirement
93
+ requirements:
94
+ - - "~>"
95
+ - !ruby/object:Gem::Version
96
+ version: 0.6.0
97
+ - !ruby/object:Gem::Dependency
98
+ name: rubocop-rspec
99
+ requirement: !ruby/object:Gem::Requirement
100
+ requirements:
101
+ - - "~>"
102
+ - !ruby/object:Gem::Version
103
+ version: '2.4'
104
+ type: :development
105
+ prerelease: false
106
+ version_requirements: !ruby/object:Gem::Requirement
107
+ requirements:
108
+ - - "~>"
109
+ - !ruby/object:Gem::Version
110
+ version: '2.4'
111
+ description: Ruby implementation of the NWS API Web Service
112
+ email:
113
+ - jeremy@jcole.us
114
+ executables: []
115
+ extensions: []
116
+ extra_rdoc_files: []
117
+ files:
118
+ - ".github/dependabot.yml"
119
+ - ".github/workflows/rspec.yml"
120
+ - ".github/workflows/rubocop.yml"
121
+ - ".gitignore"
122
+ - ".rspec"
123
+ - ".rubocop.yml"
124
+ - Gemfile
125
+ - Gemfile.lock
126
+ - LICENSE.txt
127
+ - README.md
128
+ - Rakefile
129
+ - bin/console
130
+ - bin/setup
131
+ - lib/weather_gov.rb
132
+ - lib/weather_gov/address.rb
133
+ - lib/weather_gov/alert.rb
134
+ - lib/weather_gov/alert_collection.rb
135
+ - lib/weather_gov/api.rb
136
+ - lib/weather_gov/client.rb
137
+ - lib/weather_gov/feature.rb
138
+ - lib/weather_gov/feature_collection.rb
139
+ - lib/weather_gov/forecast.rb
140
+ - lib/weather_gov/forecast_period.rb
141
+ - lib/weather_gov/gridpoint.rb
142
+ - lib/weather_gov/identifier.rb
143
+ - lib/weather_gov/identifier/alert.rb
144
+ - lib/weather_gov/identifier/county_zone.rb
145
+ - lib/weather_gov/identifier/fire_zone.rb
146
+ - lib/weather_gov/identifier/forecast_zone.rb
147
+ - lib/weather_gov/identifier/gridpoint.rb
148
+ - lib/weather_gov/identifier/office.rb
149
+ - lib/weather_gov/identifier/point.rb
150
+ - lib/weather_gov/identifier/problem.rb
151
+ - lib/weather_gov/identifier/station.rb
152
+ - lib/weather_gov/observation_station.rb
153
+ - lib/weather_gov/observation_station_collection.rb
154
+ - lib/weather_gov/office.rb
155
+ - lib/weather_gov/point.rb
156
+ - lib/weather_gov/product.rb
157
+ - lib/weather_gov/product_list.rb
158
+ - lib/weather_gov/relative_location.rb
159
+ - lib/weather_gov/valid_duration_value.rb
160
+ - lib/weather_gov/valid_time.rb
161
+ - lib/weather_gov/version.rb
162
+ - lib/weather_gov/zone.rb
163
+ - weather_gov.gemspec
164
+ homepage: https://github.com/jeremycole/weather_gov
165
+ licenses:
166
+ - MIT
167
+ metadata:
168
+ homepage_uri: https://github.com/jeremycole/weather_gov
169
+ source_code_uri: https://github.com/jeremycole/weather_gov
170
+ changelog_uri: https://github.com/jeremycole/weather_gov
171
+ post_install_message:
172
+ rdoc_options: []
173
+ require_paths:
174
+ - lib
175
+ required_ruby_version: !ruby/object:Gem::Requirement
176
+ requirements:
177
+ - - ">="
178
+ - !ruby/object:Gem::Version
179
+ version: 2.5.0
180
+ required_rubygems_version: !ruby/object:Gem::Requirement
181
+ requirements:
182
+ - - ">="
183
+ - !ruby/object:Gem::Version
184
+ version: '0'
185
+ requirements: []
186
+ rubygems_version: 3.0.3
187
+ signing_key:
188
+ specification_version: 4
189
+ summary: Ruby implementation of the NWS API Web Service
190
+ test_files: []