httparty 0.1.1 → 0.1.2

Sign up to get free protection for your applications and to get access to all the features.

Potentially problematic release.


This version of httparty might be problematic. Click here for more details.

@@ -1,3 +1,8 @@
1
+ == 0.1.2 2008-08-09
2
+
3
+ * 1 major enhancement:
4
+ * default_params were not being appended to query string if option[:query] was blank
5
+
1
6
  == 0.1.1 2008-07-30
2
7
 
3
8
  * 2 major enhancement:
data/README.txt CHANGED
@@ -30,13 +30,14 @@ That works and all but what if you don't want to embed your username and passwor
30
30
  class Twitter
31
31
  include HTTParty
32
32
  base_uri 'twitter.com'
33
-
34
- def initialize(user, pass)
35
- self.class.basic_auth user, pass
33
+
34
+ def initialize(u, p)
35
+ @auth = {:username => u, :password => p}
36
36
  end
37
-
37
+
38
38
  def post(text)
39
- self.class.post('/statuses/update.json', :query => {:status => text})
39
+ options = { :query => {:status => text}, :basic_auth => @auth }
40
+ self.class.post('/statuses/update.json', options)
40
41
  end
41
42
  end
42
43
 
@@ -1,10 +1,10 @@
1
1
  Gem::Specification.new do |s|
2
2
  s.name = %q{httparty}
3
- s.version = "0.1.1"
3
+ s.version = "0.1.2"
4
4
 
5
5
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
6
6
  s.authors = ["John Nunemaker"]
7
- s.date = %q{2008-07-31}
7
+ s.date = %q{2008-08-09}
8
8
  s.description = %q{Makes http fun! Also, makes consuming restful web services dead easy.}
9
9
  s.email = ["nunemaker@gmail.com"]
10
10
  s.extra_rdoc_files = ["History.txt", "License.txt", "Manifest.txt", "PostInstall.txt", "README.txt"]
@@ -30,4 +30,4 @@ Gem::Specification.new do |s|
30
30
  else
31
31
  s.add_dependency(%q<activesupport>, [">= 2.1"])
32
32
  end
33
- end
33
+ end
@@ -78,7 +78,7 @@ module HTTParty
78
78
  end
79
79
 
80
80
  private
81
- def http(uri)
81
+ def http(uri) #:nodoc:
82
82
  if @http.blank?
83
83
  @http = Net::HTTP.new(uri.host, uri.port)
84
84
  @http.use_ssl = (uri.port == 443)
@@ -94,7 +94,7 @@ module HTTParty
94
94
  # body => hash of keys/values or a query string (foo=bar&baz=poo)
95
95
  # headers => hash of headers to send request with
96
96
  # basic_auth => :username and :password to use as basic http authentication (overrides @auth class instance variable)
97
- def send_request(method, path, options={})
97
+ def send_request(method, path, options={}) #:nodoc:
98
98
  raise ArgumentError, 'only get, post, put and delete methods are supported' unless %w[get post put delete].include?(method.to_s)
99
99
  raise ArgumentError, ':headers must be a hash' if options[:headers] && !options[:headers].is_a?(Hash)
100
100
  raise ArgumentError, ':basic_auth must be a hash' if options[:basic_auth] && !options[:basic_auth].is_a?(Hash)
@@ -104,7 +104,7 @@ module HTTParty
104
104
  uri = URI.parse("#{base_uri}#{path}")
105
105
  existing_query = uri.query ? "#{uri.query}&" : ''
106
106
  uri.query = if options[:query].blank?
107
- existing_query
107
+ existing_query + default_params.to_query
108
108
  else
109
109
  existing_query + (options[:query].is_a?(Hash) ? default_params.merge(options[:query]).to_query : options[:query])
110
110
  end
@@ -119,7 +119,7 @@ module HTTParty
119
119
  parse_response(response.body)
120
120
  end
121
121
 
122
- def parse_response(body)
122
+ def parse_response(body) #:nodoc:
123
123
  case @format
124
124
  when 'xml'
125
125
  Hash.from_xml(body)
@@ -132,7 +132,7 @@ module HTTParty
132
132
  end
133
133
 
134
134
  # Makes it so uri is sure to parse stuff like google.com with the http
135
- def normalize_base_uri(str)
135
+ def normalize_base_uri(str) #:nodoc:
136
136
  str =~ /^https?:\/\// ? str : "http#{'s' if str.include?(':443')}://#{str}"
137
137
  end
138
138
 
@@ -140,7 +140,7 @@ module HTTParty
140
140
  # Just does simple pattern matching on file extention:
141
141
  # /foobar.xml => 'xml'
142
142
  # /foobar.json => 'json'
143
- def format_from_path(path)
143
+ def format_from_path(path) #:nodoc:
144
144
  ext = File.extname(path)[1..-1]
145
145
  !ext.blank? && AllowedFormats.include?(ext) ? ext : nil
146
146
  end
@@ -2,7 +2,7 @@ module HTTParty
2
2
  module VERSION #:nodoc:
3
3
  MAJOR = 0
4
4
  MINOR = 1
5
- TINY = 1
5
+ TINY = 2
6
6
 
7
7
  STRING = [MAJOR, MINOR, TINY].join('.')
8
8
  end
@@ -1,3 +1,12 @@
1
+ desc 'Preps the gem for a new release'
2
+ task :prep_for_release do
3
+ require 'rio'
4
+ Rake::Task['manifest:refresh'].invoke
5
+ gemspec = %x[rake debug_gem]
6
+ lines = gemspec.split("\n")
7
+ rio('httparty.gemspec') < lines[1, lines.length-1].join("\n")
8
+ end
9
+
1
10
  desc 'Release the website and new gem version'
2
11
  task :deploy => [:check_version, :website, :release] do
3
12
  puts "Remember to create SVN tag:"
@@ -14,4 +14,4 @@ task :website_upload do
14
14
  end
15
15
 
16
16
  desc 'Generate and upload website files'
17
- task :website => [:website_generate, :website_upload, :publish_docs]
17
+ task :website => [:website_upload, :publish_docs]
@@ -15,6 +15,7 @@
15
15
  <ul id="nav">
16
16
  <li><a href="rdoc/">Docs</a></li>
17
17
  <li><a href="http://github.com/jnunemaker/httparty">Github</a></li>
18
+ <li><a href="http://jnunemaker.lighthouseapp.com/projects/14842-httparty/tickets">Lighthouse</a></li>
18
19
  <li><a href="http://rubyforge.org/projects/httparty/">Rubyforge</a></li>
19
20
  </ul>
20
21
  </div>
@@ -43,12 +44,13 @@ Twitter.post('/statuses/update.json', :query => {:status => "It's an HTTParty an
43
44
  include HTTParty
44
45
  base_uri 'twitter.com'
45
46
 
46
- def initialize(user, pass)
47
- self.class.basic_auth user, pass
47
+ def initialize(u, p)
48
+ @auth = {:username => u, :password => p}
48
49
  end
49
50
 
50
51
  def post(text)
51
- self.class.post('/statuses/update.json', :query => {:status => text})
52
+ options = { :query => {:status => text}, :basic_auth => @auth }
53
+ self.class.post('/statuses/update.json', options)
52
54
  end
53
55
  end
54
56
 
@@ -66,12 +68,16 @@ Twitter.new('username', 'password').post("It's an HTTParty and everyone is invit
66
68
  <p>Created by <a href="http://addictedtonew.com/about/">John Nunemaker</a></p>
67
69
  </div>
68
70
  </div>
71
+
72
+ <script type="text/javascript">
73
+ var gaJsHost = (("https:" == document.location.protocol) ? "https://ssl." : "http://www.");
74
+ document.write(unescape("%3Cscript src='" + gaJsHost + "google-analytics.com/ga.js' type='text/javascript'%3E%3C/script%3E"));
75
+ </script>
76
+ <script type="text/javascript">
77
+ var pageTracker = _gat._getTracker("UA-85301-19");
78
+ pageTracker._initData();
79
+ pageTracker._trackPageview();
80
+ </script>
69
81
 
70
- <script src="http://www.google-analytics.com/urchin.js" type="text/javascript"></script>
71
- <script type="text/javascript">_uacct = "UA-85301-9"; urchinTracker();</script>
72
-
73
- <!-- 103bees.com 'bee' code v1.11 - please do not make any changes! -->
74
- <script type="text/javascript" src="http://103bees.com/bees/?bee=3672&amp;fid=5643"></script>
75
- <!-- 103bees.com 'bee' code -->
76
82
  </body>
77
83
  </html>
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: httparty
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.1
4
+ version: 0.1.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - John Nunemaker
@@ -9,7 +9,7 @@ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
11
 
12
- date: 2008-07-31 00:00:00 -04:00
12
+ date: 2008-08-09 00:00:00 -04:00
13
13
  default_executable:
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency