<?xml version="1.0" encoding="UTF-8"?>
<commit>
  <added type="array">
    <added>
      <filename>README.markdown</filename>
    </added>
  </added>
  <modified type="array">
    <modified>
      <diff>@@ -21,6 +21,8 @@ class WeatherMan
   # partner id and license key can be obtained
   # when you sign up for the weather.com xml api at
   # http://www.weather.com/services/xmloap.html
+  @@partner_id = nil
+  @@license_key = nil
   def self.partner_id; @@partner_id; end;
   def self.partner_id=(pid); @@partner_id = pid; end;
   def self.license_key; @@license_key; end;
@@ -30,25 +32,18 @@ class WeatherMan
   # name is the human readable name of the location ie. 'New York, NY'
   attr_reader :id, :name
   
-  def initialize(location_id, location_name = 'n/a', verify_location = true)
+  def initialize(location_id, location_name = 'n/a')
     @id = location_id
     @name = location_name
     
     self.class.check_authentication
-    
-    if verify_location
-      # Send a call to the api to check that this location exists
-      # raise(WeatherManLocationNotFoundError, &quot;WeatherMan: A location could not be found using ID=#{location_id}&quot;)
-    end
   end
   
   def fetch(options = {})
     options = default_forecast_options.merge(options)
     api_url = weather_url(options) 
     
-    if response = self.class.fetch_response(api_url)
-      WeatherManResponse.new(response, api_url)
-    end
+    WeatherManResponse.new(self.class.fetch_response(api_url), api_url)
   end
   
   # Return an array of matching locations
@@ -57,21 +52,15 @@ class WeatherMan
     check_authentication
     
     if response = fetch_response(search_url(:where =&gt; where))
-      response['loc'] ? response['loc'].map {|location| new(location['id'], location['content'], false)} : []
+      response['loc'] ? response['loc'].map {|location| new(location['id'], location['content'])} : []
     end
   end
   
-  # TODO: REMOVE THIS!!!!!!!!!!!
-  # !!!!!!!!!!!!!!!!!!!!!!!!!!!!
-  def self.defaults
-    @@partner_id = '1075758518'
-    @@license_key = '7c731d27fae916fb'
-  end
-  
   protected
     # API url for accssing weather
     def weather_url(options = {})
       options = encode_options(options)
+      options[:unit] = options[:unit].to_s.downcase[0..0] if options[:unit] # Allows for :metric, 'metric', 'Metric', or standard 'm'
 
       url  = &quot;http://xoap.weather.com/weather/local/#{self.id}&quot;
       url &lt;&lt; &quot;?par=#{@@partner_id}&quot;
@@ -87,7 +76,7 @@ class WeatherMan
     def default_forecast_options
       {
         :current_conditions =&gt; true,
-        :days               =&gt; 5,
+        :days               =&gt; 5, # 0 - 5
         :unit               =&gt; DEFAULT_UNIT
       }
     end
@@ -104,10 +93,11 @@ class WeatherMan
       xml_data = Net::HTTP.get_response(URI.parse(api_url)).body
       response = XmlSimple.xml_in(xml_data)
       
+      # Check if a response was returned at all
+      raise(WeatherManNoResponseError, &quot;WeatherMan Error: No Response.&quot;) unless response
+      
       # Check if API call threw an error
-      if response['err']
-        raise(WeatherManApiError, &quot;WeatherMan Error #{response['err']['type']}: #{response['err']['content']}&quot;)
-      end
+      raise(WeatherManApiError, &quot;WeatherMan Error #{response['err'][0]['type']}: #{response['err'][0]['content']}&quot;) if response['err']
       
       response
     end</diff>
      <filename>lib/weather_man.rb</filename>
    </modified>
    <modified>
      <diff>@@ -1,12 +1,14 @@
+require 'ostruct'
+
 class WeatherManResponse
   attr_reader :current_conditions, :forecast, :api_url
   
-  def initialize(simple_xml, api_url = nil)
+  def initialize(simple_xml, url = nil)
     @current_conditions = build_current_conditions(simple_xml['cc'][0])
     @forecast = build_forecast(simple_xml['dayf'][0]['day'])
     
     # The api url that was called to generate this response
-    @api_url = api_url
+    @api_url = url
   end
   
   def build_current_conditions(response = {})
@@ -22,24 +24,24 @@ class WeatherManResponse
     cc.humidity             = response['hmid'][0]
     cc.visibility           = response['vis'][0]
     cc.dew_point            = response['dewp'][0]
-    cc.barometric_pressure  = {
+    cc.barometric_pressure  = WeatherManBarometer.new({
                                 :reading      =&gt; response['bar'][0]['r'][0],
                                 :description  =&gt; response['bar'][0]['d'][0]
-                              }
-    cc.wind                 = {
+                              })
+    cc.wind                 = WeatherManWind.new({
                                 :speed        =&gt; response['wind'][0]['s'][0],
                                 :gust         =&gt; response['wind'][0]['gust'][0],
                                 :degrees      =&gt; response['wind'][0]['d'][0],
                                 :direction    =&gt; response['wind'][0]['t'][0]
-                              }
-    cc.uv                   = {
+                              })
+    cc.uv                   = WeatherManUV.new({
                                 :index        =&gt; response['uv'][0]['i'][0],
                                 :description  =&gt; response['uv'][0]['t'][0]
-                              }
-    cc.moon                 = {
+                              })
+    cc.moon                 = WeatherManMoon.new({
                                 :icon_code    =&gt; response['moon'][0]['icon'][0],
                                 :description  =&gt; response['moon'][0]['t'][0]
-                              }
+                              })
     cc    
   end
   
@@ -72,12 +74,42 @@ class WeatherManForecast &lt; Array
   WEEK_DAYS = %w(sunday monday tuesday wednesday thursday friday saturday)
   WEEK_DAYS.each {|day| attr_reader day.to_sym}
   
+  # Assign a forecast day to a week day accessor as it gets added
+  # allows for accessors like forecast.monday -&gt; &lt;WeatherManForecastDay&gt;
   def &lt;&lt;(day)
     super
-    offset = Time.now.wday
-    wday = (self.size - 1) + offset
-    wday = wday &gt; 6 ? wday - 6 : wday # I know theres a better way to do this, too tired now
-    eval(&quot;@#{WEEK_DAYS[wday]} = day&quot;)
+    eval(&quot;@#{day.week_day.downcase} = day&quot;)
+  end
+  
+  def today
+    self[0]
+  end
+  
+  def tomorrow
+    self[1]
+  end
+  
+  # Returns a forecast for a day given by a Date, DateTime,
+  # Time, or a string that can be parsed to a date
+  def for(date = Date.today)
+    # Format date into a Date class
+    date = case date.class.name
+           when 'String'
+             Date.parse(date)
+           when 'Date'
+             date
+           when 'DateTime'
+             Date.new(date.year, date.month, date.day)
+           when 'Time'
+             Date.new(date.year, date.month, date.day)
+           end
+    
+    day = nil
+    # find the matching forecast day, if any
+    self.each do |fd|
+      day = fd if date == fd.date
+    end
+    return day
   end
 end
 
@@ -90,11 +122,13 @@ class WeatherManForecastDay
                 :sunset,
                 :day,
                 :night
-                
+  
+  # Build a new WeatherManForecastDay based on
+  # A response from the Weather Channel
   def self.build(response = {})
     fd = new
     fd.week_day = response['t']
-    fd.date     = response['dt']
+    fd.date     = Date.parse(response['dt'])
     fd.high     = response['hi'][0]
     fd.low      = response['low'][0]
     fd.sunrise  = response['sunr'][0]
@@ -105,18 +139,40 @@ class WeatherManForecastDay
   end
   
   protected
+    # Build a part day
     def self.build_part(part)
-      {
+      WeatherManForecastPart.new({
         :icon_code            =&gt; part['icon'][0],
         :description          =&gt; part['t'][0],
         :chance_percipitation =&gt; part['ppcp'][0],
         :humidity             =&gt; part['hmid'][0],
-        :wind                 =&gt; {
+        :wind                 =&gt; WeatherManWind.new({
                                    :speed     =&gt; part['wind'][0]['s'][0],
                                    :gust      =&gt; part['wind'][0]['gust'][0],
                                    :degrees   =&gt; part['wind'][0]['d'][0],
-                                   :direction =&gt; part['wind'][0]['t'][0]
-                                 }
-      }
+                                   :direction =&gt; part['wind'][0]['t'][0]     
+                                 })
+      })
     end
+end
+
+# =================================
+# WeatherMan Response classes
+# used for tracking groups of data
+# ie. Forecast parts, Barometer,
+# UV, Moon, and Wind
+# =================================
+class WeatherManForecastPart &lt; OpenStruct
+end
+
+class WeatherManBarometer &lt; OpenStruct
+end
+
+class WeatherManUV &lt; OpenStruct
+end
+
+class WeatherManMoon &lt; OpenStruct
+end
+
+class WeatherManWind &lt; OpenStruct
 end
\ No newline at end of file</diff>
      <filename>lib/weather_man_response.rb</filename>
    </modified>
  </modified>
  <removed type="array">
    <removed>
      <filename>README</filename>
    </removed>
  </removed>
  <parents type="array">
    <parent>
      <id>6f2e168601a0de1b2b2791920cf774796573064b</id>
    </parent>
  </parents>
  <author>
    <name>Jared Pace</name>
    <email>jared@codewordstudios.com</email>
  </author>
  <url>http://github.com/jdpace/weatherman/commit/1745a63a96f94ac29739e3a4c3d258fce358b84f</url>
  <id>1745a63a96f94ac29739e3a4c3d258fce358b84f</id>
  <committed-date>2008-09-29T13:46:44-07:00</committed-date>
  <authored-date>2008-09-29T13:46:44-07:00</authored-date>
  <message>Finished 0.1 version with documentation</message>
  <tree>73e03967ae68b12558fb5a141ba0a55f463d6cae</tree>
  <committer>
    <name>Jared Pace</name>
    <email>jared@codewordstudios.com</email>
  </committer>
</commit>
