weather-forecasts 1.1.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.
Files changed (56) hide show
  1. checksums.yaml +7 -0
  2. data/.gitignore +4 -0
  3. data/.rspec +2 -0
  4. data/.travis.yml +7 -0
  5. data/Gemfile +10 -0
  6. data/LICENSE +20 -0
  7. data/README.md +135 -0
  8. data/bin/wf-console +21 -0
  9. data/lib/weather-forecasts.rb +1 -0
  10. data/lib/weather_forecasts.rb +23 -0
  11. data/lib/weather_forecasts/client.rb +65 -0
  12. data/lib/weather_forecasts/client/error.rb +18 -0
  13. data/lib/weather_forecasts/client/help_console.rb +9 -0
  14. data/lib/weather_forecasts/client/query.rb +155 -0
  15. data/lib/weather_forecasts/client/query/query_property.rb +68 -0
  16. data/lib/weather_forecasts/client/query/query_utilities.rb +16 -0
  17. data/lib/weather_forecasts/client/query/select_by_days_query.rb +35 -0
  18. data/lib/weather_forecasts/client/query/select_coordinates_by_cities_query.rb +47 -0
  19. data/lib/weather_forecasts/client/query/select_coordinates_by_zip_query.rb +34 -0
  20. data/lib/weather_forecasts/client/query/select_corner_coordinates_query.rb +38 -0
  21. data/lib/weather_forecasts/client/query/select_gridpoint_coordinates_query.rb +35 -0
  22. data/lib/weather_forecasts/client/query/select_linepoint_coordinates_query.rb +33 -0
  23. data/lib/weather_forecasts/client/query/select_query.rb +48 -0
  24. data/lib/weather_forecasts/client/query/select_square_coordinates_query.rb +35 -0
  25. data/lib/weather_forecasts/client/query/selection_attributes.rb +19 -0
  26. data/lib/weather_forecasts/client/version.rb +5 -0
  27. data/lib/weather_forecasts/dwml.rb +38 -0
  28. data/lib/weather_forecasts/dwml/data_extractor.rb +55 -0
  29. data/lib/weather_forecasts/dwml/head_extractor.rb +49 -0
  30. data/lib/weather_forecasts/dwml/location.rb +33 -0
  31. data/lib/weather_forecasts/dwml/parameter_extractor.rb +281 -0
  32. data/lib/weather_forecasts/dwml/time_layout.rb +55 -0
  33. data/spec/fixtures/vcr_cassettes/select_by_days_query.yml +557 -0
  34. data/spec/fixtures/vcr_cassettes/select_coordinates_by_cities_query.yml +437 -0
  35. data/spec/fixtures/vcr_cassettes/select_coordinates_by_zip_query.yml +437 -0
  36. data/spec/fixtures/vcr_cassettes/select_corner_coordinates_query.yml +438 -0
  37. data/spec/fixtures/vcr_cassettes/select_gridpoint_coordinates_query.yml +467 -0
  38. data/spec/fixtures/vcr_cassettes/select_linepoint_coordinates_query.yml +440 -0
  39. data/spec/fixtures/vcr_cassettes/select_query.yml +1647 -0
  40. data/spec/fixtures/vcr_cassettes/select_square_coordinates_query.yml +443 -0
  41. data/spec/lib/ndfd/client/query/query_property_spec.rb +41 -0
  42. data/spec/lib/ndfd/client/query/select_by_days_query_spec.rb +35 -0
  43. data/spec/lib/ndfd/client/query/select_coordinates_by_cities_query_spec.rb +33 -0
  44. data/spec/lib/ndfd/client/query/select_coordinates_by_zip_query_spec.rb +34 -0
  45. data/spec/lib/ndfd/client/query/select_corner_coordinates_query_spec.rb +35 -0
  46. data/spec/lib/ndfd/client/query/select_gridpoint_coordinates_query_spec.rb +37 -0
  47. data/spec/lib/ndfd/client/query/select_linepoint_coordinates_query_spec.rb +36 -0
  48. data/spec/lib/ndfd/client/query/select_query_spec.rb +46 -0
  49. data/spec/lib/ndfd/client/query/select_square_coordinates_query_spec.rb +37 -0
  50. data/spec/lib/ndfd/client/query/selection_attributes_spec.rb +13 -0
  51. data/spec/lib/ndfd/client/query_spec.rb +91 -0
  52. data/spec/lib/ndfd/client_spec.rb +61 -0
  53. data/spec/spec_helper.rb +33 -0
  54. data/spec/support/resources/sample_document.xml +61 -0
  55. data/weather-forecasts.gemspec +39 -0
  56. metadata +224 -0
@@ -0,0 +1,33 @@
1
+ ENV["ENV"] = "test"
2
+
3
+ require 'coveralls'
4
+ Coveralls.wear!
5
+
6
+ require 'weather-forecasts'
7
+
8
+ Bundler.require(:default, WeatherForecasts.env)
9
+
10
+ Time.zone = 'UTC'
11
+
12
+ require 'webmock/rspec'
13
+ require 'vcr'
14
+ require 'savon'
15
+
16
+ VCR.configure do |c|
17
+ c.cassette_library_dir = 'spec/fixtures/vcr_cassettes'
18
+ c.hook_into :webmock
19
+
20
+ c.configure_rspec_metadata!
21
+ c.ignore_localhost = true
22
+ c.allow_http_connections_when_no_cassette = true
23
+ c.default_cassette_options = {
24
+ :allow_playback_repeats => true
25
+ }
26
+ end
27
+
28
+ RSpec.configure do |config|
29
+ config.treat_symbols_as_metadata_keys_with_true_values = true
30
+ config.run_all_when_everything_filtered = true
31
+ config.filter_run :focus
32
+ config.order = 'random'
33
+ end
@@ -0,0 +1,61 @@
1
+ <?xml version="1.0" encoding="UTF-8"?>
2
+ <dwml xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" version="1.0" xsi:noNamespaceSchemaLocation="http://www.nws.noaa.gov/forecasts/xml/DWMLgen/schema/DWML.xsd">
3
+ <head>
4
+ <product srsName="WGS 1984" concise-name="time-series" operational-mode="official">
5
+ <title>NOAAs National Weather Service Forecast Data</title>
6
+ <field>meteorological</field>
7
+ <category>forecast</category>
8
+ <creation-date refresh-frequency="PT1H">2014-02-26T23:45:57Z</creation-date>
9
+ </product>
10
+ <source>
11
+ <more-information>http://www.nws.noaa.gov/forecasts/xml/</more-information>
12
+ <production-center>
13
+ Meteorological Development Laboratory
14
+ <sub-center>Product Generation Branch</sub-center>
15
+ </production-center>
16
+ <disclaimer>http://www.nws.noaa.gov/disclaimer.html</disclaimer>
17
+ <credit>http://www.weather.gov/</credit>
18
+ <credit-logo>http://www.weather.gov/images/xml_logo.gif</credit-logo>
19
+ <feedback>http://www.weather.gov/feedback.php</feedback>
20
+ </source>
21
+ </head>
22
+ <data>
23
+ <location>
24
+ <location-key>point1</location-key>
25
+ <point latitude="38.99" longitude="-77.01" />
26
+ </location>
27
+ <moreWeatherInformation applicable-location="point1">http://forecast.weather.gov/MapClick.php?textField1=38.99&amp;textField2=-77.01</moreWeatherInformation>
28
+ <time-layout time-coordinate="local" summarization="none">
29
+ <layout-key>k-p24h-n8-1</layout-key>
30
+ <start-valid-time>2014-02-26T07:00:00-05:00</start-valid-time>
31
+ <end-valid-time>2014-02-26T19:00:00-05:00</end-valid-time>
32
+ <start-valid-time>2014-02-27T07:00:00-05:00</start-valid-time>
33
+ <end-valid-time>2014-02-27T19:00:00-05:00</end-valid-time>
34
+ <start-valid-time>2014-02-28T07:00:00-05:00</start-valid-time>
35
+ <end-valid-time>2014-02-28T19:00:00-05:00</end-valid-time>
36
+ <start-valid-time>2014-03-01T07:00:00-05:00</start-valid-time>
37
+ <end-valid-time>2014-03-01T19:00:00-05:00</end-valid-time>
38
+ <start-valid-time>2014-03-02T07:00:00-05:00</start-valid-time>
39
+ <end-valid-time>2014-03-02T19:00:00-05:00</end-valid-time>
40
+ <start-valid-time>2014-03-03T07:00:00-05:00</start-valid-time>
41
+ <end-valid-time>2014-03-03T19:00:00-05:00</end-valid-time>
42
+ <start-valid-time>2014-03-04T07:00:00-05:00</start-valid-time>
43
+ <end-valid-time>2014-03-04T19:00:00-05:00</end-valid-time>
44
+ <start-valid-time>2014-03-05T07:00:00-05:00</start-valid-time>
45
+ <end-valid-time>2014-03-05T19:00:00-05:00</end-valid-time>
46
+ </time-layout>
47
+ <parameters applicable-location="point1">
48
+ <temperature type="maximum" units="Fahrenheit" time-layout="k-p24h-n8-1">
49
+ <name>Daily Maximum Temperature</name>
50
+ <value>35</value>
51
+ <value>37</value>
52
+ <value>26</value>
53
+ <value>38</value>
54
+ <value>44</value>
55
+ <value>39</value>
56
+ <value>35</value>
57
+ <value>32</value>
58
+ </temperature>
59
+ </parameters>
60
+ </data>
61
+ </dwml>
@@ -0,0 +1,39 @@
1
+ lib = File.expand_path('../lib/', __FILE__)
2
+ $:.unshift lib unless $:.include?(lib)
3
+
4
+ require 'weather_forecasts/client/version'
5
+
6
+ Gem::Specification.new do |s|
7
+ s.name = "weather-forecasts"
8
+ s.version = WeatherForecasts::Client::VERSION
9
+ s.platform = Gem::Platform::RUBY
10
+ s.authors = ["Angelo Lakra"]
11
+ s.email = ["angelo.lakra@gmail.com"]
12
+ s.summary = "Client library for retrieving data from NOAA's weather forecast API"
13
+
14
+ s.description = <<-EOT
15
+ Utilizing the NDFD (NWS Digital Forecast Database), weather forecasts are retrieved from NOAA's SOAP API and then translated into simple array/hash structures in Ruby."
16
+ EOT
17
+
18
+ s.homepage = "https://github.com/alakra/weather-forecasts"
19
+ s.bindir = 'bin'
20
+ s.licenses = ['MIT']
21
+
22
+ s.extra_rdoc_files = ['README.md']
23
+
24
+ s.executables << 'wf-console'
25
+
26
+ s.add_runtime_dependency 'savon', '~> 2.4.0', '>= 2.4.0'
27
+ s.add_runtime_dependency 'nokogiri', '~> 1.6.1', '>= 1.6.1'
28
+ s.add_runtime_dependency 'multi_json', '~> 1.9.0', '>= 1.9.0'
29
+ s.add_runtime_dependency 'activesupport', '~> 4.0.3', '>= 4.0.3'
30
+ s.add_runtime_dependency 'http_logger', '~> 0.4.2', '>= 0.4.2'
31
+
32
+ s.post_install_message = "To start querying weather forecasts immediately, type `wf-console`."
33
+
34
+ s.required_ruby_version = '>= 1.9.3'
35
+
36
+ s.files = `git ls-files`.split("\n")
37
+ s.test_files = `git ls-files -- spec/*`.split("\n")
38
+ s.require_path = 'lib'
39
+ end
metadata ADDED
@@ -0,0 +1,224 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: weather-forecasts
3
+ version: !ruby/object:Gem::Version
4
+ version: 1.1.1
5
+ platform: ruby
6
+ authors:
7
+ - Angelo Lakra
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2014-04-02 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: savon
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - "~>"
18
+ - !ruby/object:Gem::Version
19
+ version: 2.4.0
20
+ - - ">="
21
+ - !ruby/object:Gem::Version
22
+ version: 2.4.0
23
+ type: :runtime
24
+ prerelease: false
25
+ version_requirements: !ruby/object:Gem::Requirement
26
+ requirements:
27
+ - - "~>"
28
+ - !ruby/object:Gem::Version
29
+ version: 2.4.0
30
+ - - ">="
31
+ - !ruby/object:Gem::Version
32
+ version: 2.4.0
33
+ - !ruby/object:Gem::Dependency
34
+ name: nokogiri
35
+ requirement: !ruby/object:Gem::Requirement
36
+ requirements:
37
+ - - "~>"
38
+ - !ruby/object:Gem::Version
39
+ version: 1.6.1
40
+ - - ">="
41
+ - !ruby/object:Gem::Version
42
+ version: 1.6.1
43
+ type: :runtime
44
+ prerelease: false
45
+ version_requirements: !ruby/object:Gem::Requirement
46
+ requirements:
47
+ - - "~>"
48
+ - !ruby/object:Gem::Version
49
+ version: 1.6.1
50
+ - - ">="
51
+ - !ruby/object:Gem::Version
52
+ version: 1.6.1
53
+ - !ruby/object:Gem::Dependency
54
+ name: multi_json
55
+ requirement: !ruby/object:Gem::Requirement
56
+ requirements:
57
+ - - "~>"
58
+ - !ruby/object:Gem::Version
59
+ version: 1.9.0
60
+ - - ">="
61
+ - !ruby/object:Gem::Version
62
+ version: 1.9.0
63
+ type: :runtime
64
+ prerelease: false
65
+ version_requirements: !ruby/object:Gem::Requirement
66
+ requirements:
67
+ - - "~>"
68
+ - !ruby/object:Gem::Version
69
+ version: 1.9.0
70
+ - - ">="
71
+ - !ruby/object:Gem::Version
72
+ version: 1.9.0
73
+ - !ruby/object:Gem::Dependency
74
+ name: activesupport
75
+ requirement: !ruby/object:Gem::Requirement
76
+ requirements:
77
+ - - "~>"
78
+ - !ruby/object:Gem::Version
79
+ version: 4.0.3
80
+ - - ">="
81
+ - !ruby/object:Gem::Version
82
+ version: 4.0.3
83
+ type: :runtime
84
+ prerelease: false
85
+ version_requirements: !ruby/object:Gem::Requirement
86
+ requirements:
87
+ - - "~>"
88
+ - !ruby/object:Gem::Version
89
+ version: 4.0.3
90
+ - - ">="
91
+ - !ruby/object:Gem::Version
92
+ version: 4.0.3
93
+ - !ruby/object:Gem::Dependency
94
+ name: http_logger
95
+ requirement: !ruby/object:Gem::Requirement
96
+ requirements:
97
+ - - "~>"
98
+ - !ruby/object:Gem::Version
99
+ version: 0.4.2
100
+ - - ">="
101
+ - !ruby/object:Gem::Version
102
+ version: 0.4.2
103
+ type: :runtime
104
+ prerelease: false
105
+ version_requirements: !ruby/object:Gem::Requirement
106
+ requirements:
107
+ - - "~>"
108
+ - !ruby/object:Gem::Version
109
+ version: 0.4.2
110
+ - - ">="
111
+ - !ruby/object:Gem::Version
112
+ version: 0.4.2
113
+ description: |2
114
+ Utilizing the NDFD (NWS Digital Forecast Database), weather forecasts are retrieved from NOAA's SOAP API and then translated into simple array/hash structures in Ruby."
115
+ email:
116
+ - angelo.lakra@gmail.com
117
+ executables:
118
+ - wf-console
119
+ extensions: []
120
+ extra_rdoc_files:
121
+ - README.md
122
+ files:
123
+ - ".gitignore"
124
+ - ".rspec"
125
+ - ".travis.yml"
126
+ - Gemfile
127
+ - LICENSE
128
+ - README.md
129
+ - bin/wf-console
130
+ - lib/weather-forecasts.rb
131
+ - lib/weather_forecasts.rb
132
+ - lib/weather_forecasts/client.rb
133
+ - lib/weather_forecasts/client/error.rb
134
+ - lib/weather_forecasts/client/help_console.rb
135
+ - lib/weather_forecasts/client/query.rb
136
+ - lib/weather_forecasts/client/query/query_property.rb
137
+ - lib/weather_forecasts/client/query/query_utilities.rb
138
+ - lib/weather_forecasts/client/query/select_by_days_query.rb
139
+ - lib/weather_forecasts/client/query/select_coordinates_by_cities_query.rb
140
+ - lib/weather_forecasts/client/query/select_coordinates_by_zip_query.rb
141
+ - lib/weather_forecasts/client/query/select_corner_coordinates_query.rb
142
+ - lib/weather_forecasts/client/query/select_gridpoint_coordinates_query.rb
143
+ - lib/weather_forecasts/client/query/select_linepoint_coordinates_query.rb
144
+ - lib/weather_forecasts/client/query/select_query.rb
145
+ - lib/weather_forecasts/client/query/select_square_coordinates_query.rb
146
+ - lib/weather_forecasts/client/query/selection_attributes.rb
147
+ - lib/weather_forecasts/client/version.rb
148
+ - lib/weather_forecasts/dwml.rb
149
+ - lib/weather_forecasts/dwml/data_extractor.rb
150
+ - lib/weather_forecasts/dwml/head_extractor.rb
151
+ - lib/weather_forecasts/dwml/location.rb
152
+ - lib/weather_forecasts/dwml/parameter_extractor.rb
153
+ - lib/weather_forecasts/dwml/time_layout.rb
154
+ - spec/fixtures/vcr_cassettes/select_by_days_query.yml
155
+ - spec/fixtures/vcr_cassettes/select_coordinates_by_cities_query.yml
156
+ - spec/fixtures/vcr_cassettes/select_coordinates_by_zip_query.yml
157
+ - spec/fixtures/vcr_cassettes/select_corner_coordinates_query.yml
158
+ - spec/fixtures/vcr_cassettes/select_gridpoint_coordinates_query.yml
159
+ - spec/fixtures/vcr_cassettes/select_linepoint_coordinates_query.yml
160
+ - spec/fixtures/vcr_cassettes/select_query.yml
161
+ - spec/fixtures/vcr_cassettes/select_square_coordinates_query.yml
162
+ - spec/lib/ndfd/client/query/query_property_spec.rb
163
+ - spec/lib/ndfd/client/query/select_by_days_query_spec.rb
164
+ - spec/lib/ndfd/client/query/select_coordinates_by_cities_query_spec.rb
165
+ - spec/lib/ndfd/client/query/select_coordinates_by_zip_query_spec.rb
166
+ - spec/lib/ndfd/client/query/select_corner_coordinates_query_spec.rb
167
+ - spec/lib/ndfd/client/query/select_gridpoint_coordinates_query_spec.rb
168
+ - spec/lib/ndfd/client/query/select_linepoint_coordinates_query_spec.rb
169
+ - spec/lib/ndfd/client/query/select_query_spec.rb
170
+ - spec/lib/ndfd/client/query/select_square_coordinates_query_spec.rb
171
+ - spec/lib/ndfd/client/query/selection_attributes_spec.rb
172
+ - spec/lib/ndfd/client/query_spec.rb
173
+ - spec/lib/ndfd/client_spec.rb
174
+ - spec/spec_helper.rb
175
+ - spec/support/resources/sample_document.xml
176
+ - weather-forecasts.gemspec
177
+ homepage: https://github.com/alakra/weather-forecasts
178
+ licenses:
179
+ - MIT
180
+ metadata: {}
181
+ post_install_message: To start querying weather forecasts immediately, type `wf-console`.
182
+ rdoc_options: []
183
+ require_paths:
184
+ - lib
185
+ required_ruby_version: !ruby/object:Gem::Requirement
186
+ requirements:
187
+ - - ">="
188
+ - !ruby/object:Gem::Version
189
+ version: 1.9.3
190
+ required_rubygems_version: !ruby/object:Gem::Requirement
191
+ requirements:
192
+ - - ">="
193
+ - !ruby/object:Gem::Version
194
+ version: '0'
195
+ requirements: []
196
+ rubyforge_project:
197
+ rubygems_version: 2.2.2
198
+ signing_key:
199
+ specification_version: 4
200
+ summary: Client library for retrieving data from NOAA's weather forecast API
201
+ test_files:
202
+ - spec/fixtures/vcr_cassettes/select_by_days_query.yml
203
+ - spec/fixtures/vcr_cassettes/select_coordinates_by_cities_query.yml
204
+ - spec/fixtures/vcr_cassettes/select_coordinates_by_zip_query.yml
205
+ - spec/fixtures/vcr_cassettes/select_corner_coordinates_query.yml
206
+ - spec/fixtures/vcr_cassettes/select_gridpoint_coordinates_query.yml
207
+ - spec/fixtures/vcr_cassettes/select_linepoint_coordinates_query.yml
208
+ - spec/fixtures/vcr_cassettes/select_query.yml
209
+ - spec/fixtures/vcr_cassettes/select_square_coordinates_query.yml
210
+ - spec/lib/ndfd/client/query/query_property_spec.rb
211
+ - spec/lib/ndfd/client/query/select_by_days_query_spec.rb
212
+ - spec/lib/ndfd/client/query/select_coordinates_by_cities_query_spec.rb
213
+ - spec/lib/ndfd/client/query/select_coordinates_by_zip_query_spec.rb
214
+ - spec/lib/ndfd/client/query/select_corner_coordinates_query_spec.rb
215
+ - spec/lib/ndfd/client/query/select_gridpoint_coordinates_query_spec.rb
216
+ - spec/lib/ndfd/client/query/select_linepoint_coordinates_query_spec.rb
217
+ - spec/lib/ndfd/client/query/select_query_spec.rb
218
+ - spec/lib/ndfd/client/query/select_square_coordinates_query_spec.rb
219
+ - spec/lib/ndfd/client/query/selection_attributes_spec.rb
220
+ - spec/lib/ndfd/client/query_spec.rb
221
+ - spec/lib/ndfd/client_spec.rb
222
+ - spec/spec_helper.rb
223
+ - spec/support/resources/sample_document.xml
224
+ has_rdoc: