public
Rubygem
Description: Makes http fun! Also, makes consuming restful web services dead easy.
Homepage:
Clone URL: git://github.com/jnunemaker/httparty.git
Click here to lend your support to: httparty and make a donation at www.pledgie.com !
Removed active support. Added json. Added some core extensions.
jnunemaker (author)
Sat Dec 06 19:47:01 -0800 2008
commit  8a70a8ef40531def06c950bfb4902abc774b5b31
tree    6582b0e9f859367edefabd93c2aaa7f1ff7f55cc
parent  c0ad5dece3d15f8549f5292ad678c7b18a939ccb
...
13
14
15
16
 
17
18
19
...
13
14
15
 
16
17
18
19
0
@@ -13,7 +13,7 @@ Echoe.new(ProjectName, HTTParty::Version) do |p|
0
   p.url             = "http://#{ProjectName}.rubyforge.org"
0
   p.author          = "John Nunemaker"
0
   p.email           = "nunemaker@gmail.com"
0
-  p.extra_deps      = [['activesupport', '>= 2.1']]
0
+  p.extra_deps      = [['json', '~> 1.1']]
0
   p.need_tar_gz     = false
0
   p.docs_host       = WebsitePath
0
 end
...
5
6
7
8
9
 
10
11
12
...
18
19
20
21
 
22
23
24
...
5
6
7
 
8
9
10
11
12
...
18
19
20
 
21
22
23
24
0
@@ -5,8 +5,8 @@ require 'net/https'
0
 require 'rubygems'
0
 gem 'json', '>= 1.1.3'
0
 require 'json'
0
-require 'active_support'
0
 require 'module_level_inheritable_attributes'
0
+require 'core_extensions'
0
 
0
 module HTTParty  
0
   AllowedFormats = {:xml => 'text/xml', :json => 'application/json', :html => 'text/html'}
0
@@ -18,7 +18,7 @@ module HTTParty
0
     base.instance_variable_set("@default_options", {})
0
   end
0
   
0
-  module ClassMethods    
0
+  module ClassMethods
0
     def default_options
0
       @default_options
0
     end
...
5
6
7
8
 
 
 
9
 
10
11
12
...
5
6
7
 
8
9
10
11
12
13
14
15
0
@@ -5,8 +5,11 @@ module HTTParty
0
     # Makes it so uri is sure to parse stuff like google.com without the http
0
     def self.normalize_base_uri(url) #:nodoc:
0
       use_ssl = (url =~ /^https/) || url.include?(':443')
0
-      url.chop! if url.ends_with?('/')
0
+      ends_with_slash = url =~ /\/$/
0
+      
0
+      url.chop! if ends_with_slash
0
       url.gsub!(/^https?:\/\//i, '')
0
+      
0
       "http#{'s' if use_ssl}://#{url}"
0
     end
0
     
...
84
85
86
87
 
88
89
90
...
84
85
86
 
87
88
89
90
0
@@ -84,7 +84,7 @@ describe HTTParty::Request do
0
 
0
     def setup_ok_response
0
       @ok = Net::HTTPOK.new("1.1", 200, "Content for you")
0
-      @ok.stub!(:body).and_return({"foo" => "bar"}.to_xml)
0
+      @ok.stub!(:body).and_return('<hash><foo>bar</foo></hash>')
0
       @http.should_receive(:request).and_return(@redirect, @ok)
0
       @request.options[:format] = :xml
0
     end
...
7
8
9
10
11
12
 
 
 
13
14
15
...
7
8
9
 
 
 
10
11
12
13
14
15
0
@@ -7,9 +7,9 @@ def file_fixture(filename)
0
   open(File.join(File.dirname(__FILE__), 'fixtures', "#{filename.to_s}")).read
0
 end
0
 
0
-def stub_http_response_with(fixture_name)
0
-  format = fixture_name.split('.').last.intern
0
-  data = file_fixture(fixture_name)
0
+def stub_http_response_with(filename)
0
+  format = filename.split('.').last.intern
0
+  data = file_fixture(filename)
0
   http = Net::HTTP.new('localhost', 80)
0
   
0
   response = Net::HTTPOK.new("1.1", 200, "Content for you")

Comments