ny_forecast 0.0.0

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 (3) hide show
  1. checksums.yaml +7 -0
  2. data/lib/ny_forecast.rb +26 -0
  3. metadata +44 -0
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: e529e5e8c3126f938a24b5a2803978d597e44e13
4
+ data.tar.gz: 9c5c1906dbdc791796d0581bf9f0549d9314532b
5
+ SHA512:
6
+ metadata.gz: b38df499688c553fefeb7f749bb8fa15028d56315f7f9d8fa999aa05af8ab9267f919fecb3172052fd3bb7e158a6d2b7d8f493d4b37eb6c279eeb4007007267c
7
+ data.tar.gz: df095705da67176331d0d850931a2dd357bbe72a56c23e0d949f6d7a7ac6960dea49a8e6f3bac47f7ee52741c7c1d6815c2c48b6598b038f1351b718ac7d0505
@@ -0,0 +1,26 @@
1
+ require 'nokogiri'
2
+ require 'open-uri'
3
+
4
+ class NYForecast
5
+ def initialize
6
+ @doc = Nokogiri::HTML(open("http://www.weather.com/weather/hourbyhour/graph/New+York+NY+USNY0996:1:US"))
7
+ scrape_forecast
8
+ end
9
+
10
+
11
+ def scrape_forecast
12
+
13
+
14
+ forecasts = @doc.css("div.wx-timepart").collect { |section| section.text.gsub(/\n/,'') }
15
+ forecasts.each_with_index do |forecast, i|
16
+ if i % 4 == 0
17
+ puts forecast.gsub("AM","AM\n").gsub("PM","PM\n").gsub("FEE", "\nFEE").gsub("°", "°\n").gsub("%", "%\n").gsub("Show 15 Minute Details","").gsub("mph","mph\n\n")
18
+ end
19
+ end
20
+
21
+
22
+ end
23
+
24
+ end
25
+
26
+ NYForecast.new
metadata ADDED
@@ -0,0 +1,44 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: ny_forecast
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.0.0
5
+ platform: ruby
6
+ authors:
7
+ - Chris Kohlbrenner
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2014-03-01 00:00:00.000000000 Z
12
+ dependencies: []
13
+ description: Gathers next-6-hour weather forecast for NYC from weather.com
14
+ email: chris.kohlbrenner@gmail.com
15
+ executables: []
16
+ extensions: []
17
+ extra_rdoc_files: []
18
+ files:
19
+ - lib/ny_forecast.rb
20
+ homepage: http://rubygems.org/gems/ny_forecast
21
+ licenses:
22
+ - MIT
23
+ metadata: {}
24
+ post_install_message:
25
+ rdoc_options: []
26
+ require_paths:
27
+ - lib
28
+ required_ruby_version: !ruby/object:Gem::Requirement
29
+ requirements:
30
+ - - '>='
31
+ - !ruby/object:Gem::Version
32
+ version: '0'
33
+ required_rubygems_version: !ruby/object:Gem::Requirement
34
+ requirements:
35
+ - - '>='
36
+ - !ruby/object:Gem::Version
37
+ version: '0'
38
+ requirements: []
39
+ rubyforge_project:
40
+ rubygems_version: 2.2.1
41
+ signing_key:
42
+ specification_version: 4
43
+ summary: NY weather forecast
44
+ test_files: []