<?xml version="1.0" encoding="UTF-8"?>
<commit>
  <added type="array">
    <added>
      <filename>lib/daywalker/geocoder.rb</filename>
    </added>
    <added>
      <filename>spec/daywalker/geocoder_spec.rb</filename>
    </added>
    <added>
      <filename>spec/fixtures/rpi_location.yml</filename>
    </added>
  </added>
  <modified type="array">
    <modified>
      <diff>@@ -11,6 +11,7 @@ begin
     gem.authors = [&quot;Josh Nichols&quot;]
     gem.add_dependency 'happymapper', '&gt;= 0.2.2'
     gem.add_dependency 'httparty', '&gt;= 0.3.0'
+    gem.add_dependency 'graticule', '&gt;= 0.2.8'
   end
 rescue LoadError
   puts &quot;Jeweler not available. Install it with: sudo gem install technicalpickles-jeweler -s http://gems.github.com&quot;</diff>
      <filename>Rakefile</filename>
    </modified>
    <modified>
      <diff>@@ -1,11 +1,13 @@
 require 'happymapper'
 require 'httparty'
+require 'graticule'
 
 require 'daywalker/base'
 require 'daywalker/type_converter'
 require 'daywalker/dynamic_finder_match'
 require 'daywalker/district'
 require 'daywalker/legislator'
+require 'daywalker/geocoder'
 
 module Daywalker
   # Set the API to be used
@@ -18,6 +20,16 @@ module Daywalker
     @api_key
   end
 
+  def self.geocoder=(geocoder)
+    @geocoder = geocoder
+  end
+
+  def self.geocoder
+    @geocoder
+  end
+
+  self.geocoder = Daywalker::Geocoder.new
+
   # Error for when you use the API with a bad API key
   class BadApiKey &lt; StandardError
   end</diff>
      <filename>lib/daywalker.rb</filename>
    </modified>
    <modified>
      <diff>@@ -38,5 +38,10 @@ module Daywalker
       handle_response(response)
     end
 
+    def self.find_by_address(address)
+      location = Daywalker.geocoder.locate(address)
+
+      find_by_latitude_and_longitude(location[:latitude], location[:longitude])
+    end
   end
 end</diff>
      <filename>lib/daywalker/district.rb</filename>
    </modified>
    <modified>
      <diff>@@ -86,5 +86,27 @@ describe Daywalker::District do
 
     end
   end
+
+  describe 'find_by_address' do
+    describe 'happy path' do
+      before do
+        Daywalker.geocoder.stub!(:locate).with(&quot;110 8th St., Troy, NY 12180&quot;).and_return({:longitude =&gt; -73.684236, :latitude =&gt; 42.731245})
+
+        Daywalker::District.stub!(:find_by_latitude_and_longitude).with(42.731245, -73.684236)
+      end
+
+      it 'should use find_by_latitude_and_longitude' do
+        Daywalker::District.should_receive(:find_by_latitude_and_longitude).with(42.731245, -73.684236)
+
+        Daywalker::District.find_by_address(&quot;110 8th St., Troy, NY 12180&quot;)
+      end
+
+      it 'should use the geocoder to locate a latitude and longitude' do
+        Daywalker.geocoder.should_receive(:locate).with(&quot;110 8th St., Troy, NY 12180&quot;).and_return({:longitude =&gt; -73.684236, :latitude =&gt; 42.731245})
+        Daywalker::District.find_by_address(&quot;110 8th St., Troy, NY 12180&quot;)
+      end
+
+    end
+  end
 end
 </diff>
      <filename>spec/daywalker/district_spec.rb</filename>
    </modified>
    <modified>
      <diff>@@ -1,5 +1,6 @@
 require 'rubygems'
 require 'spec'
+require 'yaml'
 require 'fake_web'
 
 $LOAD_PATH.unshift(File.dirname(__FILE__))
@@ -31,3 +32,7 @@ end
 def register_uri_with_response(uri, response)
   FakeWeb.register_uri(&quot;http://services.sunlightlabs.com/api/#{uri}&quot;, :response =&gt; fixture_path_for(response))
 end
+
+def yaml_fixture(name)
+  YAML::load_file File.join(File.dirname(__FILE__), 'fixtures', name)
+end</diff>
      <filename>spec/spec_helper.rb</filename>
    </modified>
  </modified>
  <removed type="array"/>
  <parents type="array">
    <parent>
      <id>ed04e8a11ac52be974ff842d2f2901de9066bd34</id>
    </parent>
  </parents>
  <author>
    <name>Josh Nichols</name>
    <email>josh@technicalpickles.com</email>
  </author>
  <url>http://github.com/technicalpickles/daywalker/commit/b67d598aa37343f0b855332fc5e0e9a2d362a474</url>
  <id>b67d598aa37343f0b855332fc5e0e9a2d362a474</id>
  <committed-date>2009-02-14T23:53:13-08:00</committed-date>
  <authored-date>2009-02-14T23:53:13-08:00</authored-date>
  <message>First pass at geocoding for district.</message>
  <tree>76ba3d55ecd7ba5e684641150732d651a783feef</tree>
  <committer>
    <name>Josh Nichols</name>
    <email>josh@technicalpickles.com</email>
  </committer>
</commit>
