<?xml version="1.0" encoding="UTF-8"?>
<commit>
  <added type="array">
    <added>
      <filename>lib/httparty/xml.rb</filename>
    </added>
    <added>
      <filename>lib/module_level_inheritable_attributes.rb</filename>
    </added>
    <added>
      <filename>spec/fixtures/delicious.xml</filename>
    </added>
    <added>
      <filename>spec/fixtures/google.html</filename>
    </added>
    <added>
      <filename>spec/fixtures/twitter.json</filename>
    </added>
    <added>
      <filename>spec/fixtures/twitter.xml</filename>
    </added>
  </added>
  <modified type="array">
    <modified>
      <diff>@@ -7,34 +7,9 @@ require 'active_support'
 dir = File.dirname(__FILE__)
 $:.unshift(dir) unless $:.include?(dir) || $:.include?(File.expand_path(dir))
 
+require 'module_level_inheritable_attributes'
 require 'httparty/request'
 
-module ModuleLevelInheritableAttributes
-  def self.included(base)
-    base.extend(ClassMethods)
-  end
-  
-  module ClassMethods
-    def mattr_inheritable(*args)
-      @mattr_inheritable_attrs ||= [:mattr_inheritable_attrs]
-      @mattr_inheritable_attrs += args
-      args.each do |arg|
-        module_eval %(
-          class &lt;&lt; self; attr_accessor :#{arg} end
-        )
-      end
-      @mattr_inheritable_attrs
-    end
-
-    def inherited(subclass)
-      @mattr_inheritable_attrs.each do |inheritable_attribute|
-        instance_var = &quot;@#{inheritable_attribute}&quot; 
-        subclass.instance_variable_set(instance_var, instance_variable_get(instance_var))
-      end
-    end
-  end
-end
-
 module HTTParty
   class UnsupportedFormat &lt; StandardError; end
   class RedirectionTooDeep &lt; StandardError; end
@@ -53,13 +28,6 @@ module HTTParty
       @default_options
     end
 
-    #
-    # Set an http proxy
-    #
-    #	class Twitter
-    #	  include HTTParty
-    #	  http_proxy 'http://myProxy', 1080
-    # ....
     def http_proxy(addr=nil, port = nil)
       default_options[:http_proxyaddr] = addr
       default_options[:http_proxyport] = port
@@ -132,5 +100,4 @@ module HTTParty
   def self.delete(*args)
     Basement.delete(*args)
   end
-
 end</diff>
      <filename>lib/httparty.rb</filename>
    </modified>
    <modified>
      <diff>@@ -32,6 +32,10 @@ module HTTParty
       uri
     end
     
+    def format
+      options[:format]
+    end
+    
     def perform
       validate!
       handle_response!(get_response(uri))
@@ -47,10 +51,18 @@ module HTTParty
       
       def get_response(uri) #:nodoc:
         request = http_method.new(uri.request_uri)   
-        request.set_form_data(options[:query]) if post? &amp;&amp; options[:query]
+        
+        if post? &amp;&amp; options[:query]
+          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.initialize_http_header options[:headers]
-        request.basic_auth(options[:basic_auth][:username], options[:basic_auth][:password]) if options[:basic_auth]
+        
+        if options[:basic_auth]
+          request.basic_auth(options[:basic_auth][:username], options[:basic_auth][:password])
+        end
+        
         response = http(uri).request(request)
         options[:format] ||= format_from_mimetype(response['content-type'])
         response
@@ -88,7 +100,7 @@ module HTTParty
       
       def parse_response(body) #:nodoc:
         return nil if body.nil? or body.empty?
-        case options[:format]
+        case format
         when :xml
           Hash.from_xml(body)
         when :json</diff>
      <filename>lib/httparty/request.rb</filename>
    </modified>
    <modified>
      <diff>@@ -116,4 +116,45 @@ describe HTTParty do
       GRest.default_options.should == {:base_uri =&gt; 'grest.com', :default_params =&gt; {:one =&gt; 'two'}}
     end
   end
+  
+  describe &quot;#get&quot; do
+    it &quot;should be able to get html&quot; do
+      stub_http_response_with('google.html')
+      HTTParty.get('http://www.google.com').should == file_fixture('google.html')
+    end
+    
+    it &quot;should be able parse response type json automatically&quot; do
+      stub_http_response_with('twitter.json')
+      tweets = HTTParty.get('http://twitter.com/statuses/public_timeline.json')
+      tweets.size.should == 20
+      tweets.first['user'].should == {
+        &quot;name&quot;              =&gt; &quot;Pyk&quot;, 
+        &quot;url&quot;               =&gt; nil, 
+        &quot;id&quot;                =&gt; &quot;7694602&quot;, 
+        &quot;description&quot;       =&gt; nil, 
+        &quot;protected&quot;         =&gt; false, 
+        &quot;screen_name&quot;       =&gt; &quot;Pyk&quot;, 
+        &quot;followers_count&quot;   =&gt; 1, 
+        &quot;location&quot;          =&gt; &quot;Opera Plaza, California&quot;, 
+        &quot;profile_image_url&quot; =&gt; &quot;http://static.twitter.com/images/default_profile_normal.png&quot;
+      }
+    end
+    
+    it &quot;should be able parse response type xml automatically&quot; do
+      stub_http_response_with('twitter.xml')
+      tweets = HTTParty.get('http://twitter.com/statuses/public_timeline.xml')
+      tweets['statuses'].size.should == 20
+      tweets['statuses'].first['user'].should == {
+        &quot;name&quot;              =&gt; &quot;Magic 8 Bot&quot;, 
+        &quot;url&quot;               =&gt; nil, 
+        &quot;id&quot;                =&gt; &quot;17656026&quot;, 
+        &quot;description&quot;       =&gt; &quot;ask me a question&quot;, 
+        &quot;protected&quot;         =&gt; &quot;false&quot;, 
+        &quot;screen_name&quot;       =&gt; &quot;magic8bot&quot;, 
+        &quot;followers_count&quot;   =&gt; &quot;90&quot;, 
+        &quot;profile_image_url&quot; =&gt; &quot;http://s3.amazonaws.com/twitter_production/profile_images/65565851/8ball_large_normal.jpg&quot;, 
+        &quot;location&quot;          =&gt; nil
+      }
+    end
+  end
 end</diff>
      <filename>spec/httparty_spec.rb</filename>
    </modified>
    <modified>
      <diff>@@ -6,4 +6,24 @@ rescue LoadError
   require 'spec'
 end
 
-require File.join(File.dirname(__FILE__), '..', 'lib', 'httparty')
\ No newline at end of file
+require File.join(File.dirname(__FILE__), '..', 'lib', 'httparty')
+
+def file_fixture(filename)
+  open(File.join(File.dirname(__FILE__), 'fixtures', &quot;#{filename.to_s}&quot;)).read
+end
+
+def stub_http_response_with(fixture_name)
+  format = fixture_name.split('.').last.intern
+  data = file_fixture(fixture_name)
+  http = Net::HTTP.new('localhost', 80)
+  
+  response = Net::HTTPOK.new(&quot;1.1&quot;, 200, &quot;Content for you&quot;)
+  response.stub!(:body).and_return(data)
+  http.stub!(:request).and_return(response)
+  
+  http_request = HTTParty::Request.new(Net::HTTP::Get, '')
+  http_request.stub!(:get_response).and_return(response)
+  http_request.stub!(:format).and_return(format)
+  
+  HTTParty::Request.should_receive(:new).and_return(http_request)
+end
\ No newline at end of file</diff>
      <filename>spec/spec_helper.rb</filename>
    </modified>
  </modified>
  <removed type="array"/>
  <parents type="array">
    <parent>
      <id>e72ec5a483538eb8e133fc7c0536051b90060e18</id>
    </parent>
  </parents>
  <author>
    <name>John Nunemaker</name>
    <email>nunemaker@gmail.com</email>
  </author>
  <url>http://github.com/jnunemaker/httparty/commit/aa09eb4c656ea124f2ce75eaefc4ffdaea5fe74c</url>
  <id>aa09eb4c656ea124f2ce75eaefc4ffdaea5fe74c</id>
  <committed-date>2008-12-06T16:43:31-08:00</committed-date>
  <authored-date>2008-12-06T16:41:23-08:00</authored-date>
  <message>Moved module inheritable attributes to it's own file. Added specs for HTTParty.get.</message>
  <tree>577479da6e059bd02a00174327eb87f507b48dc1</tree>
  <committer>
    <name>John Nunemaker</name>
    <email>nunemaker@gmail.com</email>
  </committer>
</commit>
