<?xml version="1.0" encoding="UTF-8"?>
<commit>
  <added type="array"/>
  <modified type="array">
    <modified>
      <diff>@@ -6,15 +6,21 @@ examples/rubyurl.rb
 examples/twitter.rb
 examples/whoismyrep.rb
 History
-httparty.gemspec
+lib/core_extensions.rb
+lib/httparty/exceptions.rb
 lib/httparty/request.rb
 lib/httparty/version.rb
 lib/httparty.rb
+lib/module_level_inheritable_attributes.rb
 Manifest
 MIT-LICENSE
 Rakefile
 README
 setup.rb
+spec/fixtures/delicious.xml
+spec/fixtures/google.html
+spec/fixtures/twitter.json
+spec/fixtures/twitter.xml
 spec/httparty/request_spec.rb
 spec/httparty_spec.rb
 spec/spec.opts</diff>
      <filename>Manifest</filename>
    </modified>
    <modified>
      <diff>@@ -1,3 +1,6 @@
+require 'rubygems'
+require 'activesupport'
+
 dir = File.expand_path(File.join(File.dirname(__FILE__), '..', 'lib'))
 require File.join(dir, 'httparty')
 require 'pp'</diff>
      <filename>examples/aaws.rb</filename>
    </modified>
    <modified>
      <diff>@@ -18,7 +18,6 @@ class Delicious
   #   ie: posts(:query =&gt; {:tag =&gt; 'ruby'})
   def posts(options={})
     options.merge!({:basic_auth =&gt; @auth})
-    # get posts and convert to structs so we can do .key instead of ['key'] with results
     self.class.get('/posts/get', options)
   end
   
@@ -33,4 +32,5 @@ end
 
 delicious = Delicious.new(config['username'], config['password'])
 pp delicious.posts(:query =&gt; {:tag =&gt; 'ruby'})
+pp delicious.recent
 </diff>
      <filename>examples/delicious.rb</filename>
    </modified>
    <modified>
      <diff>@@ -28,4 +28,4 @@ twitter = Twitter.new(config['email'], config['password'])
 pp twitter.timeline
 # pp twitter.timeline(:friends, :query =&gt; {:since_id =&gt; 868482746})
 # pp twitter.timeline(:friends, :query =&gt; 'since_id=868482746')
-# pp twitter.post('this is a test')
\ No newline at end of file
+pp twitter.post('this is a test of 0.2.0')
\ No newline at end of file</diff>
      <filename>examples/twitter.rb</filename>
    </modified>
    <modified>
      <diff>@@ -2,15 +2,15 @@
 
 Gem::Specification.new do |s|
   s.name = %q{httparty}
-  s.version = &quot;0.1.8&quot;
+  s.version = &quot;0.2.0&quot;
 
   s.required_rubygems_version = Gem::Requirement.new(&quot;&gt;= 1.2&quot;) if s.respond_to? :required_rubygems_version=
   s.authors = [&quot;John Nunemaker&quot;]
-  s.date = %q{2008-12-05}
+  s.date = %q{2008-12-06}
   s.description = %q{Makes http fun! Also, makes consuming restful web services dead easy.}
   s.email = %q{nunemaker@gmail.com}
-  s.extra_rdoc_files = [&quot;lib/httparty/request.rb&quot;, &quot;lib/httparty/version.rb&quot;, &quot;lib/httparty.rb&quot;, &quot;README&quot;]
-  s.files = [&quot;examples/aaws.rb&quot;, &quot;examples/basic.rb&quot;, &quot;examples/delicious.rb&quot;, &quot;examples/google.rb&quot;, &quot;examples/rubyurl.rb&quot;, &quot;examples/twitter.rb&quot;, &quot;examples/whoismyrep.rb&quot;, &quot;History&quot;, &quot;httparty.gemspec&quot;, &quot;lib/httparty/request.rb&quot;, &quot;lib/httparty/version.rb&quot;, &quot;lib/httparty.rb&quot;, &quot;Manifest&quot;, &quot;MIT-LICENSE&quot;, &quot;Rakefile&quot;, &quot;README&quot;, &quot;setup.rb&quot;, &quot;spec/httparty/request_spec.rb&quot;, &quot;spec/httparty_spec.rb&quot;, &quot;spec/spec.opts&quot;, &quot;spec/spec_helper.rb&quot;, &quot;website/css/common.css&quot;, &quot;website/index.html&quot;]
+  s.extra_rdoc_files = [&quot;lib/core_extensions.rb&quot;, &quot;lib/httparty/exceptions.rb&quot;, &quot;lib/httparty/request.rb&quot;, &quot;lib/httparty/version.rb&quot;, &quot;lib/httparty.rb&quot;, &quot;lib/module_level_inheritable_attributes.rb&quot;, &quot;README&quot;]
+  s.files = [&quot;examples/aaws.rb&quot;, &quot;examples/basic.rb&quot;, &quot;examples/delicious.rb&quot;, &quot;examples/google.rb&quot;, &quot;examples/rubyurl.rb&quot;, &quot;examples/twitter.rb&quot;, &quot;examples/whoismyrep.rb&quot;, &quot;History&quot;, &quot;httparty.gemspec&quot;, &quot;lib/core_extensions.rb&quot;, &quot;lib/httparty/exceptions.rb&quot;, &quot;lib/httparty/request.rb&quot;, &quot;lib/httparty/version.rb&quot;, &quot;lib/httparty.rb&quot;, &quot;lib/module_level_inheritable_attributes.rb&quot;, &quot;Manifest&quot;, &quot;MIT-LICENSE&quot;, &quot;Rakefile&quot;, &quot;README&quot;, &quot;setup.rb&quot;, &quot;spec/fixtures/delicious.xml&quot;, &quot;spec/fixtures/google.html&quot;, &quot;spec/fixtures/twitter.json&quot;, &quot;spec/fixtures/twitter.xml&quot;, &quot;spec/httparty/request_spec.rb&quot;, &quot;spec/httparty_spec.rb&quot;, &quot;spec/spec.opts&quot;, &quot;spec/spec_helper.rb&quot;, &quot;website/css/common.css&quot;, &quot;website/index.html&quot;]
   s.has_rdoc = true
   s.homepage = %q{http://httparty.rubyforge.org}
   s.post_install_message = %q{When you HTTParty, you must party hard!}
@@ -25,14 +25,14 @@ Gem::Specification.new do |s|
     s.specification_version = 2
 
     if Gem::Version.new(Gem::RubyGemsVersion) &gt;= Gem::Version.new('1.2.0') then
-      s.add_runtime_dependency(%q&lt;activesupport&gt;, [&quot;&gt;= 2.1&quot;])
+      s.add_runtime_dependency(%q&lt;json&gt;, [&quot;~&gt; 1.1&quot;])
       s.add_development_dependency(%q&lt;echoe&gt;, [&quot;&gt;= 0&quot;])
     else
-      s.add_dependency(%q&lt;activesupport&gt;, [&quot;&gt;= 2.1&quot;])
+      s.add_dependency(%q&lt;json&gt;, [&quot;~&gt; 1.1&quot;])
       s.add_dependency(%q&lt;echoe&gt;, [&quot;&gt;= 0&quot;])
     end
   else
-    s.add_dependency(%q&lt;activesupport&gt;, [&quot;&gt;= 2.1&quot;])
+    s.add_dependency(%q&lt;json&gt;, [&quot;~&gt; 1.1&quot;])
     s.add_dependency(%q&lt;echoe&gt;, [&quot;&gt;= 0&quot;])
   end
 end</diff>
      <filename>httparty.gemspec</filename>
    </modified>
    <modified>
      <diff>@@ -289,4 +289,52 @@ class Hash
   def self.from_xml(xml)
     ToHashParser.from_xml(xml)
   end
+  
+  # @return &lt;String&gt; This hash as a query string
+  #
+  # @example
+  #   { :name =&gt; &quot;Bob&quot;,
+  #     :address =&gt; {
+  #       :street =&gt; '111 Ruby Ave.',
+  #       :city =&gt; 'Ruby Central',
+  #       :phones =&gt; ['111-111-1111', '222-222-2222']
+  #     }
+  #   }.to_params
+  #     #=&gt; &quot;name=Bob&amp;address[city]=Ruby Central&amp;address[phones][]=111-111-1111&amp;address[phones][]=222-222-2222&amp;address[street]=111 Ruby Ave.&quot;
+  def to_params
+    params = self.map { |k,v| normalize_param(k,v) }.join
+    params.chop! # trailing &amp;
+    params
+  end
+
+  # @param key&lt;Object&gt; The key for the param.
+  # @param value&lt;Object&gt; The value for the param.
+  #
+  # @return &lt;String&gt; This key value pair as a param
+  #
+  # @example normalize_param(:name, &quot;Bob&quot;) #=&gt; &quot;name=Bob&amp;&quot;
+  def normalize_param(key, value)
+    param = ''
+    stack = []
+
+    if value.is_a?(Array)
+      param &lt;&lt; value.map { |element| normalize_param(&quot;#{key}[]&quot;, element) }.join
+    elsif value.is_a?(Hash)
+      stack &lt;&lt; [key,value]
+    else
+      param &lt;&lt; &quot;#{key}=#{value}&amp;&quot;
+    end
+
+    stack.each do |parent, hash|
+      hash.each do |key, value|
+        if value.is_a?(Hash)
+          stack &lt;&lt; [&quot;#{parent}[#{key}]&quot;, value]
+        else
+          param &lt;&lt; normalize_param(&quot;#{parent}[#{key}]&quot;, value)
+        end
+      end
+    end
+
+    param
+  end
 end
\ No newline at end of file</diff>
      <filename>lib/core_extensions.rb</filename>
    </modified>
    <modified>
      <diff>@@ -31,7 +31,7 @@ module HTTParty
 
     def base_uri(uri=nil)
       return default_options[:base_uri] unless uri
-      default_options[:base_uri] = uri
+      default_options[:base_uri] = HTTParty.normalize_base_uri(uri)
     end
 
     def basic_auth(u, p)
@@ -73,10 +73,20 @@ module HTTParty
 
     private
       def perform_request(http_method, path, options) #:nodoc:
-        Request.new(http_method, path, default_options.merge(options)).perform
+        Request.new(http_method, path, default_options.dup.merge(options)).perform
       end
   end
 
+  def self.normalize_base_uri(url) #:nodoc:
+    use_ssl = (url =~ /^https/) || url.include?(':443')
+    ends_with_slash = url =~ /\/$/
+    
+    url.chop! if ends_with_slash
+    url.gsub!(/^https?:\/\//i, '')
+    
+    &quot;http#{'s' if use_ssl}://#{url}&quot;
+  end
+  
   class Basement
     include HTTParty
   end</diff>
      <filename>lib/httparty.rb</filename>
    </modified>
    <modified>
      <diff>@@ -1,29 +1,18 @@
 require 'uri'
 
 module HTTParty
-  class Request
-    # Makes it so uri is sure to parse stuff like google.com without the http
-    def self.normalize_base_uri(url) #:nodoc:
-      use_ssl = (url =~ /^https/) || url.include?(':443')
-      ends_with_slash = url =~ /\/$/
-      
-      url.chop! if ends_with_slash
-      url.gsub!(/^https?:\/\//i, '')
-      
-      &quot;http#{'s' if use_ssl}://#{url}&quot;
-    end
-    
+  class Request    
     SupportedHTTPMethods = [Net::HTTP::Get, Net::HTTP::Post, Net::HTTP::Put, Net::HTTP::Delete]
     
     attr_accessor :http_method, :path, :options
     
-    def initialize(http_method, path, options={})
+    def initialize(http_method, path, o={})
       self.http_method = http_method
       self.path = path
       self.options = {
-        :limit =&gt; options.delete(:no_follow) ? 0 : 5, 
+        :limit =&gt; o.delete(:no_follow) ? 0 : 5, 
         :default_params =&gt; {},
-      }.merge(options.dup)
+      }.merge(o)
     end
 
     def path=(uri)
@@ -31,7 +20,6 @@ module HTTParty
     end
     
     def uri
-      options[:base_uri] = self.class.normalize_base_uri(options[:base_uri]) unless options[:base_uri].nil?
       uri = path.relative? ? URI.parse(&quot;#{options[:base_uri]}#{path}&quot;) : path
       uri.query = query_string(uri)
       uri
@@ -61,7 +49,7 @@ module HTTParty
           request.set_form_data(options[:query])
         end
         
-        request.body = options[:body].is_a?(Hash) ? options[:body].to_query : options[:body] unless options[:body].blank?
+        request.body = options[:body].is_a?(Hash) ? options[:body].to_params : options[:body] unless options[:body].blank?
         request.initialize_http_header options[:headers]
         
         if options[:basic_auth]
@@ -78,9 +66,9 @@ module HTTParty
         query_string_parts &lt;&lt; uri.query unless uri.query.blank?
 
         if options[:query].is_a?(Hash)
-          query_string_parts &lt;&lt; options[:default_params].merge(options[:query]).to_query
+          query_string_parts &lt;&lt; options[:default_params].merge(options[:query]).to_params
         else
-          query_string_parts &lt;&lt; options[:default_params].to_query unless options[:default_params].blank?
+          query_string_parts &lt;&lt; options[:default_params].to_params unless options[:default_params].blank?
           query_string_parts &lt;&lt; options[:query] unless options[:query].blank?
         end
         </diff>
      <filename>lib/httparty/request.rb</filename>
    </modified>
    <modified>
      <diff>@@ -1,3 +1,3 @@
 module HTTParty
-  Version = '0.1.8'
+  Version = '0.2.0'
 end
\ No newline at end of file</diff>
      <filename>lib/httparty/version.rb</filename>
    </modified>
    <modified>
      <diff>@@ -5,35 +5,11 @@ describe HTTParty::Request do
     @request = HTTParty::Request.new(Net::HTTP::Get, 'http://api.foo.com/v1', :format =&gt; :xml)
   end
   
-  describe &quot;#normalize_base_uri&quot; do
-    it &quot;should add http if not present for non ssl requests&quot; do
-      uri = HTTParty::Request.normalize_base_uri('api.foobar.com')
-      uri.should == 'http://api.foobar.com'
-    end
-    
-    it &quot;should add https if not present for ssl requests&quot; do
-      uri = HTTParty::Request.normalize_base_uri('api.foo.com/v1:443')
-      uri.should == 'https://api.foo.com/v1:443'
-    end
-    
-    it &quot;should not remove https for ssl requests&quot; do
-      uri = HTTParty::Request.normalize_base_uri('https://api.foo.com/v1:443')
-      uri.should == 'https://api.foo.com/v1:443'
-    end
-  end
-  
   describe &quot;#format&quot; do
     it &quot;should return the correct parsing format&quot; do
       @request.format.should == :xml
     end
   end
-  
-  describe &quot;uri&quot; do
-    it &quot;should be normalized&quot; do
-      request = HTTParty::Request.new(Net::HTTP::Get, '', :base_uri =&gt; 'api.foo.com')
-      request.uri.to_s.should == 'http://api.foo.com'
-    end
-  end
 
   describe 'http' do
     it &quot;should use ssl for port 443&quot; do</diff>
      <filename>spec/httparty/request_spec.rb</filename>
    </modified>
    <modified>
      <diff>@@ -25,7 +25,7 @@ describe HTTParty do
     end
 
     it &quot;should have reader&quot; do
-      Foo.base_uri.should == 'api.foo.com/v1'
+      Foo.base_uri.should == 'http://api.foo.com/v1'
     end
     
     it 'should have writer' do
@@ -34,6 +34,23 @@ describe HTTParty do
     end
   end
   
+  describe &quot;#normalize_base_uri&quot; do
+    it &quot;should add http if not present for non ssl requests&quot; do
+      uri = HTTParty.normalize_base_uri('api.foobar.com')
+      uri.should == 'http://api.foobar.com'
+    end
+    
+    it &quot;should add https if not present for ssl requests&quot; do
+      uri = HTTParty.normalize_base_uri('api.foo.com/v1:443')
+      uri.should == 'https://api.foo.com/v1:443'
+    end
+    
+    it &quot;should not remove https for ssl requests&quot; do
+      uri = HTTParty.normalize_base_uri('https://api.foo.com/v1:443')
+      uri.should == 'https://api.foo.com/v1:443'
+    end
+  end
+  
   describe &quot;headers&quot; do
     it &quot;should default to empty hash&quot; do
       Foo.headers.should == {}
@@ -112,8 +129,8 @@ describe HTTParty do
   
   describe &quot;with multiple class definitions&quot; do
     it &quot;should not run over each others options&quot; do
-      HRest.default_options.should == {:base_uri =&gt; 'hrest.com', :default_params =&gt; {:two =&gt; 'three'}}
-      GRest.default_options.should == {:base_uri =&gt; 'grest.com', :default_params =&gt; {:one =&gt; 'two'}}
+      HRest.default_options.should == {:base_uri =&gt; 'http://hrest.com', :default_params =&gt; {:two =&gt; 'three'}}
+      GRest.default_options.should == {:base_uri =&gt; 'http://grest.com', :default_params =&gt; {:one =&gt; 'two'}}
     end
   end
   </diff>
      <filename>spec/httparty_spec.rb</filename>
    </modified>
  </modified>
  <removed type="array"/>
  <parents type="array">
    <parent>
      <id>7fab301eb592353311a064c76e93c2363f8b7658</id>
    </parent>
  </parents>
  <author>
    <name>John Nunemaker</name>
    <email>nunemaker@gmail.com</email>
  </author>
  <url>http://github.com/jnunemaker/httparty/commit/411340826ba683397df84e611956b34eae398d93</url>
  <id>411340826ba683397df84e611956b34eae398d93</id>
  <committed-date>2008-12-06T20:41:28-08:00</committed-date>
  <authored-date>2008-12-06T20:41:28-08:00</authored-date>
  <message>Fixed weird uri normalizing issue that occurred when I was doing normalization in request object. Also caught a piece of ActiveSupport Hash#to_query that I was using. Added Hash#to_params to fix that bug.</message>
  <tree>b818ae68c30a2946a91f7968cae9333cc55e6476</tree>
  <committer>
    <name>John Nunemaker</name>
    <email>nunemaker@gmail.com</email>
  </committer>
</commit>
