updog 0.0.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 (3) hide show
  1. data/bin/updog +3 -0
  2. data/lib/updog.rb +26 -0
  3. metadata +84 -0
data/bin/updog ADDED
@@ -0,0 +1,3 @@
1
+ require 'updog'
2
+
3
+ Updog.get_weather(ARGV[0])
data/lib/updog.rb ADDED
@@ -0,0 +1,26 @@
1
+ require "rubygems"
2
+ require "nokogiri"
3
+ require 'open-uri'
4
+
5
+ module Updog
6
+ def self.get_weather(area)
7
+ url = "http://api.wunderground.com/auto/wui/geo/ForecastXML/index.xml?query="
8
+ document = Nokogiri::XML(open(url << area))
9
+
10
+ qualitive = document.css('fcttext')
11
+
12
+ document.css("simpleforecast forecastday").each_with_index do |forecastday, i|
13
+ highs = forecastday.css('high')
14
+ lows = forecastday.css('low')
15
+
16
+ print "\n"
17
+ print forecastday.css("date weekday").first.content
18
+ print "\n"
19
+ print " High: #{highs.css('fahrenheit').first.content} F / #{highs.css('celsius').first.content} C \n"
20
+ print " Low: #{lows.css('fahrenheit').first.content} F / #{lows.css('celsius').first.content} C \n"
21
+ print " #{qualitive[i].content} \n" if qualitive[i]
22
+ end
23
+
24
+ print "\n"
25
+ end
26
+ end
metadata ADDED
@@ -0,0 +1,84 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: updog
3
+ version: !ruby/object:Gem::Version
4
+ hash: 29
5
+ prerelease: false
6
+ segments:
7
+ - 0
8
+ - 0
9
+ - 1
10
+ version: 0.0.1
11
+ platform: ruby
12
+ authors:
13
+ - Stephen Schor
14
+ autorequire:
15
+ bindir: bin
16
+ cert_chain: []
17
+
18
+ date: 2011-09-09 00:00:00 -04:00
19
+ default_executable:
20
+ dependencies:
21
+ - !ruby/object:Gem::Dependency
22
+ name: nokogiri
23
+ prerelease: false
24
+ requirement: &id001 !ruby/object:Gem::Requirement
25
+ none: false
26
+ requirements:
27
+ - - "="
28
+ - !ruby/object:Gem::Version
29
+ hash: 3
30
+ segments:
31
+ - 1
32
+ - 5
33
+ - 0
34
+ version: 1.5.0
35
+ type: :runtime
36
+ version_requirements: *id001
37
+ description:
38
+ email:
39
+ - beholdthepanda@gmail.com
40
+ executables:
41
+ - updog
42
+ extensions: []
43
+
44
+ extra_rdoc_files: []
45
+
46
+ files:
47
+ - bin/updog
48
+ - lib/updog.rb
49
+ has_rdoc: true
50
+ homepage: https://github.com/nodanaonlyzuul/updog
51
+ licenses: []
52
+
53
+ post_install_message:
54
+ rdoc_options: []
55
+
56
+ require_paths:
57
+ - lib
58
+ required_ruby_version: !ruby/object:Gem::Requirement
59
+ none: false
60
+ requirements:
61
+ - - ">="
62
+ - !ruby/object:Gem::Version
63
+ hash: 3
64
+ segments:
65
+ - 0
66
+ version: "0"
67
+ required_rubygems_version: !ruby/object:Gem::Requirement
68
+ none: false
69
+ requirements:
70
+ - - ">="
71
+ - !ruby/object:Gem::Version
72
+ hash: 3
73
+ segments:
74
+ - 0
75
+ version: "0"
76
+ requirements: []
77
+
78
+ rubyforge_project: nowarning
79
+ rubygems_version: 1.3.7
80
+ signing_key:
81
+ specification_version: 3
82
+ summary: A Command-Line tool for getting the weather
83
+ test_files: []
84
+