nationalweather 0.1.1 → 0.1.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/lib/nationalweather.rb +9 -3
- metadata +7 -9
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: 1d7e10e6371029ae89f5a0c5c190194bbf499982
|
4
|
+
data.tar.gz: 02955711454f7fda633c89b7b0ce3467cea9e3fb
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: d54ae64fa91658e18b8b8030c4f8ab144954447207a7162e80682641e0d947cf011e82a93d9aca52661b56cfecb3bac4ea89d20fd69cb33ed39a68bd4de4f53f
|
7
|
+
data.tar.gz: 6d6c27c642736184354aff11b898349600dfa8816ef303444da9465442f2e0649ef4867e0cae8d6abcb9f60785c080877acf3c1c316610c67071402751990ab0
|
data/lib/nationalweather.rb
CHANGED
@@ -10,13 +10,13 @@ require 'nationalweather/day'
|
|
10
10
|
|
11
11
|
module NationalWeather
|
12
12
|
|
13
|
-
VERSION = '0.1.
|
13
|
+
VERSION = '0.1.2'
|
14
14
|
|
15
15
|
# Returns the current weather conditions at the station id specified, or nil if there was an error.
|
16
16
|
# For the station ID see: http://www.weather.gov/xml/current_obs/
|
17
17
|
# XML list of stations: http://www.weather.gov/xml/current_obs/index.xml
|
18
18
|
def NationalWeather::current(station_id)
|
19
|
-
xml = fetch("http://
|
19
|
+
xml = fetch("http://w1.weather.gov/xml/current_obs/#{station_id}.xml")
|
20
20
|
NationalWeather::Current.new(xml)
|
21
21
|
end
|
22
22
|
|
@@ -44,7 +44,13 @@ module NationalWeather
|
|
44
44
|
|
45
45
|
raise NationalWeather::TooManyRedirectsError, 'Too many HTTP redirects.' if limit == 0
|
46
46
|
|
47
|
-
|
47
|
+
uri = URI(uri_str)
|
48
|
+
req = Net::HTTP::Get.new(uri)
|
49
|
+
req['User-Agent'] = "amwhalen-ruby-nationalweather-#{NationalWeather::VERSION}"
|
50
|
+
|
51
|
+
response = Net::HTTP.start(uri.hostname, uri.port) {|http|
|
52
|
+
http.request(req)
|
53
|
+
}
|
48
54
|
|
49
55
|
case response
|
50
56
|
when Net::HTTPSuccess then
|
metadata
CHANGED
@@ -1,15 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: nationalweather
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
5
|
-
prerelease:
|
4
|
+
version: 0.1.2
|
6
5
|
platform: ruby
|
7
6
|
authors:
|
8
7
|
- Andrew M. Whalen
|
9
8
|
autorequire:
|
10
9
|
bindir: bin
|
11
10
|
cert_chain: []
|
12
|
-
date:
|
11
|
+
date: 2016-02-15 00:00:00.000000000 Z
|
13
12
|
dependencies: []
|
14
13
|
description: NationalWeather is a Ruby client library for the National Oceanic and
|
15
14
|
Atmospheric Administration's (NOAA) National Weather Service (NWS) forecast and
|
@@ -30,27 +29,26 @@ files:
|
|
30
29
|
homepage: https://github.com/amwhalen/nationalweather
|
31
30
|
licenses:
|
32
31
|
- MIT
|
32
|
+
metadata: {}
|
33
33
|
post_install_message:
|
34
34
|
rdoc_options: []
|
35
35
|
require_paths:
|
36
36
|
- lib
|
37
37
|
required_ruby_version: !ruby/object:Gem::Requirement
|
38
|
-
none: false
|
39
38
|
requirements:
|
40
|
-
- -
|
39
|
+
- - ">="
|
41
40
|
- !ruby/object:Gem::Version
|
42
41
|
version: 1.8.6
|
43
42
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
44
|
-
none: false
|
45
43
|
requirements:
|
46
|
-
- -
|
44
|
+
- - ">="
|
47
45
|
- !ruby/object:Gem::Version
|
48
46
|
version: '0'
|
49
47
|
requirements: []
|
50
48
|
rubyforge_project:
|
51
|
-
rubygems_version:
|
49
|
+
rubygems_version: 2.4.8
|
52
50
|
signing_key:
|
53
|
-
specification_version:
|
51
|
+
specification_version: 4
|
54
52
|
summary: Client library for NOAA's forecast and current weather services.
|
55
53
|
test_files:
|
56
54
|
- test/test_current.rb
|